-
-
Notifications
You must be signed in to change notification settings - Fork 57
polychoric correlation method yields error #347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
bug 🐛
Something isn't working
Comments
That is a weird error... For now, the fix would be to convert the input data to an ordered factor: dat <- c(1, 1, 1, 1, 0,
1, 1, 1, 2, 1,
1, 2, 1, 2, 0,
1, 1, 0, 2, 0,
2, 2, 2, 2, 1,
1, 1, 2, 2, 1,
1, 0, 0, 0, 1,
1, 1, 0, 1, 1,
1, 1, 1, 1, 0,
1, 1, 1, 1, 1)
df <- data.frame(matrix(dat,ncol=5, byrow=T))
# Convert all columbs to ordered factors:
df[] <- lapply(df, ordered)
correlation::correlation(df, method = "polychoric")
#> # Correlation Matrix (polychoric-method)
#>
#> Parameter1 | Parameter2 | rho | 95% CI | t(8) | p
#> -----------------------------------------------------------------------
#> X1 | X2 | 0.24 | [-0.46, 0.75] | 0.69 | > .999
#> X1 | X3 | 0.37 | [-0.34, 0.81] | 1.13 | > .999
#> X1 | X4 | -0.03 | [-0.65, 0.61] | -0.08 | > .999
#> X1 | X5 | 0.98 | [ 0.92, 1.00] | 13.99 | < .001***
#> X2 | X3 | 0.77 | [ 0.26, 0.94] | 3.36 | 0.079
#> X2 | X4 | 1.00 | [ 1.00, 1.00] | 312.31 | < .001***
#> X2 | X5 | -0.13 | [-0.70, 0.54] | -0.37 | > .999
#> X3 | X4 | 0.69 | [ 0.11, 0.92] | 2.70 | 0.189
#> X3 | X5 | 0.11 | [-0.56, 0.69] | 0.30 | > .999
#> X4 | X5 | 9.15e-03 | [-0.62, 0.64] | 0.03 | > .999
#>
#> p-value adjustment method: Holm (1979)
#> Observations: 10 Created on 2025-04-18 with reprex v2.1.1 |
8000
Little OT: Why are most of the p-Values >.999 when rho clearly is not 0? |
Due to the large confidence intervals |
Sorry, haven't noticed p_adjust = 'holm'. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I have ordinal data and want to estimate a polychoric correlation matrix (and export to Excel). However, when I submit my data to the procedure with
method="polychoric"
i get:The text was updated successfully, but these errors were encountered: