Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

collapseCategoricalCells

Collapse small sample size categorical frequency counts


Description

Collapse small sample size categorical frequency counts

Usage

collapseCategoricalCells(observed, expected, minExpected = 1)

Arguments

observed

the observed frequency table

expected

the expected frequency table

minExpected

the minimum expected cell frequency

Pearson's X^2 test requires some minimum frequency per cell to avoid an inflated false positive rate. This function will merge cells with the lowest frequency counts until all the counts are above the minimum threshold. Cells that have been merged are filled with NAs. The resulting tables and number of merged cells is returned.

Examples

O = matrix(c(7,31,42,20,0), 1,5)
E = matrix(c(3,39,50,8,0), 1,5)
collapseCategoricalCells(O,E,9)

rpf

Response Probability Functions

v1.0.11
GPL (>= 3)
Authors
Joshua Pritikin [cre, aut], Jonathan Weeks [ctb], Li Cai [ctb], Carrie Houts [ctb], Phil Chalmers [ctb], Michael D. Hunter [ctb], Carl F. Falk [ctb]
Initial release
2021-10-19

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.