1
$\begingroup$

This is partially a coding question so I hope I'm on the right platform for this. I am fitting a dynamic factor model using the state space framework. I don't know the initial distribution of the state, since I don't know anything about it. (I hope this is the right train of thought).

I have read in this paper by Durbin and Koopman and in the 2012 book by Durbin and Koopman that I should do an exact diffuse initialization of the state vector in this case. The other option, an approximate diffuse initialization, is not recommended for parameter estimation because it causes rounding errors.

I have also read this helpful article by mr Fulton on the statsmodels implementation of the state space framework that confirms this. I have come across this question, the answer of which talks a bit about exact diffuse initialization. But it's not clear to me how I can implement this in my code. It's also not clear to me what the default initialization method is, when I don't specify any as I'm doing right now.

My code looks like this (I would like to make this into a class, but I'm not sure how and I worry if it would still work the same way):

model = DynamicFactor(
                      endog=y,
                      exog=X,
                      k_factors=1,
                      freq=y.index.inferred_freq,
                      factor_order=1,
                      error_order=0,
                      error_cov_type='diagonal'
                      )

with model.fix_params(dicts):
    res = model.fit(
                   disp=True,
                   method='nm',
                   maxiter=400000
                   )

So, in short, my questions are:

  • How is my state vector initialized right now?
  • How do I make sure to have exact diffuse initialization?
$\endgroup$

1 Answer 1

1
$\begingroup$

The default for the DynamicFactor class is to initialize the state vector to the unconditional distribution of the process. Because the unobserved factor is assumed to be a stationary process, this unconditional distribution will exist and can be computed.

If you want to use exact diffuse initialization, you can use the initialize_diffuse method as follows:

model = DynamicFactor(
                      endog=y,
                      exog=X,
                      k_factors=1,
                      freq=y.index.inferred_freq,
                      factor_order=1,
                      error_order=0,
                      error_cov_type='diagonal'
                      )
model.ssm.initialize_diffuse()

with model.fix_params(dicts):
    res = model.fit(
                   disp=True,
                   method='nm',
                   maxiter=400000
                   )
$\endgroup$
2
  • $\begingroup$ Thank you for your answer! Not only are my results now correct, the model runs now take about 1000 times less iterations, which saves me a tremendous amount of time :) $\endgroup$
    – eork
    Jun 29, 2023 at 11:32
  • $\begingroup$ Dear @cfulton, could you please explain to me how exact diffuse initialization works? I have read the book by Durbin an Koopman, but I still don't see which values are chosen specifically for the initial selection matrix R and the initial variance of the disturbance vector eta? I previously thought that the variance of eta should be 1 for a dynamic factor to avoid identification problems, and that R should be a large number (e.g. 10e5). But I realized that this is the approach for approximate diffuse initialization. So could you please explain what happens during exact diffuse initialization? $\endgroup$
    – eork
    Jul 29, 2023 at 10:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.