[R] Polychor() - why does it take that long?
John Fox
jfox at mcmaster.ca
Fri Dec 7 23:09:07 CET 2012
Dear Torvon,
First, the number of observations is pretty much irrelevant, since
polychoric correlations are computed from the contingency table for the
variables.
Second, it's not obvious to me what data[c(s1,s2)] might be since this is
not how one would normally call polychor(). That is, called with one
argument as you've done, that argument should be a contingency table.
Third, if you want to make the computation faster, you could forgo the ML
estimator for the quick two-step estimator: see ?polychor.
Finally, it's inconceivable to me that the computation should really take
20+ minutes, so I expect that there's an error in your command, but without
a reproducible example, one can only guess at what that error is. My guess:
data[c(s1,s2)] isn't a two-way contingency table.
I hope this helps,
John
-------------------------------------------------------
John Fox
Senator William McMaster Professor of Social Statistics
Department of Sociology
McMaster Univeristy
Hamilton, Ontario, Canada
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> On Behalf Of Torvon
> Sent: December-07-12 3:14 PM
> To: r-help at r-project.org
> Subject: [R] Polychor() - why does it take that long?
>
> Hello.
>
> Using the polychor function
> > polychor(data[c(s1,s2)] )
> for polychoric correlations of two ordinal variables in R takes a long
time for
> N=7000 (20 minutes+) and significantly slows down my computer.
>
> Now, I have a pretty old computer, but it takes about 20 seconds for MPLUS
> to print out the complete polychoric correlation matrix for all 16
variables,
> while I am running the R function only for 2 of the 16 variables.
>
> Why is that? Can that process be speeded up? What makes a polychoric
> correlation so much more computationally intensive than a pearson
> correlation?
>
> Thank you
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list