mhor: Mantel-Haenszel odds ratio.

View source: R/epi_functions.R

mhorR Documentation

Mantel-Haenszel odds ratio.

Description

mhor computes odds ratios by levels of the stratum variable as well as the Mantel-Haenszel pooled odds ratio. The test for effect modification (test for interaction) is also displayed.

Usage

mhor(object = NULL, formula = NULL, data = NULL)

Arguments

object

When chaining, this holds an object produced in the earlier portions of the chain. Most users can safely ignore this argument. See details and examples.

formula

A formula with shape: outcome ~ stratum/exposure.

data

A data frame containing the variables used in formula.

Value

Odds ratios with 95 outcome by levels of stratum. The Mantel-Haenszel pooled OR and the test for effect modification is also reported.

See Also

mh

Examples

data(oswego, package = "epitools")
require(dplyr, quietly = TRUE)
require(sjlabelled, quietly = TRUE)
oswego <- oswego %>%
  mutate(
    ill = factor(ill, labels = c("No", "Yes")),
    sex = factor(sex, labels = c("Female", "Male")),
    chocolate.ice.cream = factor(chocolate.ice.cream, labels = c("No", "Yes"))
  ) %>%
  var_labels(
    ill = "Developed illness",
    sex = "Sex",
    chocolate.ice.cream = "Consumed chocolate ice cream"
  )

oswego %>%
  select(ill, sex, chocolate.ice.cream) %>%
  tbl_summary() %>%
  cosm_sum() %>%
  theme_pubh()

oswego %>%
  mhor(ill ~ sex / chocolate.ice.cream)

josie-athens/pubh documentation built on Feb. 3, 2024, 4:32 a.m.