Palm trees can grow in different forest layers, including the understorey and canopy. These layers may differ in sunlight exposure, space, and environmental conditions, which could influence fruit traits. In this project, we examine whether palm trees classified as understorey or canopy differ in average fruit length.
# Exploring the Data
is.numeric(palmtrees$average_fruit_length_cm)
## [1] TRUE
clean_df <- palmtrees %>% na.exclude(average_fruit_length_cm)
clean_df <- clean_df[-78, ]
hist(clean_df$average_fruit_length_cm, main = "Fruit Length Histogram", xlab = "Fruit Length (cm)")
ggplot(clean_df, aes(x = average_fruit_length_cm)) +
geom_histogram() +
facet_wrap(~ understorey_canopy, ncol = 1)
## `stat_bin()` using `bins = 30`. Pick better value `binwidth`.
clean_df$loglength <- log(clean_df$average_fruit_length_cm)
hist(clean_df$loglength)
hist(clean_df$loglength,
main = "Histogram of Log Transformed Avg Length",
xlab = "Log Transformed Length",
ylab = "Count")
hist(clean_df$loglength, main = "Fruit Length Histogram", xlab = "Fruit Length (cm)")
ggplot(clean_df, aes(x = average_fruit_length_cm)) +
geom_histogram( bins = 30,
fill = "pink",
color = "black") +
facet_wrap(~ understorey_canopy, ncol = 1) +
xlim(0, 10) + theme_minimal() + labs(
title = "Distribution of Average Fruit Length by Forest Layer",
x = "Average Fruit Length (cm)",
y = "Count"
)
## Warning: Removed 5 rows containing non-finite outside the scale range
## (`stat_bin()`).
## Warning: Removed 4 rows containing missing values or values outside the scale range
## (`geom_bar()`).
The histograms display the distribution of average fruit length for palm
trees in the canopy and understorey layers. In both groups, the data
appear right-skewed, with most observations concentrated at lower fruit
lengths and a few larger values extending the tail to the right. For
canopy palms, the distribution is more spread out, with fruit lengths
ranging from very small values up to nearly 10 cm. There is a noticeable
concentration around approximately 1–3 cm, but several larger values
suggest greater variability within canopy species. In contrast,
understorey palms show a tighter distribution, with most fruit lengths
clustered between about 1–2.5 cm and fewer extreme values. This
indicates less variability compared to canopy palms. Overall, canopy
palms tend to exhibit a wider range of fruit lengths, while understorey
palms are more concentrated around smaller values. This visual
difference suggests that forest layer may influence fruit size, though
statistical testing will be conducted to determine whether this
difference is significant.
# Normality
qqnorm(clean_df$loglength)
qqline(clean_df$loglength)
# Equal variance
leveneTest(data = clean_df, loglength ~ understorey_canopy, center = mean)
## Warning in leveneTest.default(y = y, group = group, ...): group coerced to
## factor.
## Levene's Test for Homogeneity of Variance (center = mean)
## Df F value Pr(>F)
## group 1 1.8502 0.175
## 245
t.test( average_fruit_length_cm ~ understorey_canopy, data = clean_df, var.equal = TRUE)
##
## Two Sample t-test
##
## data: average_fruit_length_cm by understorey_canopy
## t = 3.3663, df = 245, p-value = 0.0008844
## alternative hypothesis: true difference in means between group canopy and group understorey is not equal to 0
## 95 percent confidence interval:
## 0.4638478 1.7722083
## sample estimates:
## mean in group canopy mean in group understorey
## 3.030732 1.912704
The independent two-sample t-test was conducted to compare average fruit length between canopy and understorey palm trees. The results showed a statistically significant difference between the two groups (t = 3.37, p = 0.00088). On average, canopy palms (mean = 3.03 cm) had larger fruit than understorey palms (mean = 1.91 cm). The 95% confidence interval for the difference in means (0.46 to 1.77 cm) does not include zero, further supporting the conclusion that fruit length differs significantly by forest layer. getwd() ### Part 4 - Discussion After considering every piece of data analysis done in this study, it is clear that growing in the canopy or the understorey has an affect on how fruit grows on palm trees. Whilst the two areas of growth have similar outlier fruit sizes, the obvious difference is in the mean length of the fruit. Canopy palm trees grow fruit that is over a centimeter longer on average than understorey palms. This most likely has to do with the fact that the canopy fruit is much more difficult for predators to get to due to the fruit typically sitting 20 to 40 meters off of the ground, and even has a completely different pool of predators attempting to harvest it. There is a caveat to the tests done, which is that the fruit’s width wasn’t analyzed. This is something that could be tested further but would most likely give similar results.
After parsing through, testing, and interpreting the data, it is determined that canopy palm trees grow longer fruit than understory palm trees. This is most likely due to the fact that canopy palms grow upwards away from predators.
Kissling, W. D., Balslev, H., Baker, W. J., Dransfield, J., Göldel, B., Lim, J. Y., Onstein, R. E., & Svenning, J.-C. (2019, September 24). Palmtraits 1.0, a species-level functional trait database of Palms Worldwide. Nature News. https://www.nature.com/articles/s41597-019-0189-0#citeas