- ETSResults.simulate(nsimulations, anchor=None, repetitions=1, random_errors=None, random_state=None)¶
Random simulations using the state space formulation.
The number of simulation steps.
First period for simulation. The simulation will be conditional on all existing datapoints prior to the anchor. Type depends on the index of the given endog in the model. Two special cases are the strings ‘start’ and ‘end’. start refers to beginning the simulation at the first period of the sample (i.e. using the initial values as simulation anchor), and end refers to beginning the simulation at the first period after the sample. Integer values can run from 0 to nobs, or can be negative to apply negative indexing. Finally, if a date/time index was provided to the model, then this argument can be a date string to parse or a datetime type. Default is ‘start’. Note: anchor corresponds to the observation right before the start observation in the predict method.
Number of simulated paths to generate. Default is 1 simulated path.
Specifies how the random errors should be obtained. Can be one of the following:
None: Random normally distributed values with variance estimated from the fit errors drawn from numpy’s standard RNG (can be seeded with the random_state argument). This is the default option.
A distribution function from
scipy.stats.norm: Fits the distribution function to the fit errors and draws from the fitted distribution. Note the difference between
scipy.stats.norm(), the latter one is a frozen distribution function.
A frozen distribution function from
scipy.stats.norm(scale=2): Draws from the frozen distribution function.
np.ndarraywith shape (nsimulations, repetitions): Uses the given values as random errors.
"bootstrap": Samples the random errors from the fit errors.
A seed for the random number generator or a
np.random.RandomStateobject. Only used if random_errors is
None. Default is
pd.DataFrameof simulated values. If the original data was a
pd.DataFrame, sim will be a
pd.Seriesif repetitions is 1, and a
pd.DataFrameof shape (nsimulations, repetitions) else. Otherwise, if repetitions is 1, a
np.ndarrayof shape (nsimulations,) is returned, and if repetitions is not 1 a
np.ndarrayof shape (nsimulations, repetitions) is returned.