Learn R Programming

ragt2ridges (version 0.1.9)

loglikLOOCVcontourVAR1: Contourplot of LOOCV log-likelihood of VAR(1) model

Description

Evaluates the leave-one-out cross-validated log-likelihood of the VAR(1) model for a given grid of the ridge penalty parameters ($\lambda_a$ and $\lambda_{\omega}$ for the regression coefficient matrix $\mathbf{A}$ and the inverse error covariance matrix $\mathbf{\Omega}_{\varepsilon} (=\mathbf{\Sigma_{\varepsilon}^{-1}})$, respectively). The result is plotted as a contour plot, which facilitates the choice of optimal penalty parameters. The functions also works with a (possibly) unbalanced experimental set-up. The VAR(1)-process is assumed to have mean zero.

Usage

loglikLOOCVcontourVAR1(lambdaAgrid, lambdaPgrid, Y, figure=TRUE, 
verbose=TRUE, ...)

Arguments

lambdaAgrid
A numeric of length larger than one, comprising positive numbers only. It contains the grid points corresponding to the $\lambda_a$ (the penalty parameter for the regression coefficient matrix $\mathbf{A}$).
lambdaPgrid
A numeric of length larger than one, comprising positive numbers only. It contains the grid points corresponding to the $\lambda_{\omega}$ (the penalty parameters for the inverse error covariance matrix $\mathbf{\Omega}_{\varepsilon} (=\mathb
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 centered covariate-wise.
figure
A logical, indicating whether the contour plot should be generated.
verbose
A logical indicator: should intermediate output be printed on the screen?
...
Other arguments to be passed on to loglikLOOCVVAR1.

Value

  • A list-object with slots:
  • lambdaAGrid points corresponding to $\lambda_a$ (the penalty parameter for the regression coefficient matrix $\mathbf{A}$).
  • lambdaPGrid points corresponding to $\lambda_{\omega}$ (the penalty parameter for the inverse error covariance matrix $\mathbf{\Omega}_{\varepsilon} (=\mathbf{\Sigma_{\varepsilon}^{-1}})$).
  • llLOOCVA matrix of leave-one-out cross-validated log-likelihoods. Rows and columns correspond to $\lambda_a$ and $\lambda_{\omega}$ values, respectively.

References

Miok, V., Wilting, S.M., Van Wieringen, W.N. (2015), "Ridge estimation of the VAR(1) model and its time series chain graph from multivariate time-course omics data", submitted.

See Also

loglikLOOCVVAR1.

Examples

Run this code
# 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)

## plot contour of cross-validated likelihood
lambdaAgrid <- seq(0.01, 1, length.out=20)
lambdaPgrid <- seq(0.01, 1000, length.out=20)
loglikLOOCVcontourVAR1(lambdaAgrid, lambdaPgrid, Y)

## determine optimal values of the penalty parameters
optLambdas <- constrOptim(c(1,1), loglikLOOCVVAR1, gr=NULL,
ui=diag(2), ci=c(0,0), Y=Y,
control=list(reltol=0.01))$par

## add point of optimum
points(optLambdas[1], optLambdas[2], pch=20, cex=2,
col="red")

Run the code above in your browser using DataLab