I'm conducting a study comparing insect communities in forest canopy gaps and closed-canopy forest in three distinct forested areas. My experimental design is hierarchical and unbalanced.
Simplified description of study design (this simplified design is reflected in dummy tibble below):
- Three forested areas;
- Within each forested area are two canopy gaps;
- Associated with each canopy gap are three quadrats - one in the gap itself and two in adjacent closed-canopy forest (this is where data are unbalanced).
I am interested in comparing the community in gaps with the community in adjacent forest using PERMANOVA as implemented in vegan::adonis2(). Because the survey design is hierarchical, I must restrict permutations. However, package permute is reported to require that "the dataset be balanced," with the implication that "unbalanced data would have to be manually permuted" (link). My question is:
- Is it true that
permuteoffers no support for unbalance data? - If this is not true, how can I use package
permutein a way which respects unbalanced data in the context of defining permutation restrictions withinvegan::adonis2()?
Below is a dummy tibble in the format of my main data.
# read in packages
library(tibble)
library(vegan)
library(permute)
# Define tibble, where rows correspond to individual survey quadrats
# Tibble contains:
### three forested areas (column 'forestarea');
### six gaps (column 'gapNo');
### status of quadrat as gap or forest (column 'gapOrforest');
### count data for six insect species.
data <- tibble(
# three forest areas, each with 2 canopy gaps
forestarea = c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3),
gapNo = c(1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6),
# quadrat status as in gap or in forest
gapOrforest = rep(c("g", "f", "f"), 6),
# species data, integer counts
species1 = c(50, 0, 0, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 42, 0, 0),
species2 = c(0, 10, 8, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 5, 9, 9),
species3 = c(30, 0, 10, 0, 0, 23, 0, 0, 0, 45, 0, 0, 23, 10, 0, 43, 21, 60),
species4 = c(0, 5, 12, 0, 0, 3, 20, 0, 0, 0, 15, 0, 0, 0, 18, 0, 0, 0),
species5 = c(25, 0, 0, 0, 13, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 14, 0, 0),
species6 = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 4, 5, 0, 0, 0, 6, 0),
species7 = c(14, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 4),
species8 = c(0, 7, 0, 0, 0, 5, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0),
species9 = c(0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 5, 0, 0, 0, 0, 0),
species10 = c(8, 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0)
)
If data were balanced, PERMANOVA with restricted permutations would be carried out as below:
dist <- vegdist(data[,4:ncol(data)])
control <- how(within = Within(type = "free"),
plots = Plots(strata = data$gapNo, type = "none"),
nperm = 999,
observed = TRUE)
adonis2(dist ~ gapNo,
data=data,
permutations = control)
Can the use of function how() (or package permute more broadly) as shown above be modified to support unbalanced data?