# [R] t-test or ANOVA...who wins? Help please!

Frodo Jedi frodo.jedi at yahoo.com
Wed Jan 5 12:55:00 CET 2011

```Dear Tal Galili,
thanks a lot for your answer! I agree with you, the t-test is comparing 2
conditions at one level of stimulus, while the ANOVA table is testing the
significance of the interaction between condition and stimuls....the two tests
are testing two different things.

But still I don´t understand which is the right way to perform the analysis in
order to solve my problem.

Let´s consider now only the table I posted before.
The same stimuli in the table have been presented to subjects in two conditions:
A and AH, where AH is the condition A plus something elese (let´s call it "H").
I want to know if AT GLOBAL  LEVEL adding "H" bring to better results in the
participants evaluations of the stimuli rather than the stimulus presented only
with condition "A".

Data in column "response" are evaluation on realism of the stimulus from a 7
point scale.

If I calculate the mean for each stmulus in each condition, the results show
that for each stimulus the AH condition is always greater than the first.
Anyway, doing a t-test to compare the stimuli by couple (es. flat_550_W_realism
in condition A,  flat_550_W_realism in condition AH) I get that only sometimes
the differences are statistically significant.  I ask you if there is a way to
say that condition AH is better than condition A, at global level.

In attachment you find the table in .txt and also in .csv format. Is it possible
for you to make an example in R, including also the R results
in order to tell me what to see in the console to see if my problem is solved or
not?

For example, I was checking in the anova results the stimulus:conditon
line.....but I don´t know if my anova analysis was correct or
not.

I am not an expert of R, nor of statistics ;-(
Anyway I am doing my best to study and understand.

Best regards

________________________________
From: Tal Galili <tal.galili at gmail.com>
To: Frodo Jedi <frodo.jedi at yahoo.com>
Cc: r-help at r-project.org
Sent: Wed, January 5, 2011 10:15:41 AM
Subject: Re: [R] t-test or ANOVA...who wins? Help please!

Hello Frodo,

It is not clear to me from your questions some of the basics of your analysis.

If you only have two levels of a factor, and one response - why in the anova do
you use more factors (and their interactions)?
In that sense, it is obvious that your results would differ from the t-test.

In either case, I am not sure if any of these methods are valid since your data
doesn't seem to be normal.
Here is an example code of how to get the same results from aov and t.test.  And
also a nonparametric option (that might be more fitting)

flat_550_W_realism =c(3,3,5,3,3,3,3,5,3,3,5,7,5,2,3)
flat_550_W_realism_AH =c(7,4,5,3,6,5,3,5,5,7,2,7,5, 5)

x <- c(rep(1, length(flat_550_W_realism)),
rep(2, length(flat_550_W_realism_AH)))

y <- c(flat_550_W_realism , flat_550_W_realism_AH)

# equal results between t test and anova
t.test(y ~ x, var.equal= T)
summary(aov(y ~ x))

# plotting the data:
boxplot(y ~ x) # group 1 is not at all symetrical...
wilcox.test(y ~ x) # a more fitting test

----------------Contact
Details:-------------------------------------------------------
Contact me: Tal.Galili at gmail.com |  972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------

On Wed, Jan 5, 2011 at 12:37 AM, Frodo Jedi <frodo.jedi at yahoo.com> wrote:

>I kindly ask you an help because I really don´t know how to solve this problem.
>

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: table_realism_wood.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110105/a5225f87/attachment.txt>
```