epiHomog: Stratified test of homogeneity

View source: R/epiHomog.R

epiHomogR Documentation

Stratified test of homogeneity

Description

Calculates chi-square test statistic and p-value for risk differences and risk ratios of stratified 2x2 tables.

Usage

epiHomog(tab, metric = "Risk Difference")

Arguments

tab

a table object

metric

"Risk Difference" or "Risk Ratio"

Details

For calculation to be correct, table must be formatted same as those used for epi.2by2(), where counts for the outcome of interest and the exposed group appear in the upper-left corner of each stratified table.

If your 2x2 tables are composed of factors where the referent variable is level 0 and the index group is level 1, use flipTable() to re-orient to the format required here.

Value

test statistic and p-value

Examples

food <- dplyr::tibble(
fruits = sample(c("Orange", "Tomato"), 100, replace = TRUE),
vegs = sample(c("Okra", "Fingernails"), 100, replace = TRUE),
grain = sample(c("Baked", "Raw", "Monsanto"), 100, replace = TRUE))

tab <- flipTable(table(food))

epiHomog(tab)


potato-nathan/epiAssist documentation built on April 15, 2022, 11:32 a.m.