Learn R Programming

ragt2ridges (version 0.3.4)

loglikLOOCVcontourVAR1fused: Contourplot of LOOCV log-likelihood of multiple VAR(1) models

Description

Evaluates the leave-one-out cross-validated log-likelihood of multiple jointly estimated VAR(1) models over a grid of the (fused) ridge penalty parameters (\(\lambda_a\) and \(\lambda_{f}\)) for the autoregression coefficient matrices \(\mathbf{A}_g\), while keeping \(\lambda_{\omega}\), the penalty parameter of the inverse error covariance matrix \(\mathbf{\Omega}_{\varepsilon} (=\mathbf{\Sigma_{\varepsilon}^{-1}})\), fixed at a user-specified value. 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)-processes are assumed to have mean zero.

Usage

loglikLOOCVcontourVAR1fused(lambdaAgrid, lambdaFgrid, Y, id, 
                            lambdaP, figure=TRUE, verbose=TRUE, ...)

Arguments

lambdaAgrid

A numeric of length larger than one, comprising positive numbers only. It contains the grid points corresponding to \(\lambda_a\), the ridge penalty parameter for the autoregression coefficient matrices \(\mathbf{A}_g\).

lambdaFgrid

A numeric of length larger than one, comprising positive numbers only. It contains the grid points corresponding to \(\lambda_{f}\), the fused ridge penalty parameter for the autoregression coefficient matrices \(\mathbf{A}_g\).

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.

id

A vector with group indices comprising of integers only. First group is represented by '0', the next by '1', and so on until the last.

lambdaP

A numeric specifying the value at which \(\lambda_{\omega}\) should be fixed.

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 (indirectly) to ridgeVAR1fused.

Value

A list-object with slots:

lambdaA

A numeric with the grid points corresponding to \(\lambda_a\) (the ridge penalty parameter for the autoregression coefficient matrices \(\mathbf{A}_g\)).

lambdaF

A numeric with the grid points corresponding to \(\lambda_{f}\) (the fused ridge penalty parameter for the autoregression coefficient matrices \(\mathbf{A}_g\).

llLOOCV

A 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. (2019), ``Ridge estimation of network models from time-course omics data'', Biometrical Journal, 61(2), 391-405.

See Also

loglikLOOCVcontourVAR1, loglikLOOCVcontourVARX1.

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)

## 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) 
# }
# NOT RUN {
## 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 
# }
# NOT RUN {
## add point of optimum
# }
# NOT RUN {
 points(optLambdas[1], optLambdas[2], pch=20, cex=2, 
# }
# NOT RUN {
 col="red") 
# }

Run the code above in your browser using DataLab