MATLAB: Prediction confidence intervals using a state-space model

confidence intervalsforecastingstate-space modelSystem Identification Toolbox

Hello all,
Suppose one has estimated a state-space model using the following.
id = iddata(data',[],Ts);
sys = ssest(id, 2, 'Ts',id.Ts, 'DisturbanceModel','estimate');
Where data is a (output-only) time-series. Then, forecasting is as follows.
frc = forecast(sys, id, K);
My question is, how can one get the confidence intervals of the forecasted output, given that the system has uncertainties? The uncertainties of the model can be obtained with
[pvec, pvec_sd] = getpvec(sys) % parameter values and std deviations
An overview of the identified system is available with
present(sys)
Thank you in advance!

Best Answer

For discrete-time systems, the forecasting model is same as the simulation (original) model. So you can use commands such as SIM and SIMSD for uncertainty analysis.
For generating response uncertainty bounds by Gauss Approximation formula:
[frc,x0e] = forecast(sys, id, K);
zu = iddata([],zeros(K,0), id.ts, 'tstart',frc.tstart);
opt = simOptions('InitialCondition',x0e);
[y,ysd] = sim(sys, zu, opt);
t = y.SamplingInstants;
plot(t, y.y, t, y.y+ysd.y, 'r', t, y.y-ysd.y,'r')
For Monte-Carlo simulation of the estimated model:
opt = simsdOptions('InitialCondition',x0e);
simsd(sys, zu, 20, opt)