Entering edit mode
8.8 years ago
maahpishanu
•
0
I'm very new in the field I'm working now and have a simple question:
If I'm given such following data:
conds <- rep(c("old","young","kid"),each=9)
measures <- rep(rep(c("weight","height","heartbeats"),each=3),3)
values <- c(sample(50:100,9),sample(150:190,9),sample(60:120,9),
sample(50:110,9),sample(150:200,9),sample(60:120,9),
sample(5:50,9),sample(50:150,9),sample(60:100,9))
d <- data.frame(measures,conds,values)
How can I do test the differences between old vs young, old vs kid and kid vs young considering all other measures together?
These are two ways I used to find the differences between each pairs of old-young-kid based on the observed measures but I think non of these are correct:
aov.out = aov(values ~ conds , data=d)
summary(aov.out)
Df Sum Sq Mean Sq F value Pr(>F)
conds 2 14515 7257 3.643 0.0415 *
Residuals 24 47811 1992
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(aov.out)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = values ~ conds, data = d)
$conds
diff lwr upr p adj
old-kid 47.000000 -5.543622 99.54362 0.0856646
young-kid 51.111111 -1.432511 103.65473 0.0576516
young-old 4.111111 -48.432511 56.65473 0.9791911
I decided to reorder my data and find the differences in the following way:
conds <- rep(c("old","young","kid"),each=3)
w <- values[c(1:3,10:12,19:21)]
h <- values[c(4:6,13:15,22:24)]
hb <- values[c(7:9,16:18,25:27)]
d <- data.frame(conds,w,h,hb)
av.out <- aov(w*h*hb~conds,d)
summary(av.out)
Df Sum Sq Mean Sq F value Pr(>F)
conds 2 3.075e+12 1.537e+12 13.4 0.00612 **
Residuals 6 6.885e+11 1.147e+11
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
TukeyHSD(av.out)
Tukey multiple comparisons of means
95% family-wise confidence level
Fit: aov(formula = w * h * hb ~ conds, data = d)
$conds
diff lwr upr p adj
old-kid 1172527 323913 2021141 0.0128705
young-kid 1297829 449215 2146443 0.0079956
young-old 125302 -723312 973916 0.8949227
Would you let me know which is correct? if none of them are correct then how could I find the differences?
Thanks,
Maah