estserial: Polyserial Correlation

Description Usage Arguments Examples

View source: R/estserial.R

Description

Using iterative regression method to estimate the polyserial correlation between a quantitative variable and an ordinal variables, based on the assumption that the joint distribution of the quantitative variable and a latent continuous variable underlying the ordinal variable is bivariate normal.

Usage

1
estserial(x, y)

Arguments

x

an ordered categorical variable; can be numeric, logical, a factor, or an ordered factor, but if a factor, its levels should be in proper order.

y

a numerical variable.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
if(require(mvtnorm)){
    set.seed(12345)
    data <- rmvnorm(1000, c(0, 0), matrix(c(1, .5, .5, 1), 2, 2))
    x <- data[,1]
    y <- data[,2]
    cor(x, y)  # sample correlation
    }
if(require(mvtnorm)){
    x <- cut(x, c(-Inf, -1, .5, 1.5, Inf))
    estserial(x, y)  # 2-step estimate
    }

panjj1125/IRME documentation built on Nov. 4, 2019, 11:18 p.m.