cv.lambda: Perform cross-validation to select the best fit and finds the...

Description Usage Arguments Value Examples

View source: R/FunctionsALasso.R

Description

Perform cross-validation to select the best fit and finds the optimal lambda for a particular gamma value

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
cv.lambda(
  X,
  Y,
  tuning_seq = NULL,
  len_tuning = 60,
  gamma = 0.01,
  k = 5,
  id_fold = NULL,
  eps = 0.001
)

Arguments

X

n x p design matrix of inputs

Y

n x 1 vector of outputs

tuning_seq

(optional)sequence of tuning parameters

len_tuning

length of desired tuning parameter sequence

gamma

a scalar(>0) input used in the weight(user input)

k

number of folds for k-fold cross-validation, default is 5

id_fold

(optional) vector of length n specifying the folds assignment (from 1 to max(folds_ids)), if supplied the value of k is ignored

eps

precision level for convergence assessment, default 0.001

Value

tuning_seq

the actual sequence of tuning parameters used

beta_lamb

p x length(tuning_seq) matrix of corresponding solutions at each lambda value (original data without center or scale)

intercept_vec

Unscaled vector of intercepts for a fixed gamma and for different lambda values

id_fold

used splitting into folds from 1 to k (either as supplied or as generated in the beginning)

lambda_min

selected lambda based on minimal rule

cv

values of CV(lambda) for each lambda

Examples

1
2
3
X <- matrix(rnorm(500), 50, 10)
Y <- rnorm(50)
fit_cv <- cv.lambda(X, Y)

Saptati-Datta/AdapLasso documentation built on Dec. 18, 2021, 12:57 p.m.