arch.univariate.ConstantMean.simulate¶
-
ConstantMean.simulate(params: ndarray | Series | Sequence[float], nobs: int, burn: int =
500
, initial_value: float | ndarray[Any, dtype[float64]] | None =None
, x: ndarray | DataFrame | Series | None =None
, initial_value_vol: float | ndarray[Any, dtype[float64]] | None =None
) DataFrame [source]¶ Simulated data from a constant mean model
- Parameters:¶
- params: ndarray | Series | Sequence[float]¶
Parameters to use when simulating the model. Parameter order is [mean volatility distribution]. There is one parameter in the mean model, mu.
- nobs: int¶
Length of series to simulate
- burn: int =
500
¶ Number of values to simulate to initialize the model and remove dependence on initial values.
- initial_value: float | ndarray[Any, dtype[float64]] | None =
None
¶ This value is not used.
- x: ndarray | DataFrame | Series | None =
None
¶ This value is not used.
- initial_value_vol: float | ndarray[Any, dtype[float64]] | None =
None
¶ An array or scalar to use when initializing the volatility process.
- Returns:¶
simulated_data – DataFrame with columns data containing the simulated values, volatility, containing the conditional volatility and errors containing the errors used in the simulation
- Return type:¶
Examples
Basic data simulation with a constant mean and volatility
>>> import numpy as np >>> from arch.univariate import ConstantMean, GARCH >>> cm = ConstantMean() >>> cm.volatility = GARCH() >>> cm_params = np.array([1]) >>> garch_params = np.array([0.01, 0.07, 0.92]) >>> params = np.concatenate((cm_params, garch_params)) >>> sim_data = cm.simulate(params, 1000)