library(corrplot) library(ggplot2) library(lme4) library(glmmTMB) library(MuMIn) library(sjPlot) library(patchwork) library(glmm.hp) library(lmerTest) library(multcomp) library(emmeans) cordata=read.csv("corrdata.csv",header = T)#all data a1=cor(cordata, method = c("spearman")) corrplot(a1, type = "upper", order = "hclust", tl.col = "black", tl.srt = 45) mm=read.csv("newzj.csv",header = T) smm=log(mm[3:17]) Data=as.factor(mm$Date) Species=as.factor(mm$Species) options(na.action = "na.fail") mod1=lmer(Feedingevents~visitors+spresenceduration+Temperature+(1|Species)+(1|Data),smm) mod2=lmer(Feedingduration~visitors+spresenceduration+Temperature+(1|Species)+(1|Data),smm) mod3=lmer(Hidingevents~visitors+spresenceduration+Temperature+(1|Species)+(1|Data),smm) mod4=lmer(Hidingduration~visitors+spresenceduration+Temperature+(1|Species)+(1|Data),smm) mod5=lmer(Movingevents~visitors+spresenceduration+(1|Species)+(1|Data),smm) dredge(mod1) dredge(mod2) dredge(mod3) dredge(mod4) dredge(mod5) dredge(mod6) summary(mod1) summary(mod2) summary(mod3) summary(mod4) summary(mod5) a1=glmm.hp(mod1) a2=glmm.hp(mod2) a3=glmm.hp(mod3) a4=glmm.hp(mod4) a5=glmm.hp(mod5) #划分高中低 gg=read.csv("low.csv",header = T)#low(all data) sgg=log(gg[3:17]) Data=as.factor(gg$Date) Species=as.factor(gg$Species) options(na.action = "na.fail") d1=lmer(Feedingevents~visitors+spresenceduration+Temperature+(1|Species)+(1|Data),sgg) d2=lmer(Feedingduration~spresenceduration+Temperature+(1|Species)+(1|Data),sgg) d3=lmer(Hidingevents~spresenceduration+(1|Species)+(1|Data),sgg) d4=lmer(Hidingduration~spresenceduration+Temperature+(1|Species)+(1|Data),sgg) d5=lmer(Movingevents~visitors+spresenceduration+Temperature+(1|Species)+(1|Data),sgg) d6=lmer(Movingduration~visitors+spresenceduration+Temperature+(1|Species)+(1|Data),sgg) dredge(d1) dredge(d2) dredge(d3) dredge(d4) dredge(d5) dredge(d6) summary(d1) summary(d2) summary(d3) summary(d4) summary(d5) summary(d6) w1=glmm.hp(d1) w2=glmm.hp(d2) w3=glmm.hp(d3) w4=glmm.hp(d4) tt=read.csv("mid.csv",header = T)#middle(all data) stt=log(tt[3:17]) Data=as.factor(tt$Date) Species=as.factor(tt$Species) options(na.action = "na.fail") t1=lmer(Feedingevents~spresenceduration+Temperature+(1|Species)+(1|Data),stt) t2=lmer(Feedingduration~visitors+spresenceduration+Temperature+(1|Species)+(1|Data),stt) t3=lmer(Hidingevents~visitors+spresenceduration+Temperature+(1|Species)+(1|Data),stt) t4=lmer(Hidingduration~spresenceduration+Temperature+(1|Species)+(1|Data),stt) t5=lmer(Movingevents~1+(1|Species)+(1|Data),stt) t6=lmer(Movingduration~visitors+(1|Species)+(1|Data),stt) dredge(t1) dredge(t2) dredge(t3) dredge(t4) dredge(t5) dredge(t6) summary(t1) summary(t2) summary(t3) summary(t4) summary(t5) summary(t6) e1=glmm.hp(t1) e2=glmm.hp(t2) e3=glmm.hp(t3) e4=glmm.hp(t4) e6=glmm.hp(t6) qq=read.csv("hig.csv",header = T)#high(all data) tqq=log(qq[3:17]) Data=as.factor(qq$Date) Species=as.factor(qq$Species) options(na.action = "na.fail") q1=lmer(Feedingevents~visitors+spresenceduration+Temperature+(1|Species)+(1|Data),tqq) q2=lmer(Feedingduration~visitors+spresenceduration+(1|Species)+(1|Data),tqq) q3=lmer(Hidingevents~spresenceduration+Temperature+(1|Species)+(1|Data),tqq) q4=lmer(Hidingduration~spresenceduration+(1|Species)+(1|Data),tqq) q5=lmer(Movingevents~spresenceduration+Temperature+(1|Species)+(1|Data),tqq) q6=lmer(Movingduration~visitors+Temperature+(1|Species)+(1|Data),tqq) dredge(q1) dredge(q2) dredge(q3) dredge(q4) dredge(q5) dredge(q6) summary(q1) summary(q2) summary(q3) summary(q4) summary(q5) summary(q6) r1=glmm.hp(q1) r2=glmm.hp(q2) r3=glmm.hp(q3) r4=glmm.hp(q4) r5=glmm.hp(q5) r6=glmm.hp(q6) #每个物种单独检验Per species pmm=read.csv("newzj.csv",header = T)#all data prmm=log(pmm[3:17]) Data=as.factor(pmm$Date) Species=as.factor(pmm$Species) pf=lmer(Feedingevents~Species+visitors+spresenceduration+Temperature+(1|Data),prmm) summary(pf) pairwise_comparisons <- emmeans(pf, pairwise ~ Species) print(pairwise_comparisons) sig.df=cld(pairwise_comparisons,level=0.05,Letters=letters) summary(sig.df) pf1=lmer(Feedingduration~Species+visitors+spresenceduration+Temperature+(1|Data),prmm) pc1=emmeans(pf1, pairwise ~ Species) sig.df1=cld(pc1,level=0.05,Letters=letters) summary(sig.df1) pf2=lmer(Hidingevents~Species+visitors+spresenceduration+Temperature+(1|Data),prmm) pc2=emmeans(pf2, pairwise ~ Species) sig.df2=cld(pc2,level=0.05,Letters=letters) summary(sig.df2) pf3=lmer(Hidingduration~Species+visitors+spresenceduration+Temperature+(1|Data),prmm) pc3=emmeans(pf3, pairwise ~ Species) sig.df3=cld(pc3,level=0.05,Letters=letters) summary(sig.df3) pf4=lmer(Movingevents~Species+visitors+spresenceduration+Temperature+(1|Data),prmm) pc4=emmeans(pf4, pairwise ~ Species) sig.df4=cld(pc4,level=0.05,Letters=letters) summary(sig.df4) pf5=lmer(Movingduration~Species+visitors+spresenceduration+Temperature+(1|Data),prmm) pc5=emmeans(pf5, pairwise ~ Species) sig.df5=cld(pc5,level=0.05,Letters=letters) summary(sig.df5)