Learn R Programming

ragt2ridges (version 0.3.4)

evaluateVAR1fit: Visualize the fit of a VAR(1) model

Description

Simple plots for assessment of the fit of an estimated VAR(1) model.

Usage

evaluateVAR1fit(Y, A, SigmaE, unbalanced=NULL, diag=FALSE, 
                fileType="eps", dir=getwd())

Arguments

Y

Three-dimensional array containing the data. The first, second and third dimensions correspond to covariates, time and samples, respectively. The data are assumed to be centered covariate-wise.

A

A matrix \(\mathbf{A}\) of autoregression parameters.

SigmaE

Covariance matrix of the errors (innovations).

unbalanced

A matrix with two columns, indicating the unbalances in the design. Each row represents a missing design point in the (time x individual)-layout. The first and second column indicate the time and individual (respectively) specifics of the missing design point.

diag

A logical, should the diagonal be included in the evaluation of the fit.

fileType

A character specifying the format in which figures should be save. Either 'pdf' or 'eps'.

dir

A character specifying the directory where plots should be saved.

Value

Plots are saved in the specified directory.

See Also

evaluateSfit, ridgeVAR1, dataVAR1.

Examples

Run this code
# NOT RUN {
# set dimensions (p=covariates, n=individuals, T=time points)
p <- 3; n <- 4; T <- 10

# set model parameters
SigmaE <- diag(p)/4
A      <- createA(p, "chain")

# generate data
Y <- dataVAR1(n, T, A, SigmaE)

# center data
Y <- centerVAR1data(Y)

# fit VAR(1) model
VAR1hat <- ridgeVAR1(Y, 1, 1)

# evaluate fit VAR(1) model
# }
# NOT RUN {
 evaluateVAR1fit(Y, VAR1hat$A, symm(VAR1hat$P)) 
# }

Run the code above in your browser using DataLab