fitted.glmnetcr: AIC, BIC, Predicted Class, and Fitted Probabilities of Class...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/fitted.glmnetcr.R

Description

For a given step, returns the AIC, BIC, predicted class, and the fitted probabilities for the K classes.

Usage

1
2
## S3 method for class 'glmnetcr'
fitted(object, newx = NULL, s, ...)

Arguments

object

a glmnetcr object

newx

a data matrix representing the predictor variables, if missing defaults to original data used in fitting the model

s

the step at which the fitted probabilities and class are desired

...

additional optional arguments

Value

AIC

AIC at step s

BIC

BIC at step s

class

a vector of length n indicating the predicted class for each observation in newx at step s

probs

a matrix with n rows and K columns indicating the fitted class probabilities for each observation and class in new at step x

Author(s)

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

See Also

See Also as predict.glmnetcr, select.glmnetcr

Examples

1
2
3
4
5
data(diabetes)
x <- diabetes[, 2:dim(diabetes)[2]]
y <- diabetes$y
glmnet.fit <- glmnetcr(x, y)
fitted(glmnet.fit, s = select.glmnetcr(glmnet.fit))

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 
$BIC
     s23 
33.76674 

$AIC
     s23 
29.05452 

$class
 [1] "control"                  "control"                 
 [3] "control"                  "control"                 
 [5] "control"                  "control"                 
 [7] "control"                  "control"                 
 [9] "impaired fasting glucose" "control"                 
[11] "impaired fasting glucose" "impaired fasting glucose"
[13] "impaired fasting glucose" "impaired fasting glucose"
[15] "impaired fasting glucose" "type 2 diabetes"         
[17] "type 2 diabetes"          "type 2 diabetes"         
[19] "type 2 diabetes"          "type 2 diabetes"         
[21] "type 2 diabetes"          "type 2 diabetes"         
[23] "type 2 diabetes"          "type 2 diabetes"         

$probs
          control impaired fasting glucose type 2 diabetes
 [1,] 0.637759660                0.2968232      0.06541710
 [2,] 0.742789960                0.2154169      0.04179319
 [3,] 0.684967374                0.2608598      0.05417284
 [4,] 0.823974148                0.1494688      0.02655706
 [5,] 0.678639532                0.2657438      0.05561666
 [6,] 0.724791677                0.2297116      0.04549669
 [7,] 0.711520081                0.2401679      0.04831200
 [8,] 0.721282138                0.2324838      0.04623405
 [9,] 0.184716536                0.5184572      0.29682629
[10,] 0.484526771                0.4040373      0.11143589
[11,] 0.133808976                0.5043899      0.36180108
[12,] 0.162057619                0.5146922      0.32325022
[13,] 0.106676146                0.4864906      0.40683329
[14,] 0.188845436                0.5187891      0.29236544
[15,] 0.208919007                0.5190637      0.27201725
[16,] 0.022632656                0.3065999      0.67076742
[17,] 0.024619264                0.3163697      0.65901106
[18,] 0.010433956                0.2251335      0.76443251
[19,] 0.008090478                0.2021177      0.78979178
[20,] 0.024136568                0.3140570      0.66180641
[21,] 0.007500334                0.1956351      0.79686456
[22,] 0.024556421                0.3160707      0.65937286
[23,] 0.012003293                0.2386296      0.74936710
[24,] 0.007139356                0.1915041      0.80135657

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