# The behavior of Broad-tailed hummingbirds is altered by cycles of human activity in a forested area converted into agricultural land # 1. Scripts to analyze the Supplemental file 1. Human activity levels inside the territories on weekends and weekdays # 2. Scripts to obtain Figure 2 # Packages library(glmmTMB) library(parameters) library(MuMIn) library(ggplot2) ##### # 1. Human activity levels inside the territories on weekends and weekdays ##### # Load data d1<-read.xlsx("Dataset.xlsx",sheet=1) # Pedestrians and cyclist # GLMM m1<-glmmTMB(Pedestrian.and.cyclists~ Type + (1|Territory), family = poisson(link = log), data = d1) # s # Model fitting model_parameters(m1,standardize = "refit") m1<-glmmTMB(Pedestrian.and.cyclist~ Type + (1|Territory), family = poisson(link = log), data = d1) r.squaredGLMM(mod1) # Dogs and farm animals # GLMM m1<-glmmTMB(Dogs.and.farm.animals~ Type + (1|Territory), family = poisson(link = log), data = d1) # s # Model fitting model_parameters(m1,standardize = "refit") m1<-glmmTMB(Dogs.and.farm.animals ~ Type + (1|Territory), family = poisson(link = log), data = d1) r.squaredGLMM(mod1) # Vehicles # GLMM m1<-glmmTMB(Vehicles~ Type + (1|Territory), family = poisson(link = log), data = d1) # s # Model fitting model_parameters(m1,standardize = "refit") m1<-glmmTMB(Vehicles~ Type + (1|Territory), family = poisson(link = log), data = d1) r.squaredGLMM(mod1) ##### # 2. Figure 2 ##### # Load data d1<-read.xlsx("Dataset.xlsx",sheet=1) # Combine with box plot to add median and quartiles # Change color by groups # Figure 2a a <- ggplot(d1, aes(x=Type, y=Pedestrian.and.cyclists, fill=Type)) + geom_violin(trim=FALSE)+ geom_boxplot(width=0.1, fill="white")+ labs(title="Pedestrian and cyclists",x="Type", y = "Pedestrian and cyclists") # Figure 2b b <- ggplot(d1, aes(x=Type, y=Dogs.and.farm.animals, fill=Type)) + geom_violin(trim=FALSE)+ geom_boxplot(width=0.1, fill="white")+ labs(title="Dogs and farm animals",x="Type", y = "Dogs and farm animals") # Figure 2c c <- ggplot(d1, aes(x=Type, y=Vehicles, fill=Type)) + geom_violin(trim=FALSE)+ geom_boxplot(width=0.1, fill="white")+ labs(title="Vehicles",x="Type", y = "Vehicles")