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

Similar to other predict methods, this function returns
predictions from a fitted `"grpreg"`

object.

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

`object` |
Fitted |

`X` |
Matrix of values at which predictions are to be made. Not
used for |

`lambda` |
Values of the regularization parameter |

`which` |
Indices of the penalty parameter |

`type` |
Type of prediction: |

`drop` |
By default, if a single value of |

`...` |
Not used. |

`coef`

and `predict`

methods are provided for
`"cv.grpreg"`

options as a convenience. They simply call
`coef.grpreg`

and `predict.grpreg`

with `lambda`

set to
the value that minimizes the cross-validation error.

The object returned depends on type.

Patrick Breheny

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ```
# Fit penalized logistic regression model to birthweight data
data(Birthwt)
X <- Birthwt$X
y <- Birthwt$low
group <- Birthwt$group
fit <- grpreg(X, y, group, penalty="grLasso", family="binomial")
# Coef and predict methods
coef(fit, lambda=.001)
predict(fit, X, type="link", lambda=.07)[1:10]
predict(fit, X, type="response", lambda=.07)[1:10]
predict(fit, X, type="class", lambda=.01)[1:15]
predict(fit, type="vars", lambda=.07)
predict(fit, type="groups", lambda=.07)
predict(fit, type="norm", lambda=.07)
# Coef and predict methods for cross-validation
cvfit <- cv.grpreg(X, y, group, family="binomial", penalty="grMCP")
coef(cvfit)
predict(cvfit, X)[1:10]
predict(cvfit, X, type="response")[1:10]
predict(cvfit, type="groups")
``` |

grpreg documentation built on Sept. 27, 2018, 5:03 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.