rmixnorm_ts {gratis} | R Documentation |
Simulate autoregressive random variables from mixture of normal
Description
This function simulates random samples from a finite mixture of Gaussian distribution where the mean from each components are AR(p) process.
Usage
rmixnorm_ts(n, means.ar.par.list, sigmas.list, weights, yinit = 0)
Arguments
n |
number of samples. |
means.ar.par.list |
parameters in AR(p) within each mixing compoment. |
sigmas.list |
variance list. |
weights |
weight in each list. |
yinit |
initial values. |
Value
vector of length n follows a mixture distribution.
Author(s)
Feng Li, Central University of Finance and Economics.
References
Feng Li, Mattias Villani, and Robert Kohn. (2010). Flexible Modeling of Conditional Distributions using Smooth Mixtures of Asymmetric Student T Densities, Journal of Statistical Planning and Inference, 140(12), pp. 3638-3654.
Examples
n <- 1000
means.ar.par.list <- list(c(0, 0.8), c(0, 0.6, 0.3))
require("fGarch")
sigmas.spec <- list(
fGarch::garchSpec(model = list(alpha = c(0.05, 0.06)), cond.dist = "norm"),
fGarch::garchSpec(model = list(alpha = c(0.05, 0.05)), cond.dist = "norm")
)
sigmas.list <- lapply(
lapply(sigmas.spec, fGarch::garchSim, extended = TRUE, n = n),
function(x) x$sigma
)
weights <- c(0.8, 0.2)
y <- rmixnorm_ts(
n = n, means.ar.par.list = means.ar.par.list, sigmas.list = sigmas.list,
weights = weights
)
plot(y)
[Package gratis version 1.0.7 Index]