Dear all,

I need an help because I don´t know how to perform the analysis in the right 
way, as I get different beheaviors using t-test and two ways ANOVA.
In what follow I post the table, my goal and the strange results I got. 

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

So the table is this:

number                  stimulus condition response
1             flat_550_W_realism         A        3
2             flat_550_W_realism         A        3
3             flat_550_W_realism         A        5
4             flat_550_W_realism         A        3
5             flat_550_W_realism         A        3
6             flat_550_W_realism         A        3
7             flat_550_W_realism         A        3
8             flat_550_W_realism         A        5
9             flat_550_W_realism         A        3
10            flat_550_W_realism         A        3
11            flat_550_W_realism         A        5
12            flat_550_W_realism         A        7
13            flat_550_W_realism         A        5
14            flat_550_W_realism         A        2
15            flat_550_W_realism         A        3
16            flat_550_W_realism        AH        7
17            flat_550_W_realism        AH        4
18            flat_550_W_realism        AH        5
19            flat_550_W_realism        AH        3
20            flat_550_W_realism        AH        6
21            flat_550_W_realism        AH        5
22            flat_550_W_realism        AH        3
23            flat_550_W_realism        AH        5
24            flat_550_W_realism        AH        5
25            flat_550_W_realism        AH        7
26            flat_550_W_realism        AH        2
27            flat_550_W_realism        AH        7
28            flat_550_W_realism        AH        5
29            flat_550_W_realism        AH        5
30         bump_2_step_W_realism         A        1
31         bump_2_step_W_realism         A        3
32         bump_2_step_W_realism         A        5
33         bump_2_step_W_realism         A        1
34         bump_2_step_W_realism         A        3
35         bump_2_step_W_realism         A        2
36         bump_2_step_W_realism         A        5
37         bump_2_step_W_realism         A        4
38         bump_2_step_W_realism         A        4
39         bump_2_step_W_realism         A        4
40         bump_2_step_W_realism         A        4
41         bump_2_step_W_realism        AH        3
42         bump_2_step_W_realism        AH        5
43         bump_2_step_W_realism        AH        1
44         bump_2_step_W_realism        AH        5
45         bump_2_step_W_realism        AH        4
46         bump_2_step_W_realism        AH        4
47         bump_2_step_W_realism        AH        5
48         bump_2_step_W_realism        AH        4
49         bump_2_step_W_realism        AH        3
50         bump_2_step_W_realism        AH        4
51         bump_2_step_W_realism        AH        5
52         bump_2_step_W_realism        AH        4
53         hole_2_step_W_realism         A        3
54         hole_2_step_W_realism         A        3
55         hole_2_step_W_realism         A        4
56         hole_2_step_W_realism         A        1
57         hole_2_step_W_realism         A        4
58         hole_2_step_W_realism         A        3
59         hole_2_step_W_realism         A        5
60         hole_2_step_W_realism         A        4
61         hole_2_step_W_realism         A        3
62         hole_2_step_W_realism         A        4
63         hole_2_step_W_realism         A        7
64         hole_2_step_W_realism         A        5
65         hole_2_step_W_realism         A        1
66         hole_2_step_W_realism         A        4
67         hole_2_step_W_realism        AH        7
68         hole_2_step_W_realism        AH        5
69         hole_2_step_W_realism        AH        5
70         hole_2_step_W_realism        AH        1
71         hole_2_step_W_realism        AH        5
72         hole_2_step_W_realism        AH        5
73         hole_2_step_W_realism        AH        5
74         hole_2_step_W_realism        AH        2
75         hole_2_step_W_realism        AH        6
76         hole_2_step_W_realism        AH        5
77         hole_2_step_W_realism        AH        5
78         hole_2_step_W_realism        AH        6
79     bump_2_heel_toe_W_realism         A        3
80     bump_2_heel_toe_W_realism         A        3
81     bump_2_heel_toe_W_realism         A        3
82     bump_2_heel_toe_W_realism         A        2
83     bump_2_heel_toe_W_realism         A        3
84     bump_2_heel_toe_W_realism         A        3
85     bump_2_heel_toe_W_realism         A        4
86     bump_2_heel_toe_W_realism         A        3
87     bump_2_heel_toe_W_realism         A        4
88     bump_2_heel_toe_W_realism         A        4
89     bump_2_heel_toe_W_realism         A        6
90     bump_2_heel_toe_W_realism         A        5
91     bump_2_heel_toe_W_realism         A        4
92     bump_2_heel_toe_W_realism        AH        7
93     bump_2_heel_toe_W_realism        AH        3
94     bump_2_heel_toe_W_realism        AH        4
95     bump_2_heel_toe_W_realism        AH        2
96     bump_2_heel_toe_W_realism        AH        5
97     bump_2_heel_toe_W_realism        AH        6
98     bump_2_heel_toe_W_realism        AH        4
99     bump_2_heel_toe_W_realism        AH        4
100    bump_2_heel_toe_W_realism        AH        4
101    bump_2_heel_toe_W_realism        AH        5
102    bump_2_heel_toe_W_realism        AH        2
103    bump_2_heel_toe_W_realism        AH        6
104    bump_2_heel_toe_W_realism        AH        5
105    hole_2_heel_toe_W_realism         A        3
106    hole_2_heel_toe_W_realism         A        3
107    hole_2_heel_toe_W_realism         A        1
108    hole_2_heel_toe_W_realism         A        3
109    hole_2_heel_toe_W_realism         A        3
110    hole_2_heel_toe_W_realism         A        5
111    hole_2_heel_toe_W_realism         A        2
112    hole_2_heel_toe_W_realism        AH        5
113    hole_2_heel_toe_W_realism        AH        1
114    hole_2_heel_toe_W_realism        AH        3
115    hole_2_heel_toe_W_realism        AH        6
116    hole_2_heel_toe_W_realism        AH        5
117    hole_2_heel_toe_W_realism        AH        4
118    hole_2_heel_toe_W_realism        AH        4
119    hole_2_heel_toe_W_realism        AH        3
120    hole_2_heel_toe_W_realism        AH        3
121    hole_2_heel_toe_W_realism        AH        1
122    hole_2_heel_toe_W_realism        AH        5
123 bump_2_combination_W_realism         A        4
124 bump_2_combination_W_realism         A        2
125 bump_2_combination_W_realism         A        4
126 bump_2_combination_W_realism         A        1
127 bump_2_combination_W_realism         A        4
128 bump_2_combination_W_realism         A        4
129 bump_2_combination_W_realism         A        2
130 bump_2_combination_W_realism         A        4
131 bump_2_combination_W_realism         A        2
132 bump_2_combination_W_realism         A        4
133 bump_2_combination_W_realism         A        2
134 bump_2_combination_W_realism         A        6
135 bump_2_combination_W_realism        AH        7
136 bump_2_combination_W_realism        AH        3
137 bump_2_combination_W_realism        AH        4
138 bump_2_combination_W_realism        AH        1
139 bump_2_combination_W_realism        AH        6
140 bump_2_combination_W_realism        AH        5
141 bump_2_combination_W_realism        AH        5
142 bump_2_combination_W_realism        AH        6
143 bump_2_combination_W_realism        AH        5
144 bump_2_combination_W_realism        AH        4
145 bump_2_combination_W_realism        AH        2
146 bump_2_combination_W_realism        AH        4
147 bump_2_combination_W_realism        AH        2
148 bump_2_combination_W_realism        AH        5
149 hole_2_combination_W_realism         A        5
150 hole_2_combination_W_realism         A        2
151 hole_2_combination_W_realism         A        4
152 hole_2_combination_W_realism         A        1
153 hole_2_combination_W_realism         A        5
154 hole_2_combination_W_realism         A        4
155 hole_2_combination_W_realism         A        3
156 hole_2_combination_W_realism         A        5
157 hole_2_combination_W_realism         A        2
158 hole_2_combination_W_realism         A        5
159 hole_2_combination_W_realism         A        5
160 hole_2_combination_W_realism         A        1
161 hole_2_combination_W_realism        AH        7
162 hole_2_combination_W_realism        AH        5
163 hole_2_combination_W_realism        AH        3
164 hole_2_combination_W_realism        AH        1
165 hole_2_combination_W_realism        AH        6
166 hole_2_combination_W_realism        AH        4
167 hole_2_combination_W_realism        AH        7
168 hole_2_combination_W_realism        AH        5
169 hole_2_combination_W_realism        AH        5
170 hole_2_combination_W_realism        AH        2
171 hole_2_combination_W_realism        AH        6
172 hole_2_combination_W_realism        AH        2
173 hole_2_combination_W_realism        AH        4




