Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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
share|improve this question
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 Feb 22 '14 at 12:21
I 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 Mar 28 '14 at 13:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.