# Test data for differences

I am trying to figure out the best way to test my data for differences in R. The data I have look like this:

domain               variable    lifecycle
162                      CSP1         5
162               old Species        10
162                        BD        16
162                       DBH        14
162                    Height        16
162                      Year         5
123                   species        12
123                  den bran        14
123                  den core        14
191                      CSP2         4
191                   C kg ha         5
185                  location         5
185                   biomass         6
82                   CSP num         6
82                  depth lb         8
82                       C t         7
190                     Layer         8
190                Dry weight         9
204                 item plot         5
204               item volume         7
204 within central plot small         7
205                      plot         3
205        successional stage         3
205            rarefy hundred         3


Now I want to use the "variable" column as factorial group and the "lifecycle" as the characteristiom to compare. Because the data is not normally distributed and I have more than two groups to compare I chose a Kruskal-Wallis test, which shows no significant differences.

Kruskal-Wallis rank sum test

data:  lifecycle by variable
Kruskal-Wallis chi-squared = 25, df = 25, p-value = 0.4624


My question is now if I can use the Kruskal-Wallis in this case to find differences in "lifecycle" for the "variable" groups, or is the sample size to small with only one value per group?

And if it is not usable here in this case what would be a better solution?

EDIT:

I did the Kruskal-Wallis now with the domain as grouping factor. Which gives me a significant difference. The interpretation would be that there are domains with significant more or less impact than other.

After that I performed a post-hoc test to see between which of the domains the differences occur. But supprisingly the paired wilcoxon test with bonferroni correction showed up no significant grup differences. How could this be?

• I think you have some big troubles on you data. What hypothesis are you trying to test?, what is your response variable? what does life cycle means? (I am a biologist but it is not clear in your data). You have many categories on the "variable" groups (some of them are non-sense), what about replicates?, as stated you have no replicates?. Please REVISE the WHOLE DESIGN of your study. It is not clear at all. Commented Aug 13, 2012 at 14:53
• This data is an analysis about a scientific workflow created with the workflow software Kepler. Could be that the name "lifecycle" is a bit missleading and to call it "Impact Factor" would be better I guess. The "Impact factor" describes a count of how much Influence a Variable has on other components of a scientific workflow. The hypothesis would be: There are variables with a significant higher impact factor than others in an scientific workflow. The response would be the count of workflow parts the variable affects. Best Sab
– user13261
Commented Aug 13, 2012 at 15:22

Damian is correct that you need to look much more closely at what your question is conceptually before we can address this. If the table you have displayed represents the entirety of your data, applying statistics makes no sense because there is no variability present within your categories. Each category is entirely described by one score. The Kruskal-Wallis test asks whether groups differ in their median values. With only one score this question is meaningless.

• He, thanks for the answer. Ok thats good to know that I can not do this with only one value per group. That makes sense that there is no variance. You say it compares the medians of the values? I thought it compares the rank sums? So it schould work then if I use the column "domain" as grouping factor. This represents the dataset the variables belong to. Then I could check for differences in between the datasets, asking if there is a difference in variable impact factor ("lifecycle") between the datasets.
– user13261
Commented Aug 13, 2012 at 20:32
• The Kruskaal-Wallis test is computed using rank sums. The hypotheses that you are testing however are: null, the k population distribution functions are identical; alternative, the k populations do not all have the same median. See Applied Nonparametric Statitics Chapter 6 for more details. I'm not sure I understand what you mean by 'dataset' but your assessment is correct. Commented Aug 14, 2012 at 17:58
• Ok thats good. And have you any Idea about the different results the tests give me which I posted as edit? The Kruskal Wallis now says: There is a significant difference. But when I test for detailed differences in a pariwise Wilcoxon test with p-value estimation and a Bonferroni correction there are no differences. How could I report this. What is the right interpretation then? Best Sab.
– user13261
Commented Aug 15, 2012 at 10:52

non parametric procedures are quite robust. It is not a suprise that KW test detects a significant difference but later a a pairwise comparision yields non signficant results. The bonferroni correction also makes the test more conservative (and some authors may say that also increases the chances of making a type II error if you have many comparisons). Another issue that prevents you to find differences in the multiple comparison is the low sample size. There are other procedures to protect for type I error (Sidak, sequencial bonferroni, Hochberg procedure). Why did you choose a Wilcoxon test por multiple comparison? do you have paired data?, Looking at your data it doesnt look like that. Other option could be to test it using U Mann Whitney test. please excuse my english

• He thanks for the answer. No this is no paired dat. I choose the Wilcoxon test for multiple comparison because some statistic sites on the internet showed this as the post-hoc test to Kruskal-Wallis. There were several examples using R with the command pairwise.wilcox.test with different options for correction. I choose one correction because I didnt know about their strengths and weaknesses. But even I choose another one like "holm" this does not make any difference for the results. So you might be right when u say the sample sizes are to small for good pairwise comparisons.
– user13261
Commented Aug 16, 2012 at 7:12
• Ok the sample sizes must be the problem. Those are in some groups only 2 or 3 and this is really not that much. I also did a M-W-U like you suggested on the group with the lowest p-value detected by the pairwise.wilcoxon test but this also was not significant. Best Sab.
– user13261
Commented Aug 16, 2012 at 7:26