View source: R/epi_functions.R
odds_trend | R Documentation |
odds_trend
calculates the odds ratio with confidence intervals (Wald) for different levels
(three or more) of the exposure variable, constructs the corresponding plot and calculates if the trend is
significant or not.
odds_trend(formula, data, angle = 45, hjust = 1, method = "wald", ...)
formula |
A formula with shape: outcome ~ exposure. |
data |
A data frame where the variables in the |
angle |
Angle of for the x labels (default = 45). |
hjust |
Horizontal adjustment for x labels (default = 1). |
method |
Method for calculating confidence interval around odds ratio. |
... |
Passes optional arguments to |
odds_trend
is a wrap function that calls oddsratio
from package epitools
.
Additional methods for confidence intervals include: "midp"
, "fisher"
, and "small"
.
A list with components df
a data frame with the results and fig
corresponding plot.
oddsratio
.
## A cross-sectional study looked at the association between obesity and a biopsy resulting
## from mammography screening.
Freq <- c(3441, 34, 39137, 519, 20509, 280, 12149, 196, 11882, 199)
Biopsy <- gl(2, 1, 10, labels = c("No", "Yes"))
Weight <- gl(5, 2, 10, labels = c(
"Underweight", "Normal", "Over (11-24%)",
"Over (25-39%)", "Over (> 39%)"
))
breast <- data.frame(Freq, Biopsy, Weight)
breast
breast <- expand_df(breast)
require(sjlabelled, quietly = TRUE)
breast <- var_labels(breast,
Weight = "Weight group"
)
odds_trend(Biopsy ~ Weight, data = breast)$df
odds_trend(Biopsy ~ Weight, data = breast)$fig
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.