# 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!

## Answers

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.

I know this is pretty old but for future generations (see also: me when I forget and google this again):

You can determine what the missing values are in your dataframe by running table(groups, blocks) or in the case of this question table(monoSum$isi, monoSum$expID). This will return a table of 0s and 1s. This missing records are in the the cells with 0s.

I ran into this problem after trying to remove the blocks that had incomplete results; taking a subset of the data did not remove the blocks for some reason.

Just thought I would mention I found this post because I was getting a similar error message. The above suggestions did not solve it. Strangely, I had to sort my dataframe so that block by block the groups appeared in order (i.e. I could not have the following: Block 1 A Block 1 B Block 2 B Block 2 A

It has to appear as A, B, A, B)

I ran into the same cryptic error message in R, though in my case it was resolved when I applied the 'as.matrix' function to what was originally a dataframe for the CSV file I imported in using the read.csv() function.

I also had a missing data point in my original data set, and I found that when my data was transformed into a matrix for the friedman.test() call, the entire row containing the missing data point was omitted automatically.