Cb.cox: Cb calculations for a Cox proportional hazard model.

Description Usage Arguments Value Examples

View source: R/Cb.R

Description

Cb calculations for a Cox proportional hazard model.

Usage

1
Cb.cox(reg_object, tx_var, semi_parametric = FALSE, time = 1)

Arguments

reg_object

An object of class 'coxph' that contains the model. IMPORTANT: the coxph function call for fitting the model must have model=TRUE as an input argument such that the underlying data becomes part of the returned object (this is the case by default for glm)

tx_var

A string containing the name of the treatment indicator variable.

semi_parametric

Optional (default=FALSE). If TRUE, the semi-parametric estimator for Cb will be returned.

time

Optional (default=1). The value of time at which Cb is calculated.

Value

This function returns an object of class Cb_output, which includes Cb as a member.

Examples

1
2
3
4
5
6
7
8
9
data("rct_data")
#Create an event indicator and update the tte (time-to-event) variable to be equal to follpow-up time for censored individuals.
event<-(!is.na(rct_data[,'tte']))*1
ids<-which(event==0)
rct_data[ids,'tte']<-rct_data[ids,'time']
rct_data['event']<-event

reg.coxph<-coxph(Surv(time=tte,event=event) ~ tx + tx:female + tx:age + sgrq + prev_hosp + prev_ster + fev1, data=rct_data, model=TRUE)
res.coxph<-Cb.coxph(reg.coxph,tx_var = "tx",semi_parametric = T)

msadatsafavi/txBenefit documentation built on Feb. 3, 2020, 10:32 a.m.