User`s guide

9 Simulation and Prediction
When you simulate a multiexperiment model, use the pe command to estim ate
initial states for the data from that specic experiment. For example, suppose
you e stimate a three-state m odel
M using a merged data set Z, which contains
data from ve experiments—
z1, z2, z3 , z4,andz5:
Z = merge(z1,z2,z3,z4,z5);
M = n4sid(Z,3);
If you want to simulate u sing data from z2, you must estimate the initial
states for the second experiment
Z(z2.u),asfollows:
X0est = findstates(M,getexp(Z,2))
where getexp(Z,2) gets the d ata in z2. The estimated states matrix Sest
contains one column of initial-state values for each experiment.
To simulate with these initial states, specify the estimated initial states
X0est
as an argument in sim . For example:
y=sim(M,getexp(Z,2),'InitialState',X0 est)
How to Estimate States for Prediction
Prediction using data from a different experiment than the data used to
estimate the m odel requires the correspon d in g initial states.
Unlike for
sim, you can specify to estimate the initial states directly in the
predict command.
To estimate the initial states that correspond to the data set you use for
prediction, use the following syntax:
y=predict(M,data,'InitialState','Esti mate')
9-10