I am currently developing a DLM of the following form

$$\underset{k \times 1} {y_t} = \underset{k \times n}A \underset{n \times 1}{\theta_t} + \epsilon_t$$ $$\theta_t = \mu + \underset{n \times n}B\theta_{t-1} + \eta_t$$

where $\epsilon_t$ and $\eta_t$ are uncorrelated normally distributed errors.

I know how to get filtered and smoothed estimates of the hidden parameters $(\theta_t)_t$ when matrices $A$ and $B$ are known. However, assume matrix $B$ has unknown parameters in it, how am I supposed to estimate them using MLE? Without knowing $B$, I cannot have any filtered or smoothed estimates of $(\theta_t)_t$ yet, so I cannot figure out how to use just the observed data $(y_t)_t$ to have an estimation of those parameters.


1 Answer 1


Given some set of parameter values $\boldsymbol{\beta}$ you can construct $B$ and run the Kalman filter. It turns out the Kalman filter can be used to recursively calculate the marginal likelihood (see this paper by Tusell). The general idea is to factorize the likelihood function into a product of conditional likelihoods, where we sequentially evaluate the likelihood of each observation given all previous observations.

In R you could write a function, taking parameter values $\boldsymbol{\beta}$ as inputs, which

  1. builds matrix $B$;
  2. runs the Kalman filter;
  3. calculates and returns the marginal log-likelihood using the formula in the paper.

You can then maximize this function using a general purpose non-linear optimization algorithm. Be warned that this type of likelihood can sometimes be very difficult to maximize.

You can probably do step 2 using an off-the-shelf implementation which will be less prone to numerical rounding errors than a transcription of the matrix formulas.


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.