Skip to contents

CXOwt

This R package was is code to implement weighted conditional logistic regression described here.

Installation

CXOwt is still under development. You can install the latest version from GitHub with:

# install.packages("remotes")
remotes::install_github("lan-k/CXOwt")

Using the package

CXOwt contains functions for both case-crossover and case-time-control designs. There are 2 example dataframes, cases and casetimecontrols.

CXO_wt_boot() is the version for case-crossover studies, CXO_tc_wt_boot() for case-time-control studies. Both return the weighted Odds Ratio estimate and bootstrapped 95% confidence intervals.

library(CXOwt)
#case-crossover
data(cases)
cfit.b <- CXO_wt_boot(data=cases, exposure = ex, event = Event, Id=Id, B=200) 
summary(cfit.b)
#case-time-control
data(casetimecontrols)
ctcfit.b <- CXO_tc_wt_boot(data=casetimecontrols, exposure = ex, event = Event, Id=Id, B = 200) 
summary(ctcfit.b)

Alternatively, you can return the weighted conditional logistic regression objects without bootstrapping and use other methods for calculating the 95% CI. However, this is not recommended.

#case-crossover
cfit <- CXO_wt(cases, exposure = ex, event = Event, Id=Id)  
summary(cfit)
#case-time-control
ctcfit <- CXO_tc_wt(casetimecontrols, exposure = ex, event = Event, Id=Id)   
summary(ctcfit)