VAR.sim | R Documentation |
Allow to either simulate from scratch (by providing coefficients) or bootstrap from an estimated VAR model,
VAR.sim(
B,
n = 200,
lag = 1,
include = c("const", "trend", "none", "both"),
starting = NULL,
innov = rmnorm(n, varcov = varcov),
varcov = diag(1, nrow(B)),
show.parMat = FALSE,
returnStarting = FALSE,
...
)
VAR.boot(
VARobject,
boot.scheme = c("resample", "wild1", "wild2", "check"),
seed,
...
)
B |
Matrix of coefficients. |
n |
Number of observations to simulate |
lag |
Number of lags of the VAR to simulate |
include |
Type of deterministic regressors to include in the VAR to simulate |
starting |
Starting values (matrix of dimension lag x k) for the VAR to simulate. If not given, set to zero. |
innov |
Innovations used for in the VAR to simulate. Should be matrix of dim n x k. By default multivariate normal. |
varcov |
Variance-covariance matrix for the innovations. By default identity matrix. |
show.parMat |
Logical. Should the parameter matrix be shown? Useful to understand how to give right input |
returnStarting |
Whether starting values are returned. Default to FALSE |
... |
Further arguments passed to the underlying (un-exported)
|
VARobject |
Object of class |
boot.scheme |
The bootstrap scheme. See details. |
seed |
Optional. Seed for the random resampling function. |
For the bootstrap, the function resamples data from a given VAR model generated by
lineVar
, returning the resampled data.
A residual recursive bootstrap is used, where one uses either a simple
resampling, or the Wild bootstrap, either with a normal distribution (wild1) or
inverting the sign randomly (wild2)
A matrix with the resampled series.
Matthieu Stigler
lineVar
to estimate the VAR. Similar TVECM.sim
and TVECM.boot
for TVECM
,
TVAR.sim
and TVAR.boot
for TVAR
models.
## VAR.sim: simulate VAR as in Enders 2004, p 268
B1<-matrix(c(0.7, 0.2, 0.2, 0.7), 2)
var1 <- VAR.sim(B=B1, n=100, include="none")
ts.plot(var1, type="l", col=c(1,2))
B2<-rbind(c(0.5, 0.5, 0.5), c(0, 0.5, 0.5))
varcov<-matrix(c(1,0.2, 0.3, 1),2)
var2 <- VAR.sim(B=B2, n=100, include="const", varcov=varcov)
ts.plot(var2, type="l", col=c(1,2))
## VAR.boot: Bootstrap a VAR
data(zeroyld)
mod <- lineVar(data=zeroyld,lag=1)
VAR.boot(mod)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.