polychoric2: Polychoric Correlation

View source: R/polychoric2.R

polychoric2R Documentation

Polychoric Correlation

Description

This function estimates the polychoric correlation coefficient using maximum likelihood estimation (Olsson, 1979).

Usage

polychoric2(dat, maxiter=100, cor.smooth=TRUE, use_pbv=1, conv=1e-10,
      rho_init=NULL, weights=NULL)

## exported Rcpp function
sirt_rcpp_polychoric2( dat, maxK, maxiter, use_pbv, conv, rho_init, weights)

Arguments

dat

A dataset with integer values 0,1,\ldots,K

maxiter

Maximum number of iterations

cor.smooth

An optional logical indicating whether the polychoric correlation matrix should be smooth to ensure positive definiteness.

use_pbv

Integer indicating whether the pbv package is used for computation of bivariate normal distribution. 0 stands for the simplest approximation in sirt (Cox & Wermuth, 1991, as implemented in polychoric2) while versions 1 and 2 uses the algorithm of pbv (the first one copied into the sirt package, the second one linking Rcpp code to pbv.)

conv

Convergence criterion

rho_init

Optional matrix of initial values for polychoric correlations

weights

Optional vector of sampling weights

maxK

Maximum number of categories

Value

A list with following entries

tau

Matrix of thresholds

rho

Polychoric correlation matrix

Nobs

Sample size for every item pair

maxcat

Maximum number of categories per item

References

Cox, D. R., & Wermuth, N. (1991). A simple approximation for bivariate and trivariate normal integrals. International Statistical Review, 59(2), 263-269.

Olsson, U. (1979). Maximum likelihood estimation of the polychoric correlation coefficient. Psychometrika, 44(4), 443-460. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1007/BF02296207")}

See Also

See the psych::polychoric function in the psych package.

For estimating tetrachoric correlations see tetrachoric2.

Examples

#############################################################################
# EXAMPLE 1: data.Students | activity scale
#############################################################################

data(data.Students, package="CDM")
dat <- data.Students[, paste0("act", 1:5 ) ]

# tetrachoric correlation from psych package
library(psych)
t0 <- psych::polychoric(dat)$rho
# Olsson method (maximum likelihood estimation)
t1 <- sirt::polychoric2(dat)$rho
# maximum absolute difference
max( abs( t0 - t1 ) )
  ##   [1] 0.004102429

sirt documentation built on May 29, 2024, 8:43 a.m.