Description Usage Arguments Value Examples
This function simulates VAR(p) series. For quick use, the function can use the estimated
model returned by VARfit
or VAR
as
the DGP (Data Generating Process), if passed to the fittedModel
argument.
1 2 |
N |
The length of the series. |
K |
The number of series/equations. |
p |
The lag length of the VAR(p). |
const |
if |
trend |
if |
exogen |
a matrix of exogenous variables. Should either have |
coef |
a matrix of coefficients.
E.g. a 2 dimensional VAR(2) with a constant, a trend and one exogenous variable must be entered in the following order (the same as returned by
|
dist |
the distribution of the error terms (currently only |
Ystart |
a |
errors |
(optional) a matrix of error terms. If supplied, |
fittedModel |
(optional) either an object of class |
an N
x K
matrix of the simulated VAR(p
).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Simulates from a fitted DGP:
fit <- VARfit(y = VodafoneCDS, p = 1, const = TRUE)
y <- VARsim(fittedModel = fit)
VARfit(y = y, p = 1, const = TRUE)
# Simulates from user given parameters.
# Includes an exogenous variable:
VARcoef <- matrix(c(1, 2,
1, 0.5,
0.1, 0.3,
0.2, 0.5),
ncol = 2, byrow = TRUE)
exo <- matrix(rnorm(500))
y <- VARsim(N = 500, K = 2, p = 1, const = TRUE,
trend = FALSE, exogen = exo,
coef = VARcoef, dist = "normal")
VARfit(y = y, p = 1, const = TRUE, exogen = exo)
## Not run:
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.