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
,or
datetime
,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.norm
andscipy.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.ndarray
with shape (nsimulations, repetitions): Uses the given values as random errors."bootstrap"
: Samples the random errors from the fit errors.
- random_state
int
ornp.random.RandomState
,optional
A seed for the random number generator or a
np.random.RandomState
object. Only used if random_errors isNone
. Default isNone
.
- nsimulations
- Returns:¶
- sim
pd.Series
,pd.DataFrame
ornp.ndarray
An
np.ndarray
,pd.Series
, orpd.DataFrame
of simulated values. If the original data was apd.Series
orpd.DataFrame
, sim will be apd.Series
if repetitions is 1, and apd.DataFrame
of shape (nsimulations, repetitions) else. Otherwise, if repetitions is 1, anp.ndarray
of shape (nsimulations,) is returned, and if repetitions is not 1 anp.ndarray
of shape (nsimulations, repetitions) is returned.
- sim