Learn R Programming

WCE (version 1.0.3)

HR.WCE: Obtain a hazard ratio (HR) from a WCE Cox proportional hazards model

Description

This function extracts the estimated coefficients from a WCE object.

Usage

HR.WCE(x, vecnum, vecdenom, allres = FALSE)

Value

Returns one or several hazard ratios. Inference may be obtained by bootstrap and has to be coded separately (please see WCE for an example).

Arguments

x

A WCE object.

vecnum

A vector of time-dependent exposures corresponding to a scenario of interest (numerator of the HR).

vecdenom

A vector of time-dependent exposures corresponding to a scenario for the reference category (denominator of the HR).

allres

Logical. If FALSE, prints the results using the best model from the WCE object, i.e. among the models fitted with the different numbers of interior knots requested by nknots, based on AIC or BIC as specified in the WCE call. If TRUE, prints the results for all the estimated models available from the WCE object. Default to FALSE.

Details

Both vecnum and vecdenom need to be of the same length as the weight function cutof argument used in the call to WCE. The first value of each vector represents the exposure today (t1) and subsequent values represent the exposures in the past. The hazard ratio computed by HR.WCE corresponds to the ratio of the weighted cumulative exposures for the scenario of interest (vecnum) and the reference scenario (vecdenom). It corresponds to equation (8) of Sylvestre and Abrahamowicz (2009).

References

Sylvestre, M. P., & Abrahamowicz, M. (2009). Flexible modeling of the cumulative effects of time-dependent exposures on the hazard. Statistics in medicine, 28(27), 3437-3453.

Examples

Run this code
wce <- WCE(drugdata, "Cox", 1, 90, constrained = "R", id = "Id", event = "Event",
start = "Start", stop = "Stop", expos = "dose",covariates = c("age", "sex"))
# Exposed at a dose of 1 (constant) vs. unexposed over the time window of 90 days
scenario1 <- rep(1, 90)
scenario2 <- rep(0, 90)
HR.WCE(wce, vecnum = scenario1, vecdenom = scenario2)

Run the code above in your browser using DataLab