[R] Interpreting the results of Friedman test

Peter Dalgaard P.Dalgaard at biostat.ku.dk
Fri Apr 24 17:21:51 CEST 2009


Doerte wrote:
>> Anyways, Friedman's test is a replacement for a two-way ANOVA and you
>> are comparing it to a one-way analysis, and the latter is likely just wrong.
> 
> Okay. Thanks for the hint.
> 
>> Try
>>
>> anova(lm(AUC~as.factor(Condition)+as.factor(Observer),data=dataForANOVA))
> 
> This results in p-value = 0.37969. This value is still quite different
> from p-value = 1.913e-06, which is the result of friedman.test
> (as.matrix(dataForFriedman)).


If you had read ALL that I wrote, then you would have seen this:

> summary(aov(AUC ~ as.factor(Condition) + Error(as.factor(Observer) /
+ as.factor(Condition)),  data=dataForANOVA))

Error: as.factor(Observer)
          Df    Sum Sq   Mean Sq F value Pr(>F)
Residuals  6 0.0066907 0.0011151

Error: as.factor(Observer):as.factor(Condition)
                     Df   Sum Sq  Mean Sq F value    Pr(>F)
as.factor(Condition)  3 0.275825 0.091942  405.23 < 2.2e-16 ***
Residuals            18 0.004084 0.000227
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Error: Within
          Df Sum Sq Mean Sq F value Pr(>F)
Residuals 56 6.5337  0.1167


I.e. the thing that is going on is that the Observer:Condition
interaction is incredibly small (0.000227) compared to the replication
variation (0.1167), or put differently that you seem to have strong
negative correlation between replicates. This can happen if you have
things like plants growing in the same pot, but you need to consider
what could be happening in your case.

Looking at the table of means

> with(dataForANOVA,tapply(AUC,list(Observer,Condition),mean))
         1        2        3        4
1 11.55841 11.51786 11.43727 11.59314
2 11.55448 11.51013 11.42099 11.56479
3 11.55994 11.49924 11.44884 11.57226
4 11.55410 11.51704 11.42321 11.58310
6 11.52043 11.48902 11.40812 11.56951
7 11.55013 11.51438 11.42279 11.57906
8 11.53763 11.50768 11.41197 11.57795

this is essentially the same as your dataForFriedman and it is pretty
clear that the 3rd column is substantially below the others, which is
what the Friedman test and also the F value of 405.23 above is picking
up on.


> 
> Is the method friedman.test (version R 2.9.0) working correctly for
> certain types of data and hypotheses? Which limitations are known?
> 
> @ Jim: Thanks for the link.
> Unfortunately, I'm a newbie in statistics, and I'm not sure, which
> method can be used instead of the Friedman Test. Do you have an eye on
> a certain R-program from this given website?
> 
> Doerte
> 
> ______________________________________________
> 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.


-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907




More information about the R-help mailing list