Description Usage Arguments Details Value Author(s) References Examples
View source: R/dgp__rmixmorm.R
Simulating AR type random variables from mixture of normals
1 | rmixnorm.ts(n, means.ar.par.list, sigmas.list, weights, yinit = 0)
|
n |
a positive integer. Number of samples. |
means.ar.par.list |
parameters in AR(p) within each mixing component |
sigmas.list |
variance list |
weights |
weight in each list |
yinit |
initial values |
This function simulates random samples from a finite mixture of Gaussian distribution where the mean from each components are AR(p) process.
vector of n follows a mixture distribution
Feng Li, Central University of Finance and Economics.
Li 2010 JSPI
1 2 3 4 5 6 7 8 9 10 11 12 | n = 1000
means.ar.par.list = list(c(0, 0.8), c(0, 0.6, 0.3))
require("mvtnorm")
require("fGarch")
sigmas.spec <- list(garchSpec(model = list(alpha = c(0.05, 0.06)), cond.dist = "norm"),
garchSpec(model = list(alpha = c(0.05, 0.05)), cond.dist = "norm"))
sigmas.list <- lapply(lapply(sigmas.spec, 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, type = "l")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.