Implements to robust estimator of Welz, Mair and Alfons (2024, tools:::Rd_expr_doi("10.48550/arXiv.2407.18835")) for the polychoric correlation model, based on the general theory of C-estimation proposed by Welz (2024, tools:::Rd_expr_doi("10.48550/arXiv.2403.11954")).
polycor(
x,
y = NULL,
c = 0.6,
variance = TRUE,
constrained = "ifneeded",
method = NULL,
maxcor = 0.999,
tol_thresholds = 0.01,
init = initialize_param(x, y)
)An object of class "robpolycor", which is a list with the following components.
thetahatA vector of estimates for the polychoric correlation coefficient (rho) as well as thresholds for x (named a1,a2,...,a_{Kx-1}) and y (named b1,b2,...,b_{Ky-1}).
stderrA vector of standard errors for each estimate in thetahat.
vcovEstimated asymptotic covariance matrix of thetahat. The matrix \(\Sigma\) in the paper (asymptotic covariance matrix of \(\sqrt{N} \hat{\theta}\)) can be obtained via vcov * N, where N is the sample size.
chisq,pval,dfCurrently NULL, will in a future release be the test statistic, p-value, and degrees of freedom of a test for bivariate normality.
objectiveValue of minimized loss function.
optimObject of class optim.
Vector of integer-valued responses to first item, or contingency table (a "table" object).
Vector of integer-valued responses to second item; only required if x is not a contingency table.
Tuning constant that governs robustness; must be in [0, Inf]. Defaults to 0.6.
Shall an estimated asymptotic covariance matrix be returned? Default is TRUE.
Shall strict monotonicity of thresholds be explicitly enforced by linear constraints? This can be a logical (TRUE or FALSE), or "ifneeded" to first try unconstrained optimization and in case of an error perform constrained optimization. Default is "ifneeded".
Numerical optimization method, see optim() and constrOptim(). Default is to use "L-BFGS-B" in case of unconstrained optimization and "Nelder-Mead" in case of constrained optimization.
Maximum absolute correlation (to ensure numerical stability). Default is 0.999.
Minimum distance between consecutive thresholds (to enforce strict monotonicity); only relevant in case of constrained optimization. Default is 0.01.
Initialization of numerical optimization. Default is neutral.
## 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
Run the code above in your browser using DataLab