[R] tetrachoric correlations
(Ted Harding)
Ted.Harding at manchester.ac.uk
Sun Apr 4 17:26:03 CEST 2010
This is in response to a query (copied below) from Hakan Demirtas.
Since I did not keep the original, I am taking it from the archives.
Therefore this may initiate a new thread ... :-(
There has been one response so far, which gave no help.
On Fri, Apr 2, 2010 at 7:25 PM, HAKAN DEMIRTAS <demirtas at uic.edu> wrote:
> Hi,
> Is there any R library/package that calculates tetrachoric
> correlations from given marginals and Pearson correlations
> among ordinal variables?
>
> Inputs to polychor function in polycor package are either
> contingency tables or ordinal data themselves. I am looking
> for something that takes marginal distributions and Pearson
> correlation as inputs.
>
> For example, Y1=(1,2,3) with P(Y1=1)=0.3, P(Y1=2)=0.5, P(Y1=3)=0.2
> and Y2=(1,2) with P(Y2=1)=0.6, P(Y2=2)=0.4, and corr(Y1,Y2)=0.5
> (Pearson correlation among ordinal variables)
>
> How do I calculate the tetrachoric correlation here?
>
> Thanks,
> Hakan Demirtas
First, there is some imprecision in the query! Tetrachoric correlation
refers to 2x2 tables, whereas your example is 3x2, so polychoric
correlation would be appropriate.
Searching the R site on
pearson tetrachoric
returns one useful hit, the function phitopoly in the 'psych' package:
http://finzi.psych.upenn.edu/R/library/psych/html/phi2poly.html
phi2poly {psych} R Documentation
Convert a phi coefficient to a polychoric correlation
Description
Given a phi coefficient (a Pearson r calculated on two
dichotomous variables), and the marginal frequencies
(in percentages), what is the corresponding estimate of
the polychoric correlation?
Given a two x two table of counts
a b
c d
The phi coefficient is
(a - (a+b)*(a+c))/sqrt((a+b)(a+c)(b+d)(c+c)).
This function reproduces the cell entries for specified marginals
and then calls John Fox's polychor function.
Usage
phi2poly(ph, cp, cc)
Arguments
ph phi
cp probability of the predictor -- the so called selection
ratio
cc probability of the criterion -- the so called success rate.
Note that this function specifies "two dichotomous variables",
otherwise speaking a 2x2 situation. Hence, given the marginal
probabilities and the Pearson correlation for a 2x2 table, this
function will calculate the tetrachoric (= 2x2 polychoric)
correlation. This is possible because, given the marginals,
there is only one degree of freedom remaining, and the value
of the Pearson coefficient then serves to determine the table
of probabilities in full.
Second, note that this well not be the case for a general rxc
table and, in particular, for your 3x2 example. Given the marginal
probabilities, there will be 2 degrees of freedom remaining,
and the additional information that the Pearson correlation
between Y1 and Y2 has a particular value still leaves one degree
of freeom. So your question does not have a determinate answer
in the 2x3 (or higher) case. You would need to use additional
information.
Indeed, an R site search on
pearson polychoric
seems to give no relevant results.
Hoping this helps,
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 04-Apr-10 Time: 16:25:58
------------------------------ XFMail ------------------------------
More information about the R-help
mailing list