ne.lambda.cv {GGMridge}R Documentation

Choose the Tuning Parameter of a Ridge Regression Using Cross-Validation

Description

Choose the tuning parameter of a ridge regression using cross-validation.

Usage

ne.lambda.cv(y, x, lambda, fold)

Arguments

y

Length n response vector.

x

n x p matrix for covariates with p variables and n sample size.

lambda

A numeric vector for candidate tuning parameters for a ridge regression.

fold

fold-cross validation used to choose the tuning parameter.

Value

A list containing

lambda

The selected tuning parameter, which minimizes the prediction error.

spe

The prediction error for all of the candidate lambda values.

Author(s)

Min Jin Ha

References

Ha, M. J. and Sun, W. (2014). Partial correlation matrix estimation using ridge penalty followed by thresholding and re-estimation. Biometrics, 70, 762–770.

Examples

 p <- 100 # number of variables
 n <- 50 # sample size
 
 ###############################
 # Simulate data
 ###############################
 simulation <- simulateData(G = p, etaA = 0.02, n = n, r = 1)
 data <- simulation$data[[1L]]
 stddat <- scale(x = data, center = TRUE, scale = TRUE)
 
 X <- stddat[,-1L,drop = FALSE]
 y <- stddat[,1L]
 
 fit.lambda <- ne.lambda.cv(y = y,
                            x = X,
                            lambda = seq(from = 0.01, to = 1,by = 0.1),
                            fold = 10L)  
 
 lambda <- fit.lambda$lambda[which.min(fit.lambda$spe)] 


[Package GGMridge version 1.4 Index]