My goal is to understand if condition AH is better than  condition A (i.e. if 
there is statistical significance between the  evaluation of stimuli presented 
in condition A and AH). 

The same stimuli 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 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.)



Here my analysis:

I did a t-test between the same stimulus in condition A and in condition  AH, 
and the result is that there is significant difference.
Instead in the 2 ways anova we see that there is no significant difference in 
the interaction stimulus:condition.

Why this happen? Where is the error?

I report the data and the analysis so you can see:

1) t-test:

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)


#First I check homeschedaicity:

> var.test(flat_550_W_realism,flat_550_W_realism_AH)

F test to compare two variances

data: flat_550_W_realism and flat_550_W_realism_AH
F = 0.7486, num df = 14, denom df = 13, p-value = 0.597
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
0.2428979 2.2546308
sample estimates:
ratio of variances
0.7485758

p-value greather than 0.05 so in the t-test I put the option var.equal=TRUE:

> t.test(flat_550_W_realism,flat_550_W_realism_AH, var.equal=TRUE)

Two Sample t-test

data: flat_550_W_realism and flat_550_W_realism_AH
t = -2.2361, df = 27, p-value = 0.03381
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
-2.29198603 -0.09849016
sample estimates:
mean of x mean of y
3.733333 4.928571


Now we have a significative difference between these two stimuli (p-value = 
0.03381)


