GAMBoost (version 1.2-3)

predict.GAMBoost: Predict method for GAMBoost fits

Description

Obtains predictions at specified boosting steps from a GAMBoost object fitted by GAMBoost.

Usage

"predict"(object,newdata=NULL,newdata.linear=NULL, at.step=NULL,type=c("link","response","terms"),...)

Arguments

object
fitted GAMBoost object from a GAMBoost call.
newdata
n.new * p matrix with new covariate values for smooth components. If just prediction for the training data is wanted or just a generalized linear model has been fitted, it can be omitted.
newdata.linear
matrix with new covariate values for linear components. If linear components have been fitted and this is not given, the contribution of the linear components will be ignored for prediction.
at.step
scalar or vector of boosting step(s) at which prediction is wanted. If type="terms" is used, only one step is admissible. If no step is given, the final boosting step is used.
type
type of prediction to be returned: "link" gives prediction at the level of the predictor, "response" at the response level. "terms" returns individual contributions of the smooth components to the predictor.
...
miscellaneous arguments, none of which is used at the moment.

Value

For type="link" and type="response" a vector of length n.new (at.step being a scalar) or a n.new * length(at.step) matrix (at.step being a vector) with predictions is returned. For type="terms" a n.new * p+1 matrix with contributions of the smooth components to the predictor is returned.

Examples

Run this code
##  Generate some data 
x <- matrix(runif(100*3,min=-1,max=1),100,3)             
eta <- -0.5 + 2*x[,1] + 4*x[,3]^2
y <- rbinom(100,1,binomial()$linkinv(eta))

##  Fit the model with smooth components
gb1 <- GAMBoost(x,y,penalty=200,stepno=100,trace=TRUE,family=binomial()) 

##  Extract predictions

#   at final boosting step
predict(gb1,type="response")

#   at 'optimal' boosting step (with respect to AIC)
predict(gb1,at.step=which.min(gb1$AIC),type="response")

#   matrix with predictions at predictor level for all boosting steps
predict(gb1,at.step=1:100,type="link")

Run the code above in your browser using DataLab