The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

prLogistic estimates adjusted prevalence ratios (PR) and their confidence intervals from logistic regression models, addressing the well-known limitation of odds ratios (OR) as approximations to PR in cross-sectional and other studies with common binary outcomes.
When the outcome is common (prevalence > 10%), the OR from logistic regression overestimates the PR. For example, with a 30% baseline prevalence and an OR = 2.5, the true PR is closer to 1.8. prLogistic corrects this using conditional or marginal standardisation directly on the logistic model.
| Function | Model | Use case |
|---|---|---|
prLogisticDelta() |
glm |
Independent observations |
prLogisticDelta() |
glmerMod |
Clustered / multilevel data |
prLogisticGEE() |
geeglm |
Longitudinal data (GEE) |
prLogisticSurvey() |
svyglm |
Complex survey designs |
# Stable release from CRAN
install.packages("prLogistic")
# Development version from GitHub
# install.packages("remotes")
remotes::install_github("Raydonal/prLogistic")library(prLogistic)
# Fit a standard logistic model
data(birthwt, package = "MASS")
birthwt$smoke <- factor(birthwt$smoke)
birthwt$race <- factor(birthwt$race)
fit <- glm(low ~ smoke + race + age + lwt,
family = binomial, data = birthwt)
# --- Delta method --------------------------------------------------------
# Conditional PR (default: continuous covariates at median)
prLogisticDelta(fit, standardisation = "conditional")
# Marginal PR (population-averaged)
prLogisticDelta(fit, standardisation = "marginal")
# Custom reference: age = 25, lwt = 55 kg
prLogisticDelta(fit,
standardisation = "conditional",
ref_values = list(age = 25, lwt = 55))
# --- Bootstrap CIs -------------------------------------------------------
set.seed(42)
prLogisticBootCond(fit, data = birthwt, R = 999)
# --- Forest plot ---------------------------------------------------------
res <- prLogisticDelta(fit)
plot(res)library(geepack)
data(ohio, package = "geepack")
fit_gee <- geeglm(resp ~ smoke + age,
family = binomial, id = id,
corstr = "exchangeable", data = ohio)
prLogisticGEE(fit_gee)library(survey)
data(api, package = "survey")
dclus2 <- svydesign(id = ~dnum + snum, fpc = ~fpc1 + fpc2, data = apiclus2)
fit_svy <- svyglm(sch.wide ~ meals + stype,
design = dclus2, family = quasibinomial)
prLogisticSurvey(fit_svy)If you use prLogistic in your research, please cite:
Amorim, L. D. & Ospina, R. (2021). Prevalence ratio estimation using R. Anais da Academia Brasileira de Ciências, 93(4), e20190316. https://doi.org/10.1590/0001-3765202120190316
@article{Amorim2021,
author = {Amorim, Leila D. and Ospina, Raydonal},
title = {Prevalence ratio estimation using {R}},
journal = {Anais da Academia Brasileira de Ci\^{e}ncias},
year = {2021},
volume = {93},
number = {4},
pages = {e20190316},
doi = {10.1590/0001-3765202120190316}
}GPL (≥ 2). See the GNU GPL v2 for details.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.