Estimate parameters of the state space model



I'm using Mathematica 9 and its Control Systems functionality.

I've searched the references extensively but seem not to be able to find any examples of state space model parameters estimation. All examples show models parametarized already or when they are given symbolic parameters they are not simulated.

So my question is whether there're built-in functions that would estimate state space model paramters (including covariance matrices for stochastic inputs and measurements)?

If there is none as of now may be you could give me some directions on implementing such procedures myself?

Example problem

Let me provide an example problem which I will borrow from (Zivot et. al, 2003):

Harvey (1985) and Clark (1987) provide an alternative to the BN decomposition of an I(1) time series with drift into permanent and transitory components based on unobserved components structural time series models. For example, Clark's model for the natural logarithm of postwar real GDP specifies the trend as a pure random walk, and the cycle as a stationary AR(2) process:



$c_t=\phi_1 c_{t-1}+\phi_2 c_{t-2}+w_t$

Now I want to try and estimate this example in Mathematica.

First I get the data:

gdp = Differences[Log[CountryData["Russia", {"GDP", {1999, 2013}}][[All,2]]]]

Then I setup a state-space model as follows:

eq = {y[t] == c[t] + τ[t], c[t + 1] == α c[t] + β c[t - 1], 
τ[t + 1] == μ + τ[t]}

StateSpaceModel[eq, {{y[t], 0}, {c[t], 0}, {τ[t], 0}},
{}, {y[t]}, t]

So what do I do next in order to estimate the parameters with data?

  1. Zivot, E., Wang, J., Koopman, S.J. (2004) State Space Modeling in Macroeconomics and Finance Using SsfPack for S+FinMetrics


Posted 2014-02-19T07:48:01.090

Reputation: 1 875

1I don't think there is single command to handle this in Mathematica. You have to use FindMinimum or FindFit command and define your own criteria to fit the data you have. The criteria should include the difference between your data and the model output by calculating the norm which you should minimize. – s.s.o – 2014-03-28T13:26:26.157

The function you want might be here. If that isn't what you want, go to the top of that page and look under "See Also".

– Ted Ersek – 2014-02-22T12:21:22.393



The literature on parameter estimation, or system identification, is vast, and there are many different approaches and techniques. Matlab has toolboxes that implement many algorithms, because many researchers in the field have adopted Matlab. For Mathematica, to the best of my knowledge, we don't have anything comparable. One would have to learn the literature, pick the most suitable methods, code them, and test. Perhaps you can find a few of the usual methods ready to use; but there is no guarantee that they will be the better ones for your problem. (Sorry, this is a non-answer, but it's the state of things as far as I know.)


Posted 2014-02-19T07:48:01.090

Reputation: 277

1thanks for your comment.. Hope this would change some time, until then MATLAB is a solution I use too.. – iav – 2016-01-27T14:33:41.397