This function calculates the hazard ratio (HR) from an estimated model in a WCE object to compare two scenarios of time-dependent exposures.

1 |

`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 |

Both `vecnum`

and `vecdenom`

need to be of the same length as the weight function `cutof`

argument used in the call to WCE. 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).

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

for an example).

Marie-Pierre Sylvestre

marie-pierre.sylvestre@umontreal.ca

Sylvestre MP, Abrahamowicz M. Flexible modeling of the cumulative effects of time-dependent exposures on the hazard. Stat Med. 2009 Nov 30;28(27):3437-53.

1 2 3 4 5 6 7 8 | ```
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)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.