predict.gamcox {MapGAM} | R Documentation |
Prediction Method for gamcox
Fits
Description
Obtains spatial effects predictions and optionally estimates standard errors and confidence intervals of those predictions from a fitted Cox proportional hazard additive model object.
Usage
## S3 method for class "gamcox"
## S3 method for class 'gamcox'
predict(object, newdata = object$data, se.fit = FALSE, type=c("spatial","all"),
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. A comprehensive effect (hazard ratio) of the covariates included in |
se.fit |
if |
type |
use |
reference |
the type of reference for the estimated effect. If |
level |
the confidence level for condifence bands. |
verbose |
a logical value indicating whether to print filling values for newdata. The default is |
... |
extra arguments for S3 generic, ignored by |
Value
pred |
the estimated log hazards ratio compared 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(CAdata)
data(CAmap)
fit <- gamcox(Surv(time,event)~AGE + factor(INS) + lo(X,Y),data=CAdata,
span=0.2,loess.trace="approximate")
fit
pred1 = predict(fit)
colormap(list(fit=pred1$pred,grid=data.frame(X=CAdata$X,Y=CAdata$Y)),map=CAmap,
border.gray=0.5)
data(CAgrid)
pred2 = predict(fit,CAgrid[,c("X","Y")])
colormap(list(fit=pred2$pred,grid=data.frame(X=CAgrid$X,Y=CAgrid$Y)),map=CAmap,
border.gray=0.5, legend.name="log hazard ratio")
## Circle significant areas based on the confidence intervals specified by conf.low and conf.high
pred3 = predict(fit,CAgrid[,c("X","Y")],se.fit=TRUE)
colormap(list(fit=pred3$pred,conf.low = pred3$conf.low, conf.high = pred3$conf.high,
grid=data.frame(X=CAgrid$X,Y=CAgrid$Y)),map=CAmap,border.gray = 0.7,
contours = "interval",legend.name="log hazard ratio")