Learn R Programming

mpath (version 0.1-20)

predict.glmreg: Model predictions based on a fitted "glmreg" object.

Description

This function returns predictions from a fitted "glmreg" object.

Usage

## S3 method for class 'glmreg':
predict(object,newx,which=1:length(object$lambda),
type=c("link","response","class","coefficients","nonzero"), na.action=na.pass, ...)
## S3 method for class 'glmreg':
coef(object,which=1:length(object$lambda),...)

Arguments

object
Fitted "glmreg" model object.
newx
Matrix of values at which predictions are to be made. Not used for type="coefficients"
which
Indices of the penalty parameter lambda at which predictions are required. By default, all indices are returned.
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 coe
na.action
action for missing data value
...
arguments for predict

Value

  • The returned object depends on type.

References

Zhu Wang, Shuangge Ma, Michael Zappitelli, Chirag Parikh, Ching-Yun Wang and Prasad Devarajan (2014) Penalized Count Data Regression with Application to Hospital Stay after Pediatric Cardiac Surgery, Statistical Methods in Medical Research. 2014 Apr 17. [Epub ahead of print]

See Also

glmreg

Examples

Run this code
## Dobson (1990) Page 93: Randomized Controlled Trial :
counts <- c(18,17,15,20,10,20,25,13,12)
outcome <- gl(3,1,9)
treatment <- gl(3,3)
print(d.AD <- data.frame(treatment, outcome, counts))
fit <- glmreg(counts ~ outcome + treatment, data=d.AD, family="poisson")
summary(fit)
coef(fit)

Run the code above in your browser using DataLab