2) Now I put the results of the ANOVA (2 ways):

fit1<- lm(response ~ stimulus + condition + stimulus:condition, data=scrd) 
#model with interaction
> summary(fit1)

Call:
lm(formula = response ~ stimulus + condition + stimulus:condition,
data = scrd)

Residuals:
Min 1Q Median 3Q Max
-3.7500 -0.7333 0.1429 1.0714 3.3571

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 3.25000 0.43598 7.455 5.47e-12 ***
stimulusbump_2_heel_toe_W_realism 0.36538 0.60459 0.604 0.546
stimulusbump_2_step_W_realism 0.02273 0.63042 0.036 0.971
stimulusflat_550_W_realism 0.48333 0.58492 0.826 0.410
stimulushole_2_combination_W_realism 0.25000 0.61656 0.405 0.686
stimulushole_2_heel_toe_W_realism -0.39286 0.71828 -0.547 0.585
stimulushole_2_step_W_realism 0.39286 0.59414 0.661 0.509
conditionAH 0.96429 0.59414 1.623 0.107
stimulusbump_2_heel_toe_W_realism:conditionAH -0.19505 0.83899 -0.232 0.816
stimulusbump_2_step_W_realism:conditionAH -0.32035 0.86627 -0.370 0.712
stimulusflat_550_W_realism:conditionAH 0.23095 0.81730 0.283 0.778
stimulushole_2_combination_W_realism:conditionAH -0.07967 0.84766 -0.094 0.925
stimulushole_2_heel_toe_W_realism:conditionAH -0.18506 0.94138 -0.197 0.844
stimulushole_2_step_W_realism:conditionAH 0.14286 0.84024 0.170 0.865
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.51 on 159 degrees of freedom
Multiple R-squared: 0.1276, Adjusted R-squared: 0.05625
F-statistic: 1.789 on 13 and 159 DF, p-value: 0.04895

> anova(fit1, test='Chisq') #show factors with significance tests
Analysis of Variance Table

Response: response
Df Sum Sq Mean Sq F value Pr(>F)
stimulus 6 15.05 2.509 1.1000 0.3647
condition 1 36.51 36.515 16.0089 9.64e-05 ***
stimulus:condition 6 1.47 0.244 0.1071 0.9955
Residuals 159 362.67 2.281
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1



Here you can notice that the pvalue for stimulus:condition (and therefore 
also for the stimulus flat_550_W_realism in the 2 conditions A and AH) is 
0.9955, 

so this time the difference is not significative.



Now, could someone explain me this beheaviour? I really do not understand. Do I 
have to believe to
ANOVA or to t-test? Help!!!





Which kind of analysis can I do?..and how can I interpret the results in the 
right way? 
Is there anyone that can show me how to conduct the analysis with R?



Thanks in advance


      
	[[alternative HTML version deleted]]

