sim.ves {legion} | R Documentation |
Simulate Vector Exponential Smoothing
Description
Function generates data using VES model as a data generating process.
Usage
sim.ves(model = "ANN", obs = 10, nsim = 1, nvariate = 2,
frequency = 1, persistence = NULL, phi = 1, transition = NULL,
initial = NULL, initialSeason = NULL,
seasonal = c("individual, common"), weights = rep(1/nvariate, nvariate),
bounds = c("usual", "admissible", "restricted"), randomizer = c("rnorm",
"rt", "rlaplace", "rs"), ...)
Arguments
model |
Type of ETS model. This can consist of 3 or 4 chars:
|
obs |
Number of observations in each generated time series. |
nsim |
Number of series to generate (number of simulations to do). |
nvariate |
Number of series in each generated group of series. |
frequency |
Frequency of generated data. In cases of seasonal models must be greater than 1. |
persistence |
Matrix of smoothing parameters for all the components of all the generated time series. |
phi |
Value of damping parameter. If trend is not chosen in the model, the parameter is ignored. If vector is provided, then several parameters are used for different series. |
transition |
Transition matrix. This should have the size appropriate
to the selected model and |
initial |
Vector of initial states of level and trend. The minimum
length is one (in case of ETS(A,N,N), the initial is used for all the
series), the maximum length is 2 x nvariate. If |
initialSeason |
Vector or matrix of initial states for seasonal
coefficients. Should have number of rows equal to |
seasonal |
The type of seasonal component across the series. Can be
|
weights |
The weights for the errors between the series with the common
seasonal component. Ignored if |
bounds |
Type of bounds to use for persistence vector if values are
generated. |
randomizer |
Type of random number generator function used for error
term. Defaults are: |
... |
Additional parameters passed to the chosen randomizer. All the
parameters should be passed in the order they are used in chosen randomizer.
For example, passing just |
Value
List of the following values is returned:
-
model
- Name of ETS model. -
data
- The matrix (or an array ifnsim>1
) of the generated series. -
states
- The matrix (or array ifnsim>1
) of states. States are in columns, time is in rows. -
persistence
- The matrix (or array ifnsim>1
) of smoothing parameters used in the simulation. -
transition
- The transition matrix (or array ifnsim>1
). -
initial
- Vector (or matrix) of initial values. -
initialSeason
- Vector (or matrix) of initial seasonal coefficients. -
residuals
- Error terms used in the simulation. Either matrix or array, depending onnsim
.
Author(s)
Ivan Svetunkov, ivan@svetunkov.ru
References
de Silva A., Hyndman R.J. and Snyder, R.D. (2010). The vector innovations structural time series framework: a simple approach to multivariate forecasting. Statistical Modelling, 10 (4), pp.353-374
Hyndman, R.J., Koehler, A.B., Ord, J.K., and Snyder, R.D. (2008) Forecasting with exponential smoothing: the state space approach, Springer-Verlag.
Lütkepohl, H. (2005). New Introduction to Multiple Time Series Analysis. New introduction to Multiple Time Series Analysis. Berlin, Heidelberg: Springer Berlin Heidelberg. doi:10.1007/978-3-540-27752-1
Chen H., Svetunkov I., Boylan J. (2021). A New Taxonomy for Vector Exponential Smoothing and Its Application to Seasonal Time Series.
See Also
Examples
# Create 40 observations of quarterly data using AAA model with errors
# from normal distribution
VESAAA <- sim.ves(model="AAA",frequency=4,obs=40,nvariate=3,
randomizer="rnorm",mean=0,sd=100)
# You can also use mvrnorm function from MASS package as randomizer,
# but you need to provide mu and Sigma explicitly
## Not run: VESANN <- sim.ves(model="ANN",frequency=4,obs=40,nvariate=2,
randomizer="mvrnorm",mu=c(100,50),sigma=matrix(c(40,20,20,30),2,2))
## End(Not run)
# When generating the data with multiplicative model a more diligent definitiion
# of parameters is needed. Here's an example with MMM model:
VESMMM <- sim.ves("AAA", obs=120, nvariate=2, frequency=12, initial=c(10,0),
initialSeason=runif(12,-1,1), persistence=c(0.06,0.05,0.2), mean=0, sd=0.03)
VESMMM$data <- exp(VESMMM$data)
# Note that smoothing parameters should be low and the standard diviation should
# definitely be less than 0.1. Otherwise you might face the explosions.