predict.grpregOverlap: Model predictions based on a fitted object

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

Description

Similar to other predict methods, this function returns predictions from a fitted "grpregOverlap" object.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## S3 method for class 'grpregOverlap'
predict(object, X, type = c("link", "response", "class", 
    "coefficients", "vars", "groups", "nvars", "ngroups", "norm"), latent = FALSE, 
    lambda, which = 1:length(object$lambda), ...)
    
## S3 method for class 'cv.grpregOverlap'
predict(object, X, type = c("link", "response", "class", 
    "coefficients", "vars", "groups", "nvars", "ngroups", "norm"), latent = FALSE, 
    lambda = object$lambda.min, which=object$min, ...)
    
## S3 method for class 'grpregOverlap'
coef(object, lambda, latent = FALSE, which=1:length(object$lambda), drop=TRUE, ...)
    
## S3 method for class 'cv.grpregOverlap'
coef(object, latent = FALSE, lambda = object$lambda.min, which = object$min, ...)

Arguments

object

A fitted "grpregOverlap" or "cv.grpregOverlap" model object.

X

Matrix of values at which predictions are to be made. Not used for type="coefficients".

type

Type of prediction: "link" returns the linear predictors; "response" gives the fitted values; "class" returns the binomial outcome with the highest probability; "coefficients" returns the coefficients; "vars" returns the indices for the nonzero coefficients; "groups" returns the indices for the groups with at least one nonzero coefficient; "nvars" returns the number of nonzero coefficients; "ngroups" returns the number of groups with at least one nonzero coefficient; "norm" returns the L2 norm of the coefficients in each group.

latent

Should return prediction values at the latent level? Default is FALSE. The option latent = TRUE is meaningful only if type is "coefficients", "vars", "nvars", or "norm" since there are no latent information for other types. Otherwise, a note message will be printed; If type = "norm", this argument is overwritten to be 'TRUE' since the L2 norms are from latent coefficients.

lambda

Values of the regularization parameter lambda at which predictions are requested. For values of lambda not in the sequence of fitted models, linear interpolation is used.

which

Indices of the penalty parameter lambda at which predictions are required. By default, all indices are returned. If lambda is specified, this will override which.

drop

Drop the matrix to be a vector.

...

Not used.

Details

coef and predict methods are provided for "cv.grpregOverlap" options as a convenience. They simply call coef.grpregOverlap and predict.grpregOverlap with lambda set to the value that minimizes the cross-validation error.

Value

The object returned depends on the specification on type and latent.

Author(s)

Yaohui Zeng and Patrick Breheny

Maintainer: Yaohui Zeng <yaohui-zeng@uiowa.edu>

See Also

grpregOverlap

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
data(pathway.dat)
X <- pathway.dat$expression
group <- pathway.dat$pathways
y <- pathway.dat$mutation
fit <- grpregOverlap(X, y, group, penalty = 'grLasso', family = 'binomial')
head(predict(fit, type = 'ngroups', lambda = 0.01))
head(predict(fit, type = 'nvars', lambda = 0.01))
head(predict(fit, type = 'vars', latent = TRUE, lambda = 0.01))
head(predict(fit, type = 'groups', latent = TRUE, lambda = 0.01)) # A note printed.
head(predict(fit, X, type="class", lambda=.01))
head(predict(fit, X, type = "coefficients", lambda = 0.01))
head(predict(fit, type="norm", lambda=.01))

## Not run: 
cvfit <- cv.grpregOverlap(X, y, group, penalty = 'grLasso', family = 'binomial')
head(coef(cvfit))
predict(cvfit, X, type='response')
predict(cvfit, X, type = 'link')
predict(cvfit, X, type = 'class')

## End(Not run)

grpregOverlap documentation built on May 2, 2019, 4:47 a.m.