optim.lambda: select optimal tuning parameter lambda for lasso based on BIC...

Description Usage Arguments Details Value Examples

View source: R/Lasso-function.R

Description

This function will fit the glmlasso with a sequence value of tuning parameter lambdas and return a plot of BIC vs lambda and the optimal lambda with the smallest BIC.

Usage

1
optim.lambda(Xz, yz, lambda.min, lambda.max, len, plot = FALSE)

Arguments

Xz

the design matrix for glmlasso

yz

a vector of binary outcomes

lambda.min

the smallest lambda

lambda.max

the largest lambda

len

the number of lambdas for fitting

plot

logic variable, indicating if the lambda versus BIC plot should be returned

Details

This function will need glmlasso function.

Value

a plot of BIC vs lambda and the optimal lambda with the smallest BIC

Examples

1
2
3
4
5
set.seed(8675309)
Xz = scale(matrix(rnorm(5000), ncol=10))
bz = c(.5, -.5, .25, -.25, .125, -.125, rep(0, 4))
yz = rbinom(Nz,1,exp(Xz %*% bz)/(1+exp(Xz %*% bz)))
optim.lambda(Xz,yz,lambda.min = 0,lambda.max = 0.1,len = 200)

lcw68/G3proj documentation built on Dec. 21, 2021, 9:46 a.m.