simulate: Simulate a Time Series Factor Model

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Simulate a TSFmodel to generate time series data (indicators) using factors and loadings from the model.

Usage

1
2
3
    ## S3 method for class 'TSFmodel'
simulate(model, f=factors(model), Cov=model$Omega,
       sd=NULL, noise=NULL, rng=NULL, noise.model=NULL, ...)

Arguments

model

A TSFmodel.

f

Factors to use with the model.

Cov

covariance of the idiosyncratic term.

sd

see makeTSnoise.

noise

see makeTSnoise.

rng

see makeTSnoise.

noise.model

see makeTSnoise.

...

arguments passed to other methods.

Details

simulate.TSFmodel generates artifical data (indicators or measures) with a given TSFmodel (which has factors and loadings). The obj should be a TSFmodel. This might be a model constructed with TSFmodel or as returned by estTSF.ML.

The number of factor series is determined by the number of columns in the time series matrix f (the factors in the model object). This must also be the number of columns in the loadings matrix B (in the model object). The number of rows in the loadings matrix determines the number of indicator series generated (the number of columns in the matrix result). The number of rows in the time series factor matrix determines the number of time observations (periods) in the indicator series generated, that is, the number of rows in the matrix result.

simulate passes Cov, sd, noise, rng, and noise.model to makeTSnoise to generate the random idiosyncratic term eps(t), which will have the same dimension as the generated indicator series that are returned. eps(t) will have random distribution determined by other arguments passed to makeTSnoise. Note that the covariance of the generated indicator series y(t) is also influenced by the covariance of the factors f.

The calculation to give the generated artificial time series indicator data matrix y is

y(t) = B f(t) + eps(t).

simulate.TSFmodel can use a TSFmodel that has only B and f specified, but in this case one of Cov, sd, noise, or noise.model must be specified as the default Omega from the model is not available.

Value

A time series matrix.

Author(s)

Paul Gilbert

See Also

TSFmodel, estTSF.ML, simulate, tfplot.TSFmodel, explained.TSFmodel

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
  f <- matrix(c(2+sin(pi/100:1),5+3*sin(2*pi/5*(100:1))),100,2)
  B <- t(matrix(c(0.9, 0.1,
		  0.8, 0.2,
		  0.7, 0.3,
                  0.5, 0.5, 
		  0.3, 0.7,
 		  0.1, 0.9), 2,6))

  z <- simulate(TSFmodel(B, f=f), sd=0.01)
  tfplot(z)

Example output

Loading required package: GPArotation
Loading required package: dse
Loading required package: tfplot
Loading required package: tframe

Attaching package: 'dse'

The following objects are masked from 'package:stats':

    acf, simulate

Loading required package: EvalEst

tsfa documentation built on Jan. 13, 2021, 10:53 a.m.