# The behavior of Broad-tailed hummingbirds is altered by cycles of human activity in a forested area converted into agricultural land # 3. Supplemental file 2. Testing the effect of weekly cycles of human disturbance on hummingbird territorial behavior # 4. Figure 3 # Packages library(glmmTMB) library(parameters) library(MuMIn) library(ggplot2) ##### # 3. Testing the effect of weekly cycles of human disturbance on hummingbird territorial behavior ##### # Load data d1<-read.xlsx("Dataset.xlsx",sheet=2) # Chases # GLMM m1<-glmmTMB(Chases~ Type + log(Territory.size) + log(Total.number.of.flowers) + (1|Territory), family = poisson(link = log), data = d1) # s # Model fitting model_parameters(m1,standardize = "refit") m1<-glmmTMB(Chases~ Type + log(Territory.size) + log(Total.number.of.flowers) + (1|Territory), family = poisson(link = log), data = d1) r.squaredGLMM(mod1) # Flowers visited # GLMM m1<-glmmTMB(Flowers.visited~ Type + log(Territory.size) + log(Total.number.of.flowers) + (1|Territory), family = poisson(link = log), data = d1) # s # Model fitting model_parameters(m1,standardize = "refit") m1<-glmmTMB(Flowers.visited~ Type + log(Territory.size) + log(Total.number.of.flowers) + (1|Territory), family = poisson(link = log), data = d1) r.squaredGLMM(mod1) # Successful intruders # GLMM m1<-glmmTMB(Successful.intruders ~ Type + log(Territory.size) + log(Total.number.of.flowers) + (1|Territory), family = poisson(link = log), data = d1) # s # Model fitting model_parameters(m1,standardize = "refit") m1<-glmmTMB(Successful.intruders ~ Type + log(Territory.size) + log(Total.number.of.flowers) + (1|Territory), family = poisson(link = log), data = d1) r.squaredGLMM(mod1) ##### # 4. Figure 3 ##### # Load data d1<-read.xlsx("Dataset.xlsx",sheet=2) # Combine with box plot to add median and quartiles # Change color by groups # Figure 3a a <- ggplot(d1, aes(x=Type, y=Chases, fill=Type)) + geom_violin(trim=FALSE)+ geom_boxplot(width=0.1, fill="white")+ labs(title="Chases",x="Type", y = "Chases") # Figure 3b b <- ggplot(d1, aes(x=Type, y=Flowers.visited, fill=Type)) + geom_violin(trim=FALSE)+ geom_boxplot(width=0.1, fill="white")+ labs(title="Flowers visited",x="Type", y = "Flowers visited") # Figure 3c c <- ggplot(d1, aes(x=Type, y=Successful.intruders, fill=Type)) + geom_violin(trim=FALSE)+ geom_boxplot(width=0.1, fill="white")+ labs(title="Successful intruders",x="Type", y = "Successful intruders")