predict.modreg: Prediction from a fitted modreg model

View source: R/predict.modreg.R

predict.modregR Documentation

Prediction from a fitted modreg model

Description

Takes a fitted modreg object produced by modreg and produces predictions. New sets of covariates can by supplied through newdata.

Usage

## S3 method for class 'modreg'
predict(object, ...)

Arguments

object

The object to plot, must be of class modreg.

...

Additional arguments to pass to predict.gam.

Details

This function is a wrapper for predict.gam.

Value

A vector or matrix of predictions. For type = "terms" this is a matrix with a column per term.

Examples


data(colcancer)
colcancer70 <- colcancer[1:70, ]

mc <- modreg.control(tol_opt = 10^-2, tol_opt2 = 10^-2, 
tol = 10^-3)
reg <- modreg(Surv(logfollowup, death) ~ sex + s(age, bs = "ps"), data = 
colcancer70, control = mc)
ndat <- data.frame(sex = rep(colcancer70$sex[1], 200), age = seq(50, 90, length = 200))
pr <- predict(reg, newdata = ndat)


dirttee documentation built on Sept. 14, 2022, 5:06 p.m.