fit2newdata: Make a new data of mean value or most frequent value

View source: R/fit2newdata.R

fit2newdataR Documentation

Make a new data of mean value or most frequent value

Description

Make a new data of mean value or most frequent value

Usage

fit2newdata(
  fit,
  xnames = NULL,
  pred.values = list(),
  maxy.lev = 5,
  median = TRUE,
  digits = 1
)

Arguments

fit

An object of class "coxph"

xnames

character Names of explanatory variable to plot

pred.values

A list A list of predictor values

maxy.lev

Integer Maximum unique length of a numeric variable to be treated as categorical variables

median

logical If TRUE, select median value for numerical variable. Otherwise select most frequent value

digits

integer indicating the number of decimal places

Value

A data.frame

Examples

require(survival)
data(cancer,package="survival")
fit=coxph(Surv(time,status)~rx+sex+age,data=colon)
fit=coxph(Surv(time,status)~rx+age+strata(sex),data=colon)
fit=survreg(Surv(time, status) ~ ph.ecog + age + sex, data=lung, dist="weibull")
fit2newdata(fit)
fit2newdata(fit,pred.values=list(sex=0,age=58))
fit2newdata(fit,pred.values=list(age=c(20,40,60,80),sex=2,ph.ecog=3))

autoReg documentation built on Nov. 14, 2023, 9:07 a.m.