ps2pps: Computation of the Point-Polyserial Correlation from the...

View source: R/ps2pps.R

ps2ppsR Documentation

Computation of the Point-Polyserial Correlation from the Polyserial Correlation

Description

This function computes the point-polyserial correlation between two variables after one of the variables is ordinalized given the correlation before ordinalization (polyserial correlation) as seen in Demirtas and Hedeker (2016). Before computation of the point-polyserial correlation, the specified polyserial correlation is compared to the lower and upper correlation bounds of the two continuous variables using the generate, sort and correlate (GSC) algorithm in Demirtas and Hedeker (2011).

Usage

ps2pps(ps, ord.var, cont.var, cats, p=NULL, cutpoint=NULL)

Arguments

ps

The polyserial correlation.

ord.var

A numeric vector of the continuous variable before ordinalization.

cont.var

A numeric vector of the the continuous variable that is not transformed.

cats

A numeric vector of the categories in the ordinalization of ord.var.

p

A numeric vector of the marginal probabilities corresponding to each category in cats. The marginal probabilities must sum to 1. Either p or cutpoint should be specified.

cutpoint

A numeric vector of the cutpoints used to define the categories in cats. Either p or cutpoint should be specified.

Value

The point-polyserial correlation.

References

Demirtas, H. and Hedeker, D. (2011). A practical way for computing approximate lower and upper correlation bounds. The American Statistician, 65(2), 104-109.

Demirtas, H. and Hedeker, D. (2016). Computing the point-biserial correlation under any underlying continuous distribution. Communications in Statistics-Simulation and Computation, 45(8), 2744-2751.

See Also

ordY, mps2cps

Examples

set.seed(234)
y1<-rweibull(n=100000, scale=1, shape=25)

gaussmix <- function(n,m1,m2,s1,s2,pi) {
  I <- runif(n)<pi
  rnorm(n,mean=ifelse(I,m1,m2),sd=ifelse(I,s1,s2))
}
y2<-gaussmix(n=100000, m1=0, s1=1, m2=2, s2=1, pi=0.5)

ps2pps(ps=0.6, ord.var=y1, cont.var=y2, cats=c(1,2,3,4), p=c(0.4, 0.3, 0.2, 0.1))
ps2pps(ps=0.6, ord.var=y1, cont.var=y2, cats=c(1,2,3,4), cutpoint=c(0.97341, 1.00750, 1.03421))

CorrToolBox documentation built on March 18, 2022, 7:11 p.m.