# ------- # # Young, T., Fuller, E. C., Provost, M. M., Coleman, K. E., St. Martin, K., McCay, B. J., and Pinsky, M. L. # 2018 # Adaptation strategies of coastal fishing communities as species shift poleward. # ICES Journal of Marine Science # doi:10.1093/icesjms/fsy140. # ---------------- # # Community decline model ---- # By: Emma Fuller and Talia Young # Last update: Nov 2016 # ---------------- # library(dplyr) library(broom) library(ggplot2) library(MuMIn) options(na.action = "na.fail") # so dredge works dat_gf <- readRDS("/nfs/fish-fishers-data/delta_gf.RDS") #dat_gf$extant <- ifelse(dat_gf$last_year < 2014, 0, # ifelse(dat_gf$last_year==2014, 1, NA)) #dat_gf$extant <- as.factor(dat_gf$extant) dat_gf$disappeared <- ifelse(dat_gf$last_year < 2014, 1, ifelse(dat_gf$last_year==2014, 0, NA)) dat_gf$disappeared <- as.factor(dat_gf$disappeared) #(so that the coefficient in the final model is for big vessels not for small vessels, which is what it is by default on the factor size) dat_gf$size_num <- ifelse(dat_gf$size=="small", 0, ifelse(dat_gf$size=="large", 1, NA)) # global model for community shrinkage ---- smod <- lm(nfleet_change ~ size_num + sw_mean + port_lat + size_num*sw_mean + size_num*port_lat, data = dat_gf) dd_s <- dredge(smod, extra = c("R^2", "adjR^2")) #write.csv(dd_s, "~/fish_shift/community_analysis/manuscript/02_tables/shrinkage_global.csv", # row.names = FALSE) # shrinkage model without new.bedford_ma-groundfish-65plus # (because NB-large is a total outlier in shrinkage: look at that point way down there! # all those boats shifted from trawl to dredge #ggplot(dat_gf, aes(x = sw_mean, y = nfleet_change)) + # geom_smooth(method="lm", color="gray50", size=0.5)+ # geom_point(color="black", size=2) + # geom_point(aes(color=extant)) + scale_color_manual(values=c("white", "black")) + guides(color=FALSE) + #add fill? is this the only way to do it? # xlab("Species diversity of catch") + ylab("Change in community fleet size\n(# permits/yr)") + # theme(panel.border=element_rect(color="black", fill=NA, size=0.5, linetype="solid"), # strip.text=element_text(size = 10), # panel.background = element_blank(), # strip.background=element_blank()) + # facet_wrap(~size) dat_gf_no_nb <- subset(dat_gf, community != "new.bedford_ma-groundfish-65plus") smod_no_nb <- lm(nfleet_change ~ size_num + sw_mean + port_lat + size_num*sw_mean + size_num*port_lat, data = dat_gf_no_nb) dd_s_no_nb <- dredge(smod_no_nb, extra = c("R^2", "adjR^2")) write.csv(dd_s_no_nb, "~/fish_shift/community_analysis/manuscript/02_tables/shrinkage_global_no_nb.csv", row.names = FALSE) # global model for community disappearance (logistic) ---- dmod <- glm(disappeared ~ size_num + sw_mean + port_lat + size_num*sw_mean + size_num*port_lat, family="binomial", data = dat_gf) dd_d <- dredge(dmod, extra = c("R^2", "adjR^2")) #write.csv(dd_d, "~/fish_shift/community_analysis/manuscript/02_tables/disappearance_global.csv", # row.names = FALSE)