### R script for multiple comparison procedures of species-specific browsing rates: require(betareg) require(multcomp) require(lmtest) require(AICcmodavg) data<-read.table("C:\\data\\data.txt",header=T) attach(data) names(data) summary(data) Sp<-factor(Sp) Stand<-factor(Stand) Year<-factor(Year) Tr<-factor(Tr) ### comparison of null model (overall browsing probability equals on all species) vs species model (msp, browsing probability varies among species); ### error structure considers the sampling design, with stand and year random effects; ### A1: multiple pair-wise comparison of proportion of browsed plants, generalized linear mixed models with lmer4: require(lme4) require(arm) null <- glmer(BrY ~ 1 + (1 | Stand/Year/Tr), data = data, family = binomial) msp <- glmer(BrY ~ -1 + Sp + (1 | Stand/Year/Tr), data = data, family = binomial) AICc(null) AICc(msp) lrtest(null, msp) summary(msp) mctukey <- glht(msp, linfct = mcp(Sp = "Tukey")) summary(mctukey) ### palatable (Qi and Pl) and unpalatable species (Au, Cm, Cs, and Ea) significantly differ; Qi and Pl do not significantly differ in the proportion of browsed plants. ### extract information and plot: mctukey.cld <- cld(mctukey) ### use sufficiently large upper margin old.par <- par( mai=c(1,1,1.25,1)) ### plot plot(mctukey.cld) ### figure 1 shows that there are two groups of species, palatable (Pl and Qi) and unpalatable (Au, Cm, Cs, and Ea); ### get confidence intervals ci.glht <- confint(mctukey) ### plot them plot(ci.glht) ### A2: multiple pair-wise comparison of logit transformed proportion of browsed shoots, linear mixed models with lmer4: require(lme4) require(arm) null <- lmer(logit(Br) ~ 1 + (1 | Stand/Year/Tr), data = data) msp <- lmer(logit(Br) ~ -1 + Sp + (1 | Stand/Year/Tr), data = data) AICc(null) AICc(msp) lrtest(null, msp) summary(msp) mctukey <- glht(msp, linfct = mcp(Sp = "Tukey")) summary(mctukey) ### Pl and Qi significantly differ in the proportion of browsed shoots. ### extract information and plot: mctukey.cld <- cld(mctukey) ### use sufficiently large upper margin old.par <- par( mai=c(1,1,1.25,1)) ### plot plot(mctukey.cld) ### figure 2 confirms that there are two groups of species, palatable (Pl and Qi) and unpalatable (Au, Cm, Cs, and Ea); ### Additionally, the two palatable species significantly differs in the proportion of browsed shoots. ### get confidence intervals ci.glht <- confint(mctukey) ### plot them plot(ci.glht) ### A2b: multiple comparison of proportion of browsed shoots, untransformed proportion data (0