Learn R Programming

GGMridge (version 1.4)

lambda.cv: Choose the Tuning Parameter of the Ridge Inverse

Description

Choose the tuning parameter of the ridge inverse by minimizing cross validation estimates of the total prediction errors of the p separate ridge regressions.

Usage

lambda.cv(x, lambda, fold)

Value

A list containing

lambda

The selected tuning parameter, which minimizes the total prediction errors.

spe

The total prediction error for all the candidate lambda values.

Arguments

x

An n by p data matrix.

lambda

A numeric vector of candidate tuning parameters.

fold

fold-cross validation is performed.

Author

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

Run this code
 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]]
 stddata <- scale(x = data, center = TRUE, scale = TRUE)
 
 ###############################
 # estimate ridge parameter
 ###############################
 lambda.array <- seq(from = 0.1, to = 20, by = 0.1) * (n - 1.0)
 fit <- lambda.cv(x = stddata, lambda = lambda.array, fold = 10L)
 lambda <- fit$lambda[which.min(fit$spe)] / (n - 1.0)
 
 ###############################
 # calculate partial correlation 
 # using ridge inverse
 ###############################
 partial <- solve(lambda*diag(p) + cor(data))
 partial <- -scaledMat(x = partial)

Run the code above in your browser using DataLab