Chi squared is calculated using stats::chisq.test
.
If any cell contains less than 5 observations, the exact-parameter is set.
effect_counts_one_grouped(data, col, cross, clean = TRUE, ...)
A volker list with two volker tibbles. The first tibble contains npmi values for each combinations:
n Number the combination occurs.
p_x Marginal share of the first category.
p_y Marginal share of the second category.
p_xy Share of the combination based on all combinations.
ratio The ratio of p_xy to (p_x * p_y).
pmi Pointwise Mutual information, derived from the ratio.
npmi Normalized Pointwise Mutual Information, derived from the pmi.
The second tibble contains effect sizes based on the cross table:
Cramer's V: Effect size measuring the association between the two variables.
n: Number of cases the calculation is based on.
Chi-squared: Chi-Squared test statistic. If expected values are below 5 in at least one cell, an exact Fisher test is conducted.
df: Degrees of freedo of the chi-squared test. Empty for the exact Fisher test.
p: p-value of the chi-squared test.
stars: Significance stars based on p-value (*, **, ***).
A tibble.
The column holding factor values.
The column holding groups to compare.
Prepare data by data_clean.
Placeholder to allow calling the method with unused parameters from effect_counts.
Phi is derived from the Chi squared value by sqrt(fit$statistic / n)
.
Cramer's V is derived by sqrt(phi / (min(dim(contingency)[1], dim(contingency)[2]) - 1))
.
Cramer's V is set to 1.0 for diagonal contingency matrices, indicating perfect association.
library(volker)
data <- volker::chatgpt
effect_counts_one_grouped(data, adopter, sd_gender)
Run the code above in your browser using DataLab