View source: R/epi_functions.R
| odds_trend | R Documentation |
odds_trend calculates the odds ratio with confidence intervals for different levels
(three or more) of the exposure variable.
odds_trend(data, x, y)
data |
A data frame. |
x |
A variable in the data frame. |
y |
A variable in the data frame. |
odds_trend fits a linear logistic model to calculate the odds ratios for all levels
of a categorical variable (the exposure).
A data frame.
## 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"
)
breast |>
odds_trend(x = Weight, y = Biopsy)
breast |>
odds_trend(x = Weight, y = Biopsy) |>
effect_plot(x = Exposure, y = OR)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.