powered by
This function calculates polyserial correlations using either an ad hoc or ML estimator.
polyserial(x, y, ml = TRUE)
A continuous variable.
An ordinal variable with at least two categories.
A logical variable indicating whether to use a formal maximum likelihood estimator (default) or an ad hoc estimator.
Returns the polyserial correlation.
The variables should be numeric. The function returns NA is y has only one category.
Olsson, U., Drasgow, F. & Dorans, N. J. (1982). The Polyserial Correlation Coefficient. Psychometika, 47, 337-347.
# NOT RUN { x <- rnorm(500, 50,5) y <- x + rnorm(500,0,2) x <- x + rnorm(500,0,2) cor(x,y) y <- ifelse(y>50,1,0) cor(x,y) polyserial(x,y, ml=FALSE) polyserial(x,y) # }
Run the code above in your browser using DataLab