ophi2corrZ {CorrToolBox} | R Documentation |
Computation of the Correlation of Bivariate Standard Normal Variables from the Ordinal Phi Coefficient
Description
This is an intermediate function that transforms marginal probabilities into cumulative probabilities and uses the ordcont
function in the GenOrd
package to compute the correlation of bivariate standard normal variables from the ordinal phi coefficient.
Usage
ophi2corrZ(ophi, p1, p2)
Arguments
ophi |
The ordinal phi coefficient. |
p1 |
A numeric vector containing marginal probabilities defining categories for the first ordinal variable. |
p2 |
A numeric vector containing marginal probabilities defining categories for the second ordinal variable. |
Value
The correlation of standard normal variables.
References
Demirtas, H., Ahmadian, R., Atis, S., Can, F.E., and Ercan, I. (2016). A nonnormal look at polychoric correlations: modeling the change in correlations before and after discretization. Computational Statistics, 31(4), 1385-1401.
Ferrari, P.A. and Barbiero, A. (2012). Simulating ordinal data. Multivariate Behavioral Research, 47(4), 566-589.
See Also
Examples
set.seed(567)
library(moments)
y1<-rweibull(n=100000, scale=1, shape=3.6)
y1.skew<-round(skewness(y1), 5)
y1.exkurt<-round(kurtosis(y1)-3, 5)
gaussmix <- function(n,m1,m2,s1,s2,pi) {
I <- runif(n)<pi
rnorm(n,mean=ifelse(I,m1,m2),sd=ifelse(I,s1,s2))
}
y2<-gaussmix(n=100000, m1=0, s1=1, m2=2, s2=1, pi=0.3)
y2.skew<-round(skewness(y2), 5)
y2.exkurt<-round(kurtosis(y2)-3, 5)
ophi2corrZ(ophi=-0.7, p1=c(0.4, 0.3, 0.2, 0.1), p2=c(0.2, 0.2, 0.6))