RmyjuloR RmyjuloR - 1 month ago 18
R Question

Friedman test unreplicated complete block design error

I'm having trouble running a Friedman test over my data.
I'm trying to run a Friedman test using this command:

friedman.test(mean ~ isi | expId, data=monoSum)


On the following database (https://www.dropbox.com/s/2ox0y1b4gwld0ai/monoSum.csv):

> monoSum
expId isi N mean
1 m80B1 1 10 100.000000
2 m80B1 2 10 73.999819
3 m80B1 3 10 45.219362
4 m80B1 4 10 116.566174
. . . . .
18 m80L2 2 10 82.945491
19 m80L2 3 10 57.675480
20 m80L2 4 10 207.169277
. . . . . .
25 m80M2 1 10 100.000000
26 m80M2 2 10 49.752687
27 m80M2 3 10 19.042592
28 m80M2 4 10 150.411035


It gives me back the error:

Error in friedman.test.default(c(100, 73.9998193095267, 45.2193621626293, :
not an unreplicated complete block design


I figure it gives the error because, when
monoSum$isi==1
the value of mean is always 100. Is this correct?

However,
monoSum$isi==1
is alway 100 because it is the control group on which all the other
monoSum$isi
groups are normalized. I can not assume a normal distribution, so I cannot run a rmANOVA…
Is there a way to run a friedman test on this data or am I missing a very essential point here?

Many thanks in advance!

TJK TJK
Answer

I don't get an error if I run your dataset:

   Friedman rank sum test

   data:  mean and isi and expId
   Friedman chi-squared = 17.9143, df = 3, p-value = 0.0004581

However, you have to make sure that expId and isi are coded as factors. Run these commands:

    monoSum$expID$<-factor(monoSum$expID)
    monoSum$isi$<-factor(monoSum$isi)

Then run the test again. This has worked for me with a similar problem.