predict.gamcox: Prediction Method for 'gamcox' Fits

View source: R/predict.gamcox.R

predict.gamcoxR 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 gamcox object.

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 newdata will be predicted.

se.fit

if TRUE, pointwise standard errors and confidence intervals are computed along with the predictions.

type

use type="spatial"(default) to estimate spatial effect, and use type="all" to estimate the effect of all covariates included in the model.

reference

the type of reference for the estimated effect. If reference = "median", the output will be the estimated hazard ratio (or log-ratio) compared to the median effect. If reference = "mean",the output will be the estimated hazard ratio (or log-ratio) compared to the mean effect.If reference is a data frame indicating a specific geolocation, the out put will be the estimated hazard ratio (or log ratio) compared to the hazard of the geolocation specified by reference.

level

the confidence level for condifence bands.

verbose

a logical value indicating whether to print filling values for newdata. The default is verbose = FALSE.

...

extra arguments for S3 generic, ignored by predict.gamcox.

Value

pred

the estimated log hazards ratio compared to the effect specified by reference.

se

the standard errors along with the predictions.

conf.low

the lower bounds for pointwise (1-level) confidence intervals.

conf.high

the higher bounds for pointwise (1-level) confidence intervals.

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

modgam, predict.gamcox.

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")


MapGAM documentation built on July 26, 2023, 5:12 p.m.