riskratio {risks} | R Documentation |
Fit risk ratio and risk difference models
Description
riskratio
and riskdiff
provide a flexible interface to fitting
risk ratio and risk difference models.
In cohort studies with a binary outcome, risk ratios and risk differences are typically more appropriate to report than odds ratios from logistic regression, yet such models have historically been difficult to implement in standard software.
The risks package selects an efficient way to fit risk ratio or risk difference models successfully, which will converge whenever logistic models converge. Optionally, a specific approach to model fitting can also be requested. Implemented are Poisson models with robust covariance, binomial models, logistic models with case duplication, binomial models aided in convergence by starting values obtained through Poisson models or logistic models with case duplication, binomial models fitted via combinatorial expectation maximization (optionally also with Poisson starting values), and estimates obtained via marginal standardization after logistic regression with bootstrapped or delta method for confidence intervals.
Adjusting for covariates (e.g., confounders) in the model specification
(formula =
) is possible.
Usage
riskratio(
formula,
data,
approach = c("auto", "all", "robpoisson", "duplicate", "glm", "glm_startp",
"glm_startd", "glm_cem", "glm_cem_startp", "margstd_boot", "margstd_delta",
"logistic", "legacy"),
variable = NULL,
at = NULL,
...
)
riskdiff(
formula,
data,
approach = c("auto", "all", "robpoisson", "glm", "glm_startp", "glm_cem",
"glm_cem_startp", "margstd_boot", "margstd_delta", "legacy"),
variable = NULL,
at = NULL,
...
)
Arguments
formula |
A formula object of the form |
data |
A |
approach |
Optional: Method for model fitting.
The other options allow for directly selecting a fitting approach, some of which may not converge or yield out-of-range predicted probabilities. See full documentation for details.
|
variable |
Optional: exposure variable to use for marginal
standardization. If |
at |
Optional: Levels of exposure variable |
... |
Optional: Further arguments passed to fitting functions
( |
Value
Fitted model. This object can be passed on to post-processing functions:
-
summary.risks
: an overview of results (risks-specific S3 methods:summary.robpoisson
,summary.margstd_boot
,summary.margstd_delta
). -
tidy.risks
: a tibble of coefficients and confidence intervals.
Standard post-processing functions can also be used:
-
coef
: a vector of coefficients. -
confint
: a matrix of confidence intervals (risks-specific S3 methods:confint.robpoisson
,confint.margstd_boot
,confint.margstd_delta
). -
predict.glm(type = "response")
: fitted values (predictions). -
residuals
: residuals.
If model fitting using all possible approaches was requested via
approach = "all"
, then their results can be retrieved from the
list all_models
in the returned object (e.g.,
fit$all_models[[1]]
, fit$all_models[[2]]
, etc.).
Functions
-
riskratio()
: Fit risk ratio models -
riskdiff()
: Fit risk difference models
References
Wacholder S. Binomial regression in GLIM: Estimating risk ratios
and risk differences. Am J Epidemiol 1986;123:174-184.
(Binomial regression models; approach = "glm"
)
Spiegelman D, Hertzmark E. Easy SAS Calculations for Risk or
Prevalence Ratios and Differences. Am J Epidemiol 2005;162:199-200.
(Binomial models fitted used starting values from Poisson models;
approach = "glm_start"
)
Zou G. A modified Poisson regression approach to prospective
studies with binary data. Am J Epidemiol 2004;159:702-706.
(Poisson model with robust/sandwich standard errors;
approach = "robpoisson"
)
Schouten EG, Dekker JM, Kok FJ, Le Cessie S, Van Houwelingen HC,
Pool J, Vandenbroucke JP. Risk ratio and rate ratio estimation in
case-cohort designs: hypertension and cardiovascular mortality.
Stat Med 1993;12:1733–45; (Logistic model with case duplication and
cluster-robust standard errors, approach = "duplicate"
).
Donoghoe MW, Marschner IC. logbin: An R Package for
Relative Risk Regression Using the Log-Binomial Model.
J Stat Softw 2018;86(9). (Log-binomial models fitted via combinatorial
expectation maximization; riskratio(approach = "glm_cem")
Donoghoe MW, Marschner IC. Stable computational methods
for additive binomial models with application to adjusted risk differences.
Comput Stat Data Anal 2014;80:184-96. (Additive binomial models
fitted via combinatorial expectation maximization;
riskdiff(approach = "glm_cem")
)
Localio AR, Margolis DJ, Berlin JA.
Relative risks and confidence intervals were easily computed
indirectly from multivariable logistic regression.
J Clin Epidemiol 2007;60(9):874-82. (Marginal standardization after fitting
a logistic model; approach = "margstd_boot"
)
Examples
data(breastcancer) # Cohort study with binary outcome
# See for details: help(breastcancer)
# Risk ratio model
fit_rr <- riskratio(formula = death ~ stage + receptor, data = breastcancer)
fit_rr
summary(fit_rr)
# Risk difference model
fit_rd <- riskdiff(formula = death ~ stage + receptor, data = breastcancer)
fit_rd
summary(fit_rd)