predictSGL: Outputs Predicted Responses from an SGL Model for New...

Description Usage Arguments Details Author(s) References See Also Examples

View source: R/predictSGL.R

Description

Outputs predicted response values for new user input observations at a specified lambda value

Usage

1
predictSGL(x, newX, lam)

Arguments

x

fitted "SGL" object

newX

covariate matrix for new observations whose responses we wish to predict

lam

the index of the lambda value for the model with which we desire to predict

Details

Predicted outcomes are given

Author(s)

Noah Simon, Jerome Friedman, Trevor Hastie, and Rob Tibshirani
Maintainer: Noah Simon <nrsimon@uw.edu>

References

Simon, N., Friedman, J., Hastie T., and Tibshirani, R. (2011) A Sparse-Group Lasso,
http://faculty.washington.edu/nrsimon/SGLpaper.pdf

See Also

SGL and cvSGL.

Examples

1
2
3
4
5
6
7
8
9
n = 50; p = 100; size.groups = 10
index <- ceiling(1:p / size.groups)
X = matrix(rnorm(n * p), ncol = p, nrow = n)
beta = (-2:2)
y = X[,1:5] %*% beta + 0.1*rnorm(n)
data = list(x = X, y = y)
Fit = SGL(data, index, type = "linear")
X.new = matrix(rnorm(n * p), ncol = p, nrow = n)
predictSGL(Fit, X.new, 5)

Example output

              [,1]
 [1,]  1.571113175
 [2,]  0.396861268
 [3,] -0.550406961
 [4,] -0.934004112
 [5,] -0.361061100
 [6,]  0.143259938
 [7,]  0.946538630
 [8,]  0.333117808
 [9,]  0.140766844
[10,] -1.198808012
[11,] -0.601096979
[12,] -1.359269664
[13,]  0.109621210
[14,] -0.669150639
[15,] -1.592105436
[16,] -1.243260498
[17,] -0.392497383
[18,] -0.308278763
[19,] -1.603408158
[20,]  0.068144965
[21,]  0.355428893
[22,] -0.445159381
[23,] -1.717634199
[24,] -0.247810698
[25,] -0.003296874
[26,] -0.912611758
[27,]  0.615287378
[28,] -1.567959436
[29,] -0.399492720
[30,] -1.395916446
[31,] -2.516359023
[32,] -1.061197532
[33,] -2.160488589
[34,] -1.076110802
[35,] -1.085599167
[36,] -1.710408400
[37,] -0.653489223
[38,]  0.568259139
[39,]  0.153331595
[40,]  0.243242745
[41,] -0.806968492
[42,] -0.382104972
[43,] -0.305069368
[44,]  0.045994599
[45,]  0.699612475
[46,] -0.512533319
[47,] -0.611067421
[48,] -1.063862540
[49,] -1.418699248
[50,]  0.864976503

SGL documentation built on Sept. 28, 2019, 1:03 a.m.