Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

fsvsim

Simulate data from a factor SV model


Description

fsvsim generates simulated data from a factor SV model.

Usage

fsvsim(
  n = 1000,
  series = 10,
  factors = 1,
  facload = "dense",
  idipara,
  facpara,
  heteroskedastic = rep(TRUE, series + factors),
  df = Inf
)

Arguments

n

Length of the series to be generated.

series

Number of component series m.

factors

Number of factors r.

facload

Can either be a matrix of dimension m times r or one of the keywords "dense" and "sparse". If "dense" is chosen, a (rather) dense lower triangular factor loadings matrix is randomly generated. If "sparse" is chosen, a (rather) sparse lower triangular factor loadings matrix is randomly generated.

idipara

Optional matrix of idiosyncratic SV parameters to be used for simulation. Must have exactly three columns containing the values of mu, phi and sigma for each of m series, respectively. If omitted, plausible values are generated.

facpara

Optional matrix of idiosyncratic SV parameters to be used for simulation. Must have exactly two columns containing the values of phi and sigma for each of r factors, respectively. If omitted, plausible values are generated.

heteroskedastic

Logical vector of length m+r. When TRUE, time-varying volatilities are generated; when FALSE, constant volatilities (equal to mu) are generated.

df

If not equal to Inf, the factors are misspecified (come from a t distribution instead of a Gaussian). Only used for testing.

Value

The value returned is a list object of class fsvsim holding

  • yThe simulated data, stored in a n times m matrix with colnames 'Sim1', 'Sim2', etc.

  • facThe simulated factors, stored in a r times r matrix.

  • facloadFactor loadings matrix.

  • facvolLatent factor log-variances for times 1 to n.

  • facvol0Initial factor log-variances for time 0.

  • facparaThe parameters of the factor volatility processes.

  • idivolLatent idiosyncratic log-variances for times 1 to n.

  • idivol0Initial idiosyncratic log-variances for time 0.

  • idiparaThe parameters of the idiosyncratic volatility processes.

Note

This object can be passed to many plotting functions to indicate the data generating processes when visualizing results.


factorstochvol

Bayesian Estimation of (Sparse) Latent Factor Stochastic Volatility Models

v0.10.2
GPL (>= 2)
Authors
Gregor Kastner [aut, cre] (<https://orcid.org/0000-0002-8237-8271>), Darjus Hosszejni [ctb] (<https://orcid.org/0000-0002-3803-691X>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.