# RESOLVED: (Thanks Miner!) Best test? Before and After Cattle Trial

#### lucyd123

##### Member
Hi all! Love this forum. Sorry I'm such a rookie.

So let's say I have 200 trees and I want to measure the impact of cattle on the trees.

I cut down 100 trees prior to the trial and record the biomass of components.

I cut down 100 trees after the trial and record the biomass of the components.

The data is non-parametric. As I expected I have lost leaf biomass during the trial, this is because the cows were eating it. Is there a statistical test that I can show this with? Because I am confused because it is not that I measured tree C before and after, I measured tree C before and tree D afterwards and I want to see if these two trees have significantly different leaf biomasses. Thank you so much!

#### lucyd123

##### Member
For example:
Wilcoxon rank sum test with continuity correction

data: totalfoliarbiomass by before_after_cattle
W = 6940, p-value = 0.0004071
alternative hypothesis: true location shift is not equal to 0

#### Miner

##### TS Contributor
What do you mean by nonparametric? Do you mean that the data are not normally distributed and you are looking for a nonparametric test?

Regarding tree C and tree D, this just means that you would use a 2-sample hypothesis test rather than a paired hypothesis test. We need to know more about the distribution of your data before we can recommend a specific test.

#### lucyd123

##### Member
For example
(DW_H_T is a continuous variable reporting the dry weight biomass in g and pre1post2 is either 1, prior to cattle or 2 post cattle

#Both samples do not show a normal distribution so the decision is taken to continue with non-parametric tests. The Mann-Whitney-Wilcoxon test is taken as (1) the samples come from distinct populations[ld1] and (2) the samples do not effect eachother. The MWW test will test the assumption there is no difference in the population.

wilcox.test(DW_H_T ~ pre1post2, data=my_data)

# Wilcoxon rank sum test with continuity correction

#

#data: DW_H_T by pre1post2

#W = 6940, p-value = 0.0004071

#alternative hypothesis: true location shift is not equal to 0

#The results suggest there is a significant difference in foliar biomass pre/post cattle trials. Therefore I can report “A Mann-Whitney U test showed that there was a significant difference (W = 6940, p-value = 0.0004) between the pre cattle compared to the post cattle measurements of foliar biomass.

[ld1]Do they?

#### lucyd123

##### Member
What do you mean by nonparametric? Do you mean that the data are not normally distributed and you are looking for a nonparametric test?

Regarding tree C and tree D, this just means that you would use a 2-sample hypothesis test rather than a paired hypothesis test. We need to know more about the distribution of your data before we can recommend a specific test.
Shapiro-Wilk normality test

data: my_data\$DW_H_T
W = 0.74671, p-value < 2.2e-16

Hope this helps! Thank you!

#### Attachments

• 27.4 KB Views: 2

#### Miner

##### TS Contributor
The Mann-Whitney-Wilcoxon test does have an assumption that both samples have similar shapes and equal variances. Have you verified that? If the variances differ, you should consider the Kruskal-Wallis or Mood's median tests. Both only assume similar shapes. Kruskal-Wallis has greater power, but Mood's median is more robust to outliers.

#### lucyd123

##### Member
The Mann-Whitney-Wilcoxon test does have an assumption that both samples have similar shapes and equal variances. Have you verified that? If the variances differ, you should consider the Kruskal-Wallis or Mood's median tests. Both only assume similar shapes. Kruskal-Wallis has greater power, but Mood's median is more robust to outliers.
Ok thank you. So if I split the data into pre and post cattle and examined it seperately I get the following density plots and Shapiro results:
Pre trial: W = 0.81661, p-value = 6.325e-11
Post trial: W = 0.615, p-value = 5.193e-14

#### Attachments

• 9.6 KB Views: 3
• 9.8 KB Views: 2
• 9.6 KB Views: 1

#### Miner

##### TS Contributor
To be thorough, I would test for equal variances, but they visually appear to be different, which would indicate using KW or Mood's. I would be concerned about the long tails acting like outliers, so I would probably go with Mood's median. You have a large sample size, so power shouldn't be an issue.

#### lucyd123

##### Member
Great! Thanks for the advice, can you recommend a test for equal variances?

I've broken my process down into a word document that I've attached

#### lucyd123

##### Member
OK I DID IT!

> leveneTest(DW_H_T ~ PREPOST, data=my_data)
Levene's Test for Homogeneity of Variance (center = median)
Df F value Pr(>F)
group 1 2.2278 0.1371
208

#### lucyd123

##### Member
(a) My main question that arises from this exercise is if Shapiro Wilk considers the data to be not normally distributed but the Levene test considers the data to have equal variances, is it then appropriate to use the Mann Whitney test?

Last edited:

#### lucyd123

##### Member
Ok so for my next question: I was going through the process again for another species, E. berteroana. The results of the Levene test show that the data do not have equal variances. Therefore can I assume based on the information you have given to me that the data should be analysed via the Mood's medium?

#Levene's Test for Homogeneity of Variance (center = median)
# Df F value Pr(>F)
#group 1 31.39 6.676e-08 ***
# 207

#Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Would it be fair to state "The results of the Levene test are positive e.g. P > 0.05 this suggests that the variances in the pre and post cattle foliar data are significantly different. The groups are therefore not homogeneous and this data requires logarithmic transformation or careful selection of non-parametric tests."

#### Miner

##### TS Contributor
Use Mood's median for unequal variances provided the shapes are similar (e.g., skewed in the same direction).

Regarding your last statement, I am okay with the first sentence about variances. However, I would not state the part about logarithmic transformation unless you have verified that it works with this data.

#### lucyd123

##### Member
!Ok So i tried this mood test I'm searching online to figure out how to interpret this result! I've attached a box plot of the data!

mood.test(DW_H_T ~ PREPOST, data = mydata)

# Mood two-sample test of scale

#data: DW_H_T by PREPOST

#Z = 0.31934, p-value = 0.7495

#alternative hypothesis: two.sided

#### Attachments

• 5.7 KB Views: 1

#### lucyd123

##### Member
And here are some density plots

#### Attachments

• 8.6 KB Views: 1
• 9.7 KB Views: 1