Description Usage Arguments Value Note Author(s) References See Also Examples
View source: R/loglikLOOCVcontourVAR1.r
Evaluates the leave-one-out cross-validated log-likelihood of the VAR(1) model for a given grid of the ridge penalty parameters (λ_a and λ_{ω}) for the autoregression coefficient matrix \mathbf{A} and the inverse error covariance matrix \mathbf{Ω}_{\varepsilon} (=\mathbf{Σ_{\varepsilon}^{-1}}), respectively). The result is plotted as a contour plot, which facilitates the choice of optimal penalty parameters. The function also works with a (possibly) unbalanced experimental set-up. The VAR(1)-process is assumed to have mean zero.
1 2 | loglikLOOCVcontourVAR1(lambdaAgrid, lambdaPgrid, Y, figure=TRUE,
verbose=TRUE, ...)
|
lambdaAgrid |
A |
lambdaPgrid |
A |
Y |
Three-dimensional |
figure |
A |
verbose |
A |
... |
Other arguments to be passed on (indirectly) to |
A list
-object with slots:
lambdaA |
A |
lambdaP |
A |
llLOOCV |
A |
Internally, this function calls the loglikLOOCVVAR1
-function, which evaluates the minus (!) LOOCV log-likelihood (for practical reasons). For interpretation purposes
loglikLOOCVcontourVAR1
provides the regular LOOCV log-likelihood (that is, without the minus).
Wessel N. van Wieringen <w.vanwieringen@vumc.nl>
Miok, V., Wilting, S.M., Van Wieringen, W.N. (2017), “Ridge estimation of the VAR(1) model and its time series chain graph from multivariate time-course omics data”, Biometrical Journal, 59(1), 172-191.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # 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
## Not run: lambdaAgrid <- seq(0.01, 1, length.out=20)
## Not run: lambdaPgrid <- seq(0.01, 1000, length.out=20)
## Not run: loglikLOOCVcontourVAR1(lambdaAgrid, lambdaPgrid, Y)
## determine optimal values of the penalty parameters
## Not run: optLambdas <- constrOptim(c(1,1), loglikLOOCVVAR1, gr=NULL,
## Not run: ui=diag(2), ci=c(0,0), Y=Y,
## Not run: control=list(reltol=0.01))$par
## add point of optimum
## Not run: points(optLambdas[1], optLambdas[2], pch=20, cex=2,
## Not run: col="red")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.