mypredict.gam {MapGAM} | R Documentation |
Prediction for GAM Fits
Description
Obtains spatial effects predictions and optionally estimates standard errors and confidence intervals of those predictions from a fitted generalized additive model object.
Usage
mypredict.gam(object, newdata, se.fit = FALSE, type=c("all","spatial"),
reference = "median", level = 0.05,verbose=FALSE)
Arguments
object |
a fitted |
newdata |
a data frame containing the values at which predictions are required. This argument can be missing, in which case predictions are made at the same values used to compute the object. Only two-dimentional predictor need be present by name in newdata. |
se.fit |
if TRUE, pointwise standard errors and confidence intervals are computed along with the predictions. |
type |
use |
reference |
the type of reference for the estimated effect. If |
level |
the siginificance level used when |
verbose |
a logical value indicating whether to print filling values for newdata. The default is |
Value
pred |
the estimated effect difference or (log ratio) compare to the effect specified by |
se |
the standard errors along with the predictions. |
conf.low |
the lower bounds for pointwise (1- |
conf.high |
the higher bounds for pointwise (1- |
Author(s)
Lu Bai
Send bug reports to sbartell@uci.edu.
References
Hastie TJ, Tibshirani RJ. Generalized Additive Models. (Chapman & Hall/CRC Monographs on Statistics & Applied Probability, Boca Raton, Florida, 1990).
See Also
Examples
data(MAdata)
data(MAmap)
gamgrid <- predgrid(MAdata, map=MAmap)
fit <- gam(Case~lo(Xcoord,Ycoord,span=0.2)+Smoking,data=MAdata,family=binomial())
pred1 = mypredict.gam(fit)
colormap(list(fit=pred1$pred,grid=data.frame(X=MAdata$X,Y=MAdata$Y)),map=MAmap)
pred2 = mypredict.gam(fit,gamgrid)
colormap(list(fit=pred2$pred,grid=data.frame(X=gamgrid$X,Y=gamgrid$Y)),map=MAmap)
pred3 = mypredict.gam(fit,gamgrid,se.fit=TRUE)
colormap(list(fit=pred3$pred,conf.low = pred3$conf.low, conf.high = pred3$conf.high,
grid=data.frame(X=gamgrid$X,Y=gamgrid$Y)),map=MAmap,contours = "interval")