Learn R Programming

sirt (version 3.4-64)

polychoric2: 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=TRUE, 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

Logical indicating whether the pbv package is used for computation of bivariate normal distribution

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

Olsson, U. (1979). Maximum likelihood estimation of the polychoric correlation coefficient. Psychometrika, 44, 443-460.

See Also

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

For estimating tetrachoric correlations see tetrachoric2.

Examples

Run this code
# NOT RUN {
#############################################################################
# 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
# }

Run the code above in your browser using DataLab