[R] Help With ANOVA
Joris Meys
jorismeys at gmail.com
Tue Jul 6 19:18:43 CEST 2010
I still can't reproduce your example. The aov output gives me the following :
> anova(aov(Intensity ~ Group, data = zzzanova))
Analysis of Variance Table
Response: Intensity
Df Sum Sq Mean Sq F value Pr(>F)
Group 5 98.85 19.771 2.1469 0.07576 .
Residuals 48 442.03 9.209
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Next to that I noticed you have truncated data, which has implications
for the analysis as well. If you use a Kruskal-Wallis test, the
p-value becomes larger :
> kruskal.test(Intensity ~ Group, data = zzzanova)
Kruskal-Wallis rank sum test
data: Intensity by Group
Kruskal-Wallis chi-squared = 6.6955, df = 5, p-value = 0.2443
Which is to be expected, as you have almost 50% truncated data. So a
p-value of 0.005 seems very wrong to me.
Cheers
Joris
On Tue, Jul 6, 2010 at 7:11 PM, Amit Patel <amitrhelp at yahoo.co.uk> wrote:
> Hi Joris
>
> Sorry i had a misprint in the appendix code in the last email
>
> datalist <- c(-4.60517, -4.60517, -4.60517, -4.60517, -4.60517, -4.60517, -4.60517, 3.003749, -4.60517,
> 2.045314, 2.482557, -4.60517, -4.60517, -4.60517, -4.60517, 1.592743, -4.60517,
> -4.60517, 0.91328, -4.60517, -4.60517, 1.827744, 2.457795, 0.355075, -4.60517, 2.39127,
> 2.016987, 2.319903, 1.146683, -4.60517, -4.60517, -4.60517, 1.846162, -4.60517, 2.121427, 1.973118,
> -4.60517, 2.251568, -4.60517, 2.270724, 0.70338, 0.963816, -4.60517, 0.023703, -4.60517,
> 2.043382, 1.070586, 2.768289, 1.085169, 0.959334, -0.02428, -4.60517, 1.371895, 1.533227)
>
> "zzzanova" <-
> structure(list(Intensity = datalist,
> Group = structure(c(1,1,1,1,1,1,1,1,1,
> 2,2,2,2,2,2,2,2,
> 3,3,3,3,3,3,3,3,3,
> 4,4,4,4,4,4,4,4,4,4,
> 5,5,5,5,5,5,5,5,5,
> 6,6,6,6,6,6,6,6,6), .Label = c("Group1", "Group2", "Group3", "Group4", "Group5", "Group6"), class = "factor"),
> Sample = structure(c( 1, 2, 3, 4, 5, 6, 7, 8, 9,
> 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
> 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
> 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,41,42,43,44,45,46,47,48,49,50,51,52,53,54)
> ))
> , .Names = c("Intensity",
> "Group", "Sample"), row.names =
> c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
> "11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
> "21", "22", "23", "24", "25", "26", "27", "28", "29", "30",
> "31", "32", "33", "34", "35", "36", "37", "38", "39", "40",
> "41", "42", "43", "44", "45", "46", "47", "48", "49", "50",
> "51", "52", "53", "54"),class = "data.frame")
>
>
> Thanks for your reply
>
>
>
>
>
> ----- Original Message ----
> From: Joris Meys <jorismeys at gmail.com>
> To: Amit Patel <amitrhelp at yahoo.co.uk>
> Cc: r-help at r-project.org
> Sent: Tue, 6 July, 2010 17:04:40
> Subject: Re: [R] Help With ANOVA
>
> We're missing the samp1 etc. in order to be able to test the code.
> Where did you get the other p-value?
> Cheers
> Joris
>
> On Tue, Jul 6, 2010 at 3:08 PM, Amit Patel <amitrhelp at yahoo.co.uk> wrote:
>> Hi I needed some help with ANOVA
>>
>> I have a problem with My ANOVA
>> analysis. I have a dataset with a known ANOVA p-value, however I can
>> not seem to re-create it in R.
>>
>> I have created a list (zzzanova) which contains
>> 1)Intensity Values
>> 2)Group Number (6 Different Groups)
>> 3)Sample Number (54 different samples)
>> this is created by the script in Appendix 1
>>
>> I then conduct ANOVA with the command
>>> zzz.aov <- aov(Intensity ~ Group, data = zzzanova)
>>
>> I get a p-value of
>> Pr(>F)1
>> 0.9483218
>>
>> The
>> expected p-value is 0.00490 so I feel I maybe using ANOVA incorrectly
>> or have put in a wrong formula. I am trying to do an ANOVA analysis
>> across all 6 Groups. Is there something wrong with my formula. But I think I
>> have made a mistake in the formula rather than anything else.
>>
>>
>>
>>
>> APPENDIX 1
>>
>> datalist <- c(-4.60517, -4.60517, -4.60517, -4.60517, -4.60517, -4.60517, -4.60517, 3.003749, -4.60517,
>> 2.045314, 2.482557, -4.60517, -4.60517, -4.60517, -4.60517, 1.592743, -4.60517,
>> -4.60517, 0.91328, -4.60517, -4.60517, 1.827744, 2.457795, 0.355075, -4.60517, 2.39127,
>> 2.016987, 2.319903, 1.146683, -4.60517, -4.60517, -4.60517, 1.846162, -4.60517, 2.121427, 1.973118,
>> -4.60517, 2.251568, -4.60517, 2.270724, 0.70338, 0.963816, -4.60517, 0.023703, -4.60517,
>> 2.043382, 1.070586, 2.768289, 1.085169, 0.959334, -0.02428, -4.60517, 1.371895, 1.533227)
>>
>> "zzzanova" <-
>> structure(list(Intensity = c(t(Samp1), t(Samp2), t(Samp3), t(Samp4)),
>> Group = structure(c(1,1,1,1,1,1,1,1,1,
>> 2,2,2,2,2,2,2,2,
>> 3,3,3,3,3,3,3,3,3,
>> 4,4,4,4,4,4,4,4,4,4,
>> 5,5,5,5,5,5,5,5,5,
>> 6,6,6,6,6,6,6,6,6), .Label = c("Group1", "Group2", "Group3", "Group4", "Group5", "Group6"), class = "factor"),
>> Sample = structure(c( 1, 2, 3, 4, 5, 6, 7, 8, 9,
>> 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
>> 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
>> 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,41,42,43,44,45,46,47,48,49,50,51,52,53,54)
>> ))
>> , .Names = c("Intensity",
>> "Group", "Sample"), row.names =
>> c("1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
>> "11", "12", "13", "14", "15", "16", "17", "18", "19", "20",
>> "21", "22", "23", "24", "25", "26", "27", "28", "29", "30",
>> "31", "32", "33", "34", "35", "36", "37", "38", "39", "40",
>> "41", "42", "43", "44", "45", "46", "47", "48", "49", "50",
>> "51", "52", "53", "54"),class = "data.frame")
>>
>>
>>
>>
>> ______________________________________________
>> R-help at r-project.org 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.
>>
>
>
>
> --
> Joris Meys
> Statistical consultant
>
> Ghent University
> Faculty of Bioscience Engineering
> Department of Applied mathematics, biometrics and process control
>
> tel : +32 9 264 59 87
> Joris.Meys at Ugent.be
> -------------------------------
> Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
>
>
>
>
>
--
Joris Meys
Statistical consultant
Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control
tel : +32 9 264 59 87
Joris.Meys at Ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
More information about the R-help
mailing list