I am looking to see if and how tree height differs between areas of undisturbed and historically logged forests. Height was estimated in meters but categorically (1-6, 6-11, 11-16, 16-21, 21-26, 26-31). The two forest areas have unequal sample sizes, logged = 157 trees and undisturbed = 189 trees.

Height class: 1-6, 6-11, 11-16, 16-21, 21-26, 26-31

Logged Abundances: 2, 47, 86, 18, 3, 1

Undisturbed Abundances: 1, 59, 83, 33, 13, 0

Using R I performed a Fisher's exact test with a 2x6 contingency table because of expected values less than 5 meaning I couldn't use chi square. This returned a p value of 0.0375, so there is a relationship between the forest condition and height of trees. Is the unequal sample size affecting this and would it be better to use proportions rather than abundances?

Ultimately what I want to know is whether the trees in the undisturbed forest are taller, can any post hoc tests be used to show the differing abundances (or proportions if better) within each height class are significant?

Also, apologies for not knowing how to make a table of abundances.enter image description here

  • 1
    $\begingroup$ Do you have the original values of the height, or only the discretized version? $\endgroup$ – Frans Rodenburg May 8 at 5:02
  • $\begingroup$ Unfortunately I only have the discretized version. $\endgroup$ – WJH May 8 at 10:36

For an effective ad hoc test, I suggest you use height categories 'Below 16' and 'Above 16' for each type of forest. This will result in at $2 \times 2$ table with sufficiently large counts to use a chi-squared test.

TBL = rbind(c(135,22), c(143,46))
cq.out = chisq.test(TBL);  cq.out

   Pearson's Chi-squared test 
   with Yates' continuity correction

data:  TBL
X-squared = 5.1553, df = 1, p-value = 0.02318

Then compare observed and expected counts.

     [,1] [,2]
[1,]  135   22
[2,]  143   46
         [,1]     [,2]
[1,] 126.1445 30.85549
[2,] 151.8555 37.14451

           [,1]      [,2]
[1,]  0.7884579 -1.594213
[2,] -0.7186169  1.452999

Under the null hypothesis that type of forest and height categories of trees are independent, you would expect around 31 'tall' trees in the logged forest and 37 in the undisturbed forest. In fact, respective observed counts of tall trees are 22 and 46. These discrepancies are the largest contributors to the fact that the chi-squared statistic is significantly large.

The Pearson residuals are the signed square roots of the components $r_{ij}^2=\frac{(X_{ij}-E_{ij})^2}{E_{ij}}.$ If the chi-squared test rejects in a 2-by-2 table, then the cells where absolute values $|r_{ij}|$ of residuals are largest often point the way to important departures from the null hypothesis.

But be careful, you should not go so far as to claim that trees in the undisturbed forest are generally taller. The median heights of trees is about the same (13.5 ft) in both. Also, mean heights are about the same (near 13 ft) in both.

If you don't have the original heights, then you could roughly reclaim them by using interval midpoints:

x = rep(seq(3.5,28.5,by=5), c(2,47,86,18,3,1))
y = rep(seq(3.5,28.5,by=5), c(1,59,83,33,13,0))

Summaries of these approximate heights are similar for the two forests, as follows:

    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    3.50    8.50   13.50   12.74   13.50   28.50 
    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
    3.50    8.50   13.50   13.45   13.50   23.50 

Also, a two-sample t.test on the approximate heights does not show significance at the 5% level.

[1] 0.1092758 

Addendum: Density histograms based on height categories.

enter image description here

R code for histogram:

cutp = seq(1,31,by=5)
 hist(x, prob=2, br=cutp, ylim=c(0,.1), col="skyblue2", main="Logged")
  abline(h=seq(.02, .1, by=.02), col="green2")
 hist(y, prob=2, br=cutp, ylim=c(0,.1), col="skyblue2", main="Undisturbed")
  abline(h=seq(.02,. 1, by=.02), col="green2")

Addendum: If you want a way to focus just on the tallest trees, you can compare the proportion of them in the logged forest with the proportion of them in the undisturbed forest. That's $22/157$ vs. $46/189.$ Again, you get a P-value about 2% (as for the chi-squared test), but without discussing observed and expected counts:

prop.test(c(22,46), c(157,189))

        2-sample test for equality of proportions 
        with continuity correction

data:  c(22, 46) out of c(157, 189)
X-squared = 5.1553, df = 1, p-value = 0.02318
alternative hypothesis: two.sided
95 percent confidence interval:
 -0.19088789 -0.01562982
sample estimates:
   prop 1    prop 2 
0.1401274 0.2433862 
| cite | improve this answer | |
  • $\begingroup$ Thanks for the help. When combining logged groups you had 145 and 17, I think this should be 135 and 22? Re-running gives: X-squared = 5.1553, df = 1, p-value = 0.02318 But then no residuals are >2. So is the test significant but unable to detect which category is causing the significant result? Alternatively, I grouped the height categories as "small" (l = 49, u = 60), "medium" (104 & 116), "large" (4 & 13). Expected values are still >5 so does this keep more of the original data without violating assumptions? This then results in a non-significant p value: 0.165. $\endgroup$ – WJH May 8 at 12:59
  • $\begingroup$ Would it be best to present both the chi-squared and t-test with the midpoints and ultimately concluded there is no significant difference? $\endgroup$ – WJH May 8 at 13:01
  • 1
    $\begingroup$ There is a different profile of heights as revealed by the highly significant chi-sq test at the beginning of my Answ. Specifically, trees 21-26 ft tall have been cut from the logged forest. By the dist'n of tall and short trees you might be able to ID a logged forest from an undisturbed one. // But according to heights reclaimed from interval midpoints, no signif difference in median or mean hights. Both points might be relevant in your report/paper on this. $\endgroup$ – BruceET May 8 at 13:34
  • $\begingroup$ Just saw your comment pointing out my bad arithmetic. Sorry for that. Fixed it just now. // Some discrepancies btw observed and expected counts must account for a chi-sq statistic large enough to give P-value below 0.05. The focus should be on the cells with the largest residuals. The argument isn't as tidy as before, but the chi-squared test still rejects the null hypothesis of independence, and you should report that. It is also reasonable to point out that the t test shows it isn't as simple as (falsely) claiming that the logged forest has shorter trees. // Also see Addendum to Answer. $\endgroup$ – BruceET May 9 at 0:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.