ne.lambda.cv: Choose the Tuning Parameter of a Ridge Regression Using...

Description Usage Arguments Value Author(s) References Examples

View source: R/ne.lambda.cv.R

Description

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

Usage

1
 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

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
  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)] 

Example output

Loading required package: mvtnorm
Loading required package: MASS

GGMridge was developed in support of IMPACT, a comprehensive research
program that aims to improve the health and longevity of people by
improving the clinical trial process. To learn more about our 
research and available software visit www.impact.unc.edu. 

GGMridge documentation built on May 2, 2019, 12:53 p.m.