| effsize {misty} | R Documentation | 
Effect Sizes for Categorical Variables
Description
This function computes effect sizes for one or more than one categorical variable, i.e., (adjusted) phi coefficient, (bias-corrected) Cramer's V, (bias-corrected) Tschuprow's T, (adjusted) Pearson's contingency coefficient, Cohen's w), and Fei. By default, the function computes Fei based on a chi-square goodness-of-fit test for one categorical variable, phi coefficient based on a chi-square test of independence for two dichotomous variables, and Cramer's V based on a chi-square test of independence for two variables with at least one polytomous variable.
Usage
effsize(..., data = NULL, type = c("phi", "cramer", "tschuprow", "cont", "w", "fei"),
        alternative = c("two.sided", "less", "greater"),   conf.level = 0.95,
        adjust = TRUE, indep = TRUE, p = NULL, digits = 3, as.na = NULL,
        write = NULL, append = TRUE, check = TRUE, output = TRUE)
Arguments
| ... | a vector, factor, matrix or data frame. Alternatively, an
expression indicating the variable names in  | 
| data | a data frame when specifying one or more variables in the
argument  | 
| type | a chracter string indicating the type of effect size, i.e.,
 | 
| alternative | a character string specifying the alternative hypothesis,
must be one of  | 
| conf.level | a numeric value between 0 and 1 indicating the confidence level of the interval. | 
| adjust | logical: if  | 
| indep | logical: if  | 
| p | a numeric vector specifying the expected proportions in each category of the categorical variable when conduting a chi-square goodness-of-fit test. By default, the expected proportions in each category are assumed to be equal. | 
| digits | an integer value indicating the number of decimal places digits to be used for displaying the results. | 
| as.na | a numeric vector indicating user-defined missing values,
i.e. these values are converted to  | 
| write | a character string naming a file for writing the output
into either a text file with file extension  | 
| append | logical: if  | 
| check | logical: if  | 
| output | logical: if  | 
Note
This function is based on modified copies of the functions chisq_to_phi,
chisq_to_cramers_v, chisq_to_tschuprows_t, chisq_to_pearsons_c,
chisq_to_cohens_w, and chisq_to_fei from the effectsize
package (Ben-Shachar, Lüdecke & Makowski, 2020).
Author(s)
Takuya Yanagida takuya.yanagida@univie.ac.at
References
Bergsma, W. (2013). A bias correction for Cramer's V and Tschuprow's T. Journal of the Korean Statistical Society, 42, 323-328. https://doi.org/10.1016/j.jkss.2012.10.002
Ben-Shachar M. S., Lüdecke D., Makowski D. (2020). effectsize: Estimation of Effect Size Indices and Standardized Parameters. Journal of Open Source Software, 5 (56), 2815. https://doi.org/10.21105/joss.02815
Ben-Shachar, M. S., Patil, I., Theriault, R., Wiernik, B. M., Lüdecke, D. (2023). Phi, Fei, Fo, Fum: Effect sizes for categorical data that use the chi-squared statistic. Mathematics, 11, 1982. https://doi.org/10.3390/math11091982
Cureton, E. E. (1959). Note on Phi/Phi max. Psychometrika, 24, 89-91.
Davenport, E. C., & El-Sanhurry, N. A. (1991). Phi/Phimax: Review and synthesis. Educational and Psychological Measurement, 51, 821-828. https://doi.org/10.1177/001316449105100403
Sakoda, J.M. (1977). Measures of association for multivariate contingency tables. Proceedings of the Social Statistics Section of the American Statistical Association (Part III), 777-780.
See Also
Examples
# Example 1a: Phi coefficient for 'vs' and 'am'
effsize(mtcars[, c("vs", "am")])
# Example 1a: Alternative specification using the 'data' argument
effsize(vs, am, data = mtcars)
# Example 2: Bias-corrected Cramer's V for 'gear' and 'carb'
effsize(gear, carb, data = mtcars)
# Example 3: Cramer's V (without bias-correction) for 'gear' and 'carb'
effsize(gear, carb, data = mtcars, adjust = FALSE)
# Example 4: Adjusted Pearson's contingency coefficient for 'gear' and 'carb'
effsize(gear, carb, data = mtcars, type = "cont")
# Example 5: Fei for 'gear'
effsize(gear, data = mtcars)
# Example 6a: Bias-corrected Cramer's V for 'cyl' and 'vs', 'am', 'gear', and 'carb'
effsize(mtcars[, c("cyl", "vs", "am", "gear", "carb")])
# Example 6b: Alternative specification using the 'data' argument
effsize(cyl, vs:carb, data = mtcars)
## Not run: 
# Example 7b: Write Results into a text file
effsize(cyl, vs:carb, data = mtcars, write = "Cramer.txt")
# Example 7b: Write Results into a Excel file
effsize(cyl, vs:carb, data = mtcars, write = "Cramer.xlsx")
## End(Not run)