This function computes a polychoric correlation matrix, which is the estimated Pearson product-moment correlation matrix between underlying normally distributed latent variables which generate the ordinal scores.
cor.poly(x, smooth = TRUE, global = TRUE, weight = NULL, correct = 0,
progress = TRUE, na.rm = TRUE, delete = TRUE,
tri = c("both", "lower", "upper"), digits = 2, as.na = NULL,
check = TRUE, output = TRUE)
a matrix or data frame of discrete values.
logical: if TRUE
and if the polychoric matrix is not positive definite,
a simple smoothing algorithm using cor.smooth()
function is applied.
logical: if TRUE
, the global values of the tau parameter is used instead of the local values.
a vector of length of the number of observations that specifies the weights to apply to each case.
The NULL
case is equivalent of weights of 1 for all cases.
a numeric value indicating the correction value to use to correct for continuity in the case
of zero entry. Note that unlike in the polychoric()
function in the psych the default
value is 0.
logical: if TRUE
, the progress bar is shown.
logical: if TRUE
, missing data are deleted.
logical: if TRUE
, cases with no variance are deleted with a warning before proceeding.
a character string indicating which triangular of the matrix to show on the console, i.e.,
both
for upper and lower triangular, lower
(default) for the lower triangular,
and upper
for the upper triangular.
an integer value indicating the number of decimal places to be used for displaying correlation coefficients.
a numeric vector indicating user-defined missing values,
i.e. these values are converted to NA
before conducting the analysis.
logical: if TRUE
, argument specification is checked.
logical: if TRUE
, output is shown on the console.
Returns an object of class misty.object
, which is a list with following entries:
function call (call
), type of analysis type
, matrix or data frame specified in
x
(data
), specification of function arguments (args
), and
list with results (result
).
Revelle, W. (2018) psych: Procedures for personality and psychological research. Northwestern University, Evanston, Illinois, USA, https://CRAN.R-project.org/package=psych Version = 1.8.12.
# NOT RUN {
dat <- data.frame(x1 = c(1, 1, 3, 2, 1, 2, 3, 2, 3, 1),
x2 = c(1, 2, 1, 1, 2, 2, 2, 1, 3, 1),
x3 = c(1, 3, 2, 3, 3, 1, 3, 2, 1, 2))
# Polychoric correlation matrix
cor.poly(dat)
# }
Run the code above in your browser using DataLab