Description Usage Format References Examples
The size of Trillium has been hypothesized to be correlated with the intensity of deer browse occuring on thee population.
1 |
A data frame
site code for different forests and woodlots in NW Pennsylvania near the Pymatuning Laboratory of Ecology
species. All are = T for Trillium
length from soil to leaf whorl
length of longest leaf in cm
Author year.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | library(ggplot2)
library(ggpubr)
## Not run:
## Explore data graphically
### Plot boxplots
ggpubr::ggboxplot(data = trillium,
y = "length.stem.cm",
x = "site",
fill = "site")
### Plot histograms
ggpubr::gghistogram(data = trillium,
x = "length.stem.cm",
title = "All data")
ggpubr::gghistogram(data = trillium,
x = "length.stem.cm",
facet.by = "site",
fill = "site",
title = "Faceted by site")
## Plot means with 95% confidence intervals
ggpubr::ggerrorplot(trillium,
x = "site",
y = "length.stem.cm",
desc_stat = "mean_ci",
add = "mean")
## End(Not run)
## 1-way ANOVA to compare sites
### null model
model.null <- lm(length.stem.cm ~ 1, data = trillium)
### model of interest
model.alt <- lm(length.stem.cm ~ site, data = trillium)
### compare models
anova(model.null, model.alt)
## Pairwise comparisons after 1-way ANOVA
### no corrections for multiple comparisons
pairwise.t.test(x = trillium$length.stem.cm, g = trillium$site,
p.adjust.method = "none")
### Bonferonni correction
pairwise.t.test(x = trillium$length.stem.cm, g = trillium$site,
p.adjust.method = "bonferroni")
## Tukey test
### re-fit model with aov()
model.alt.aov <- aov(length.stem.cm ~ site, data = trillium)
### TukeyHSD() on model from aov()
TukeyHSD(model.alt.aov)
### Plot effect sizes
#plotTukeysHSD(TukeyHSD(model.alt.aov))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.