subtype: Cox proportional hazard model for competing risks data

View source: R/subtype.R

subtypeR Documentation

Cox proportional hazard model for competing risks data

Description

Fitting a Cox proportional hazard model for competing risks data, in which marker variables define the subyptes of outcome.

Usage

subtype(formula, data, id, marker_name, marker_rr = NULL,
  first_cont_rr = TRUE, second_cont_bl = FALSE,
  second_cont_rr = FALSE, constvar = NULL, init, control, x = FALSE,
  y = TRUE, model = FALSE)

Arguments

formula

a formula object with an obect of the type Surv on the left side and the terms on the right side. It should not include marker variables.

data

a data.frame which has variables in formula and markers.

id

a charhacter string specifying subject IDs.

marker_name

a vector of charhacter strings specifying markers defining cause of failures.

marker_rr

a vector of logical value. Dafault is NULL, in which a model includes all markers named in marker_name in modeling heterogeneity effects. Otherwise, a vector of logical value can spcify whether each marker's heterogeneity effect will be examined or not. A length of this should be equal to that of marker_name.

first_cont_rr

a logical value: if TRUE, the first order contrasts are included in modeling cause-specific relative risks based on log-linear representation. Otherwise the first contrasts are only included.

second_cont_bl

a logical value: if TRUE, the second order contrasts are included in modeling cause-specific baseline functions based on log-linear representation. Otherwise the first contrasts are only included.

second_cont_rr

a logical value: if TRUE, the second order contrasts are included in modeling cause-specific relative risks based on log-linear representation. Otherwise the first contrasts are only included.

constvar

a vector of character strings specifying constrained varaibles of which the effects on the outcome are to be the same across subtypes of outcome. The variables which are not specified in constvar are considered as unconstrained variabales of which the associations with the outcome may be different across the outcome subtypes.

init

a vector of initial values of the iteration. Default value is zero for all variables.

control

an object of class coxph.control in survival packages.

Details

The Cox proportional hazard model is used to model cause-specific hazard functions. To examine the association between exposures and the specific subtypes of disease, the log-linear is used for reparameterization. This is a wrapper function for coxph after data duplication. The returned value x, y are duplicated the number of subtypes of outcome. +cluster() should be avoided since we automatically include it in the formula.

For marker variables, 0 indicates censored events.

Value

A returned object is an object of class coxph. See coxph.object for details. The additional returned values include the following:

basehaz

estimated baseline cause-specific hazard functions the reference disease subtype corresponding to marker variables equal to 1.

subtype

a list of values related to subtypes including the number of subtypes, character strings of marker names, etc.

Examples

m1 <- subtype(Surv(start, time, status)~ X + W,  data = data, id = "id", marker_name = c("y1", "y2"), second_cont_bl = FALSE, second_cont_rr = FALSE, constvar = "W")


joolee0918/AIPWsubtype documentation built on Feb. 29, 2024, 5:03 p.m.