Learn R Programming

gsg (version 2.0)

predict.gppr: Generalised projection pursuit regression

Description

Obtains linear predictor- or data-scale predictions for a fitted gppr object

Usage

predict.gppr(object,newdata,type="link")

Arguments

object
a fitted gppr object
newdata
an optional data frame containing new predictor variable values. If 'newdata' is omitted, then the predictions are made for the original data from which the gppr model was fitted.
type
the type of prediction required. The default is the scale of the linear predictor, alternativels 'type="response"' gives expected values.

Value

A vector of predictions.

References

M.B. Morrissey. in prep.

See Also

gppr, ppr,gppr.gradients

Examples

Run this code
# simulated data (two traits, stabilizing selection on trait 1)
n<-250
z<-cbind(rnorm(n,0,1),rnorm(n,0,1))
W<-rpois(n,exp(2-0.6*z[,1]^2))
d<-as.data.frame(cbind(W,z))
names(d)<-c("W","z1","z2")

fit.func<-gppr(y="W",xterms=c("z1","z2"),data=d,family="poisson",
   nterms=2,max.terms=2)

# hist(predict(fit.func))

Run the code above in your browser using DataLab