polycor {robcat} | R Documentation |
Robust estimation of polychoric correlation
Description
Implements to robust estimator of Welz, Mair and Alfons (2024, doi:10.48550/arXiv.2407.18835) for the polychoric correlation model, based on the general theory of C-estimation proposed by Welz (2024, doi:10.48550/arXiv.2403.11954).
Usage
polycor(
x,
y = NULL,
c = 0.6,
variance = TRUE,
constrained = TRUE,
method = ifelse(constrained, "Nelder-Mead", "L-BFGS-B"),
maxcor = 0.999,
tol_thresholds = 0.01,
init = initialize_param(x, y)
)
Arguments
x |
Vector of integer-valued responses to first item, or contingency table (a |
y |
Vector of integer-valued responses to second item; only required if |
c |
Tuning constant that governs robustness; must be in |
variance |
Shall an estimated asymptotic covariance matrix be returned? Default is |
constrained |
Shall strict monotonicity of thresholds be explicitly enforced by linear constraints? Default is |
method |
Numerical optimization method. |
maxcor |
Maximum absolute correlation (to ensure numerical stability). Default is 0.999. |
tol_thresholds |
Minimum distance between consecutive thresholds (to enforce strict monotonicity); only relevant if |
init |
Initialization of numerical optimization. Default is neutral. |
Value
An object of class "robpolycor"
, which is a list with the following components.
theahat
A vector of estimates for the polychoric correlation coefficient (
rho
) as well as thresholds forx
(nameda1,a2,...,a_{Kx-1}
) andy
(namedb1,b2,...,b_{Ky-1}
).stderr
A vector of standard errors for each estimate in
theahat
.vcov
Estimated asymptotic covariance matrix of
theahat
. The matrix\Sigma
in the paper (asymptotic covariance matrix of\sqrt{N} \hat{\theta}
) can be obtained viavcov * N
, whereN
is the sample size.chisq,pval,df
Currently
NULL
, will in a future release be the test statistic, p-value, and degrees of freedom of a test for bivariate normality.objective
Value of minimized loss function.
optim
Object of class
optim
.
Examples
## example data
set.seed(123)
x <- sample(c(1,2,3), size = 100, replace = TRUE)
y <- sample(c(1,2,3), size = 100, replace = TRUE)
polycor(x,y) # robust
polycor_mle(x,y) # non-robust MLE