Skip to contents

Calculates Cohen's h for 2 x 2 contingency tables, such as those that might be analyzed with a chi-square test of association.

Usage

cohenH(x, observation = "row", verbose = TRUE, digits = 3)

Arguments

x

A 2 x 2 contingency table.

observation

If "row", the row constitutes an observation. That is, the sum of each row is 100 percent. If "column", the column constitutes an observation. That is, the sum of each column is 100 percent.

verbose

If TRUE, prints the proportions for each observation.

digits

The number of significant digits in the output.

Value

A single statistic.

Details

Cohen's h is an effect size to compare two proportions. For a 2 x 2 table: Cohen's h equals Phi2 - Phi1, where, If observations are in rows, P1 = a/(a+b) and P2 = c/(c+d). If observations are in columns, P1 = a/(a+c) and P2 = b/(b+d). Phi = 2 * asin(sqrt(P))

See also

Author

Salvatore Mangiafico, mangiafico@njaes.rutgers.edu

Examples

data(Pennsylvania18)
Pennsylvania18
#>      Democrat Not Democrat
#> 2016    0.380        0.620
#> 2018    0.498        0.502
cohenH(Pennsylvania18, observation="row")
#> 
#>   Group Proportion
#> 1  2016      0.380
#> 2  2018      0.498
#> 
#> Cohen's h 
#>     0.238