Skip to contents

Print the predict.cv.ptLasso object.

Usage

# S3 method for class 'predict.cv.ptLasso'
print(x, ...)

Arguments

x

output of predict called with a ptLasso object.

...

other arguments to pass to the print function.

See also

cv.ptLasso and predict.cv.ptLasso.

Author

Erin Craig and Rob Tibshirani
Maintainer: Erin Craig <erincr@stanford.edu>

Examples

# Train data
out = gaussian.example.data(k=2, class.sizes = c(50, 50))
x = out$x; y=out$y; groups = out$group;

# Test data
outtest = gaussian.example.data(k=2, class.sizes = c(50, 50))
xtest=outtest$x; ytest=outtest$y; groupstest=outtest$groups

cvfit = cv.ptLasso(x, y, groups = groups, nfolds = 3, family = "gaussian", type.measure = "mse")
pred = predict(cvfit, xtest, groupstest, ytest=ytest, s="lambda.min")
print(pred)
#> 
#> Call:  
#> predict.cv.ptLasso(object = cvfit, xtest = xtest, groupstest = groupstest,  
#>     ytest = ytest, s = "lambda.min") 
#> 
#> 
#> alpha =  0.8 
#> 
#> Performance (Mean squared error):
#> 
#>            allGroups  mean group_1 group_2     r^2
#> Overall        540.5 540.5   528.3   552.8 0.17213
#> Pretrain       579.7 579.7   568.4   590.9 0.11219
#> Individual     598.8 598.8   578.3   619.3 0.08281
#> 
#> Support size:
#>                                         
#> Overall    23                           
#> Pretrain   11 (0 common + 11 individual)
#> Individual 9                            

# If ytest is not supplied, just prints the pretrained predictions.
pred = predict(cvfit, xtest, groupstest, s="lambda.min")
print(pred)
#> 
#> Call:  
#> predict.cv.ptLasso(object = cvfit, xtest = xtest, groupstest = groupstest,  
#>     s = "lambda.min") 
#> 
#> 
#> alpha =  0.8 
#> 
#> Support size:
#>                                         
#> Overall    23                           
#> Pretrain   11 (0 common + 11 individual)
#> Individual 9