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