statsmodels.tsa.exponential_smoothing.ets.ETSResults.simulate¶
- ETSResults.simulate(nsimulations, anchor=None, repetitions=1, random_errors=None, random_state=None)[source]¶
Random simulations using the state space formulation.
- Parameters:¶
- nsimulations
int The number of simulation steps.
- anchor
int,str,ordatetime,optional 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.
- repetitions
int,optional Number of simulated paths to generate. Default is 1 simulated path.
- random_errors
optional 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, e.g.scipy.stats.norm: Fits the distribution function to the fit errors and draws from the fitted distribution. Note the difference betweenscipy.stats.normandscipy.stats.norm(), the latter one is a frozen distribution function.A frozen distribution function from
scipy.stats, e.g.scipy.stats.norm(scale=2): Draws from the frozen distribution function.A
np.ndarraywith shape (nsimulations, repetitions): Uses the given values as random errors."bootstrap": Samples the random errors from the fit errors.
- random_state
intornp.random.RandomState,optional A seed for the random number generator or a
np.random.RandomStateobject. Only used if random_errors isNone. Default isNone.
- nsimulations
- Returns:¶
- sim
pd.Series,pd.DataFrameornp.ndarray An
np.ndarray,pd.Series, orpd.DataFrameof simulated values. If the original data was apd.Seriesorpd.DataFrame, sim will be apd.Seriesif repetitions is 1, and apd.DataFrameof shape (nsimulations, repetitions) else. Otherwise, if repetitions is 1, anp.ndarrayof shape (nsimulations,) is returned, and if repetitions is not 1 anp.ndarrayof shape (nsimulations, repetitions) is returned.
- sim