Learn R Programming

autoReg (version 0.3.3)

fit2newdata: 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
)

Value

A data.frame

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

Examples

Run this code
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))

Run the code above in your browser using DataLab