chi_and_odds | R Documentation |
Takes in a a n x 3 data frame and calculates the chi squared statistic, the p-value of this and the odds ratio.
First column must be the category names. Second column must be observed values (a count) Third column must be the expected values (also a count, but can be weights or probabilities)
chi_and_odds(m)
m |
A n x 3 data frame or tibble. Should have variables in a particular order: category_name, observed_count, expected_count |
df <- tibble::tibble(field = c('Yes', 'No') , observed = c(34, 88), expected = c(707, 1021)) chi_and_odds(df) # or from clipboard df <- clipr::read_clip_tbl() chi_and_odds(df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.