
Last chance! 50% off unlimited learning
Sale ends in
hetcor(data, ..., ML = FALSE)
## S3 method for class 'data.frame':
hetcor(data, ML = FALSE, use = c("complete.obs", "pairwise.complete.obs"), ...)
## S3 method for class 'default':
hetcor(data, ..., ML = FALSE)
## S3 method for class 'hetcor':
print(x, digits = max(3, getOption("digits") - 3), ...)
TRUE
compute maximum-likelihood estimates and their standard errors;
if FALSE
, compute quick two-step estimates."complete.obs"
, remove observations with any missing data;
if "pairwise.complete.obs"
, compute each correlation using all observations with
valid data for that pair of variables."hetcor"
to be printed."hetcor"
with the following components:"Pearson"
, "Polychoric"
, or "Polyserial"
."complete.obs"
or "pairwise.complete.obs"
.polychor
, polyserial
R <- matrix(0, 4, 4)
R[upper.tri(R)] <- runif(6)
diag(R) <- 1
R <- cov2cor(t(R) %*% R)
round(R, 4) # population correlations
data <- rmvnorm(1000, rep(0, 4), R)
round(cor(data), 4) # sample correlations
x1 <- data[,1]
x2 <- data[,2]
y1 <- cut(data[,3], c(-Inf, .75, Inf))
y2 <- cut(data[,4], c(-Inf, -1, .5, 1.5, Inf))
data <- data.frame(x1, x2, y1, y2)
hetcor(data) # Pearson, polychoric, and polyserial correlations, 2-step est.
hetcor(x1, x2, y1, y2, ML=TRUE) # Pearson, polychoric, polyserial correlations, ML est.
Run the code above in your browser using DataLab