psych (version 1.0-17)

phi2poly: Convert a phi coefficient to a polychoric correlation

Description

Given a phi coefficient (a Pearson r calculated on two dichotomous variables), and the marginal frequencies, what is the corresponding estimate of the polychoric correlation?

Usage

phi2poly(ph, cp, cc)

Arguments

ph
phi
cp
probability of the predictor -- the so called selection ratio
cc
probability of the criterion -- the so called success rate.

Value

  • a polychoric correlation

Details

Uses John Fox's polycor function.

See Also

polychor.matrix

Examples

Run this code
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function(ph,cp,cc) {
	require(polycor)
     #ph is the phi coefficient
     #cp is the selection ratio of the predictor
     #cc is the success rate of the criterion
     r.marg<-rep(0,2)
     c.marg<- rep(0,2)
     p<-array(rep(0,4),dim=c(2,2))
     r.marg[1]<- cp
     r.marg[2]<- 1 -cp 
     c.marg[1]<- cc
     c.marg[2]<- 1-cc
     
     p[1,1]<- r.marg[1]*c.marg[1]+ ph*sqrt(prod(r.marg,c.marg))
     p[2,2]<- r.marg[2]*c.marg[2]+ ph*sqrt(prod(r.marg,c.marg))
     p[1,2]<- r.marg[1]*c.marg[2]- ph*sqrt(prod(r.marg,c.marg))
     p[2,1]<- r.marg[2]*c.marg[1]- ph*sqrt(prod(r.marg,c.marg))
     
     result<-polychor(p ) 
     return(result)}

Run the code above in your browser using DataLab