Learn R Programming

misty (version 0.5.0)

cor.phi: Phi Coefficient

Description

This function computes the (adjusted) Phi coefficient between two or more than two dichotomous variables.

Usage

cor.phi(x, adjust = FALSE, tri = c("both", "lower", "upper"), digits = 2,
        as.na = NULL, check = TRUE, output = TRUE)

Value

Returns an object of class misty.object, which is a list with following entries:

call

function call

type

type of analysis

data

matrix or data frame specified in x

args

specification of function arguments

result

result table

Arguments

x

a matrix or data frame.

adjust

logical: if TRUE, phi coefficient is adjusted by relating the coefficient to the possible maximum.

tri

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.

digits

an integer value indicating the number of decimal places digits to be used for displaying phi coefficients.

as.na

a numeric vector indicating user-defined missing values, i.e. these values are converted to NA before conducting the analysis.

check

logical: if TRUE, argument specification is checked.

output

logical: if TRUE, output is shown on the console.

Author

Takuya Yanagida takuya.yanagida@univie.ac.at

Details

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, \(\phi / \phi_max\).

References

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.

See Also

cor.matrix, cohens.d, cor.cont, cor.cramer, cor.poly.

Examples

Run this code
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