Skip to content
Prev 350248 / 398506 Next

Phi coefficient matrix (package psych)

I want to calculate phi coefficient for every pair of the columns. Is there
a way to generate a matrix like a correlation matrix? I know cor function
in the case below gives same answer as phi coefficient.

?x <- sample(c(0,1), 10, replace=TRUE)
y <- sample(c(0,1), 10, replace=TRUE)
z <- sample(c(0,1), 10, replace=TRUE)
df <- data.frame(x,y,z)
cor(df)
library(psych)
phi(df)?

Thank you,
Kumar Mainali
Postdoctoral Associate
Department of Biology
University of Maryland
?