simTVP: Generate synthetic data from a time-varying parameter model

View source: R/simTVP.R

simTVPR Documentation

Generate synthetic data from a time-varying parameter model

Description

simTVP generates synthetic data from a time-varying parameter model. The covariates are always generated i.i.d. from a Normal(0,1) distribution.

Usage

simTVP(
  N = 200,
  d = 3,
  sv = FALSE,
  DTG = FALSE,
  sigma2 = 1,
  theta,
  beta_mean,
  sv_mu = 0,
  sv_phi = 0.98,
  sv_sigma2 = 0.2,
  a_psi = 0.5,
  c_psi = 2,
  rho = 0.9
)

Arguments

N

integer > 2. Indicates the length of the time series to be generated. The default value is 200.

d

positive integer. Indicates the number of covariates to simulate. The default value is 3.

sv

logical value. If set to TRUE, the data will be generated with stochastic volatility for the errors of the observation equation using svsim. The default value is FALSE.

DTG

logical value. If set to TRUE, the betas will be generated as dynamic triple gamma processes. The default value is FALSE.

sigma2

positive real number. Determines the variance of the errors of the observation equation. Ignored if sv is TRUE. The default value is 1.

theta

(optional) vector containing positive real numbers. If supplied, these determine the variances of the innovations of the state equation. Otherwise, the elements of theta are generated from a X^2(1) distribution. Has to be of length d or an error will be thrown.

beta_mean

(optional) vector containing real numbers. If supplied, these determine the mean of the initial value of the state equation. Otherwise, the elements of beta_mean are generated from a Normal(0,1) distribution. Has to be of length d or an error will be thrown.

sv_mu

real number. Determines the mean of the logarithm of the volatility. Ignored if sv is FALSE. The default value is 0.

sv_phi

real number between -1 and 1. Determines the persistence of the SV process. Ignored if sv is FALSE. The default value is 0.98.

sv_sigma2

positive, real number. Determines the variance of the innovations of the logarithm of the volatility. Ignored if sv is FALSE. The default value is 0.2.

a_psi

positive, real number. Determines the pole parameter of the dynamic triple gamma process. Ignored if DTG is FALSE. The default value is 0.5.

c_psi

positive, real number. Determines the tail parameter of the dynamic triple gamma process. Ignored if DTG is FALSE. The default value is 2.

rho

real number between 0 and 1. Determines the persistence of the dynamic triple gamma process. Ignored if DTG is FALSE. The default value is 0.9

Value

The value returned is a list object containing:

data

data frame that holds the simulated data.

true_vals

list object containing:

  • theta: the values of theta used in the data generating process.

  • beta_mean: the values of beta_mean used in the data generating process.

  • beta: the true paths of beta used for the data generating process.

  • sigma2: the value(s) of sigma2 used in the data generating process.

  • lambda_p: the true paths of lambda_p used for the data generating process. Not returned if DTG is FALSE.

  • lambda_p_0: the values of lambda_p_0 used for the data generating process. Not returned if DTG is FALSE.

  • kappa_p: the true paths of kappa_p used for the data generating process. Not returned if DTG is FALSE.

  • psi: the true paths of psi used for the data generating process. Not returned if DTG is FALSE.

Author(s)

Peter Knaus peter.knaus@wu.ac.at

Examples

# Generate a time series of length 300
res <- simTVP(N = 300)

# Extract the generated data
data <- res$data

# Now with stochastic volatility
res_sv <- simTVP(N = 300, sv = TRUE)

# Now with dynamic triple gamma process
res_DTG <- simTVP(N = 300, DTG = TRUE, c_psi = 1)


shrinkTVP documentation built on May 29, 2024, 7:24 a.m.

Related to simTVP in shrinkTVP...