polyserial: Function for calculating polyserial correlations

Description Usage Arguments Details Value Author(s) References Examples

Description

This function calculates polyserial correlations using either an ad hoc or ML estimator.

Usage

1
polyserial(x, y, ml = TRUE)

Arguments

x

A continuous variable.

y

An ordinal variable with at least two categories.

ml

A logical variable indicating whether to use a formal maximum likelihood estimator (default) or an ad hoc estimator.

Details

The variables should be numeric. The function returns NA is y has only one category.

Value

Returns the polyserial correlation.

Author(s)

John T. Willse

References

Olsson, U., Drasgow, F. & Dorans, N. J. (1982). The Polyserial Correlation Coefficient. Psychometika, 47, 337-347.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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)

Example output

[1] 0.8617274
[1] 0.7082303
[1] 0.8876512
          
0.8741882 

CTT documentation built on May 2, 2019, 1:08 p.m.