This function computes the (adjusted) Phi coefficient between two or more than two dichotomous variables.
cor.phi(x, adjust = FALSE, tri = c("both", "lower", "upper"), digits = 2,
as.na = NULL, check = TRUE, output = TRUE)
a matrix or data frame.
logical: if TRUE
, phi coefficient is adjusted by relating
the coefficient to the possible maximum.
a character string or character vector indicating which triangular of the matrix
to show on the console, i.e., both
for upper and lower triangular,
lower
(default) for the lower triangular, and upper
for the upper
triangular.
an integer value indicating the number of decimal places digits to be used for displaying phi coefficients.
a numeric vector indicating user-defined missing values,
i.e. these values are converted to NA
before conducting the analysis.
logical: if TRUE
, argument specification is checked.
logical: if TRUE
, output is shown on the console.
Returns an object of class misty.object
, which is a list with following entries:
function call (call
), type of analysis type
, matrix or data frame specified in
x
(data
), specification of function arguments (args
), and
list with results (result
).
The maximum Phi coefficient is determined by the distribution of the two variables, i.e., the Phi
coefficient cannot achieve the value of 1 in many cases. According to Cureton (1959), the' phi
coefficient can be adjusted by relating the coefficient to the possible maximum,
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
Rasch, D., Kubinger, K. D., & Yanagida, T. (2011). Statistics in psychology - Using R and SPSS. New York: John Wiley & Sons.
# NOT RUN {
dat <- data.frame(x1 = c(0, 1, 0, 1, 0, 1, 0, 1, 1, 0),
x2 = c(0, 1, 0, 0, 1, 1, 1, 1, 1, 1),
x3 = c(0, 1, 0, 1, 1, 1, 1, 1, 0, 0))
# Phi coefficient between x1 and x2
cor.phi(dat[, c("x1", "x2")])
# Adjusted phi coefficient between x1 and x2
cor.phi(dat[, c("x1", "x2")], adjust = TRUE)
# Phi coefficient matrix between x1, x2, and x3
cor.phi(dat)
# Adjusted phi coefficient matrix between x1, x2, and x3
cor.phi(dat, adjust = TRUE)
# }
Run the code above in your browser using DataLab