select.glmnetcr: Select Step of Optimal Fitted AIC or BIC CR Model

Description Usage Arguments Value Author(s) See Also Examples

View source: R/select.glmnetcr.R

Description

This function returns the step number associated with the minimum AIC or BIC models for a glmnet.cr object and so can be used in selecting the step number in calls in functions such as coef.glmnet.cr, nonzero.glmnet.cr, and fitted.glmnet.cr

Usage

1
select.glmnetcr(fit, which = "BIC")

Arguments

fit

a glmnetcr object

which

determines whether the step is associated with the optimal which="BIC" model or which="AIC" model

Value

A numeric value of length one representing the step number.

Author(s)

Kellie J. Archer, archer.43@osu.edu

See Also

See Also as coef.glmnetcr, nonzero.glmnetcr, fitted.glmnetcr

Examples

1
2
3
4
5
6
7
data(diabetes)
x <- diabetes[, 2:dim(diabetes)[2]]
y <- diabetes$y
glmnet.fit <- glmnetcr(x, y)
AIC <- select.glmnetcr(glmnet.fit, which = "AIC")
AIC
nonzero.glmnetcr(glmnet.fit, s = AIC)

Example output

Loading required package: glmnet
Loading required package: Matrix
Loading required package: foreach
Loaded glmnet 2.0-16

Warning message:
from glmnet Fortran code (error code -26); Convergence for 26th lambda value not reached after maxit=100 iterations; solutions for larger lambdas returned 
s23 
 24 
$a0
     s23 
3.192533 

$beta
 ILMN_1705116  ILMN_1759232           cp1           cp2 
 6.614969e-03 -2.035163e-02  1.894492e+00  2.153126e-15 

glmnetcr documentation built on July 8, 2020, 6:21 p.m.