Re: [R] Correlation ratio

From: Scot W. McNary <smcnary_at_charm.net>
Date: Thu, 28 Jun 2007 01:55:12 -0400

Suman,

Try this:

# some data
example(aov)

# the summary table
anova(npk.aov)

# extract sums of squares
SS <- anova(npk.aov)$"Sum Sq"

SS
#[1] 343.2950000 189.2816667 8.4016667 95.2016667 21.2816667 33.1350000 0.4816667 185.2866667

# eta-squared for factor N
#SS factor N/SS Total
SS[2]/sum(SS)
#[1] 0.2159850

# partial eta-squared for factor N
# SS factor N/(SS Factor N + SS Residuals) SS[2]/(sum(SS[2],SS[8]))
#[1] 0.5053328

Hope this helps,

Scot

suman Duvvuru wrote:
> Hi Bruce,
> correlation ratio (eta) is different from correlation coefficient (rho).
> While correlation coefficient captures only a linear relationship btw
> variables, correlation ratio captures both linear and non-linear
> relationships. It is the defined as the ratio of the variance between
> arrays to the total variance.
>
> Thanks,
> Suman
>
>
> On 6/27/07, Bruce Willy <croero_at_hotmail.com> wrote:
>
>> hello
>>
>> try cor(x, y = NULL, use = "all.obs",
>> method = c("pearson", "kendall", "spearman"))
>>
>> in the R console, you can type "?cor" to get some help on a particular
>> function
>> and help.search("correlation") if you do know the keyword
>>
>>
>>> Date: Wed, 27 Jun 2007 18:00:05 -0400
>>> From: duvvuru.suman_at_gmail.com
>>> To: R-help_at_stat.math.ethz.ch
>>> Subject: [R] Correlation ratio
>>>
>>> Hi,
>>>
>>> I wanted to know how to compute the correlation ratio (eta) between two
>>> variables using R. Is there any function to compute the correlationratio.
>>>
>>> Any help will be very much appreciated.
>>>
>>> Thanks,
>>> Suman
>>>
>>>

-- 
Scot McNary
smcnary at charm dot net

______________________________________________
R-help_at_stat.math.ethz.ch 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.
Received on Thu 28 Jun 2007 - 06:02:07 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 28 Jun 2007 - 07:32:40 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.