Description Usage Arguments Details Value See Also Examples
This function simulates data from a structural time series model 
defined in an object of class stsm.
| 1 2 | datagen.stsm(n, model = list(), SigmaEV, labels, n0 = 20, freq = 1, 
  old.version = FALSE)
 | 
| n | number of observations in the output time series. | 
| model | a list containing the matrices of the state space for of the structural model. | 
| SigmaEV | a list containing the elements  | 
| labels | optional vector of characters giving the names of the unobserved components in the model. | 
| n0 | number of warming-up observations (they are not included in the output data). | 
| freq | number of observations per unit of time, e.g.  | 
| old.version | logical. If  | 
The matrices in the argument model must follow the conventions of an object
of class stsm as returned by
char2numeric.
For compatibility with previous versions of the package, 
old.version = TRUE generates random values from the multivariate normal distribution
using the function rmvnorm with pre0.9_9994 = TRUE.
mvrnorm.version = FALSE uses the theoretical expression that is commonly 
used to define random draws for the multivariate normal distribution.
A list containing the output time series and the underlying components of the model.
| 1 2 3 4 5 6 7 8 9 10 11 12 | # generate a quarterly series from a local level plus seasonal model
# the data set 'llmseas' is generated as follows (first series)
pars <- c(var1 = 300, var2 = 10, var3 = 100)
m <- stsm.model(model = "llm+seas", y = ts(seq(120), frequency = 4), 
  pars = pars, nopars = NULL)
ss <- char2numeric(m)
set.seed(123)
y <- datagen.stsm(n = 120, model = list(Z = ss$Z, T = ss$T, H = ss$H, Q = ss$Q), 
  n0 = 20, freq = 4, old.version = TRUE)$data
data("llmseas")
all.equal(y, llmseas)
 | 
[1] TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.