Learn R Programming

riskRegression (version 1.3.7)

CoxCenter: Extract the mean value of the covariates

Description

Extract the mean value of the covariates

Usage

CoxCenter(object)

# S3 method for cph CoxCenter(object)

# S3 method for coxph CoxCenter(object)

# S3 method for phreg CoxCenter(object)

Arguments

object

The fitted Cox regression model object either obtained with coxph (survival package), cph (rms package), or phreg (mets package).

Examples

Run this code

d <- sampleData(1e2, outcome = "survival")
d$Xcat <- paste0(d$X3,d$X4)
d$entry <- 0

##
library(survival)
mCox <- coxph(Surv(time, event) ~ X1+X2, data = d)
CoxCenter(mCox)
mCox <- coxph(Surv(time, event) ~ X1+X2+Xcat, data = d)
CoxCenter(mCox)

##
library(rms)
mCox <- cph(Surv(time, event) ~ X1+X2, data = d, y = TRUE)
CoxCenter(mCox)
mCox <- cph(Surv(time, event) ~ X1+X2+Xcat, data = d)
CoxCenter(mCox)

##
library(mets)
mCox <- phreg(Surv(entry, time, event) ~ X1+X2, data = d)
CoxCenter(mCox)
mCox <- cph(Surv(time, event) ~ X1+X2+Xcat, data = d)
CoxCenter(mCox)

Run the code above in your browser using DataLab