Conditional Logistic Regression with Optional Concordant Pairs
Full documentation and function reference: https://tennenbaumj.github.io/bclogit_package_and_paper_repo/
bclogit is an R package for fitting conditional logistic regression models that can optionally incorporate information from concordant pairs (and a reservoir of additional controls) to improve estimation of discordant pairs. This approach effectively uses a Bayesian prior derived from the concordant data to inform the discordant pairs analysis, suitable for matched case-control studies where data sparsity might be an issue.
You can install the development version of bclogit from source:
# install.packages("devtools")
devtools::install()
or use the command line
R CMD INSTALL bclogit
Here is a basic example of how to use bclogit:
library(bclogit)
# Simulate some matched pair data
set.seed(123)
n_pairs <- 50
x1 <- rnorm(n_pairs * 2)
x2 <- rbinom(n_pairs * 2, 1, 0.5)
strata <- rep(1:n_pairs, each = 2)
treatment <- rep(c(0, 1), n_pairs) # Case-Control
# ... (simulate response y) ...
# Fit the model
# Using Formula Interface
fit <- bclogit(y ~ x1 + x2, data = mydata, treatment = treatment, strata = strata)
# Summary of results
summary(fit)
# Coefficients
coef(fit)
# Confidence Intervals
confint(fit)
glm or lm.rstan to fit models with informative priors.clogit which runs with a 5â10x speedup over survival::clogit. If you only want inference on the jth variable, you can set do_inference_on_var = j which gives the best speedup at large n: 9â11x at 10kâ50k pairs.See CITATION.cff, or in R: citation("bclogit").
This package is licensed under GPL3.