#work of compNPP3 data frame attach(compNPP3) #add noise level variable compNPP3$NOISE_LEV<-compNPP3$Noise.Num/compNPP3$Num.Surveys #create combined9 for 9 or greater surveys combined9<-subset(compNPP3, Num.Surveys>8) combined9$NPP<-combined9$npp_Vasc_A #changes the name of NPP #takes residuals from NPP regression NPPreg<-glm(richness~NPP, family="poisson", data=combined9) combined9$NPPres<-resid(NPPreg) attach(combined9) plot(state, NPPres) #some regional data also MWdata<-subset(combined9, region=="MW") Ndata<-subset(combined9, region=="N") Sdata<-subset(combined9, region=="S") #below is unnecessary - these variables are already in NPP3 combined9$PS_ROAD_LEN_300<-combined9$P_ROAD_LEN_300 + combined9$S_ROAD_LEN_300 combined9$PS_ROAD_LEN_600<-combined9$P_ROAD_LEN_600 + combined9$S_ROAD_LEN_600 combined9$PS_ROAD_LEN_1000<-combined9$P_ROAD_LEN_1000 + combined9$S_ROAD_LEN_1000 combined9$PS_ROAD_LEN_5000<-combined9$P_ROAD_LEN_5000 + combined9$S_ROAD_LEN_5000 combined9$PS_ROAD_LEN_10000<-combined9$P_ROAD_LEN_10000 + combined9$S_ROAD_LEN_10000 attach(combined9) #lm's below for all and for regions lmtot<-lm(NPPres~NOISE_LEV + Num.Surveys + T_ROAD_LEN_1000 + PROP_AGR_1000 + PROP_DEV_1000 + PROP_FOR_1000, data=combined9) summary(lmtot) totMW<-lm(NPPres~NOISE_LEV + Num.Surveys + T_ROAD_LEN_1000 + PROP_AGR_1000 + PROP_DEV_1000 + PROP_FOR_1000, data=MWdata) summary(totMW) totN<-lm(NPPres~NOISE_LEV + Num.Surveys + PS_ROAD_LEN_1000 + PROP_AGR_1000 + PROP_DEV_1000 + PROP_FOR_1000, data=Ndata) summary(totN) totS<-lm(NPPres~NOISE_LEV + Num.Surveys + T_ROAD_LEN_1000 + PROP_AGR_1000 + PROP_DEV_1000 + PROP_FOR_1000, data=Sdata) summary(totS) #single-species models look like this ANFOhab<-glm(ANFO ~ Num.Surveys + T_ROAD_LEN_1000 + PROP_DEV_1000 + PROP_FOR_5000, family="binomial", data=combined9) summary(ANFOhab) ANAMhab<-glm(ANAM ~ Num.Surveys + T_ROAD_LEN_1000 + PROP_DEV_1000 + PROP_FOR_5000 + PROP_AGR_1000, family="binomial", data=combined9) summary(ANAMhab) HYCVhab<-glm(sum.HYCV ~ Num.Surveys + T_ROAD_LEN_1000 + PROP_DEV_1000 + PROP_FOR_1000, family="binomial", data=combined9) summary(HYCVhab) HYGRhab<-glm(HYGR ~ Num.Surveys + T_ROAD_LEN_1000 + PROP_DEV_1000 + PROP_FOR_5000, family="binomial", data=combined9) summary(HYGRhab) HYCIhab<-glm(HYCI ~ Num.Surveys + T_ROAD_LEN_1000 + PROP_DEV_1000 + PROP_FOR_5000 + PROP_AGR_1000, family="binomial", data=combined9) summary(HYCIhab) LICAhab<-glm(LICA ~ Num.Surveys + T_ROAD_LEN_1000 + PROP_DEV_1000 + PROP_FOR_5000 + PROP_AGR_1000, family="binomial", data=combined9) summary(LICAhab) LICLhab<-glm(LICL ~ Num.Surveys + T_ROAD_LEN_1000 + PROP_DEV_1000 + PROP_FOR_5000 + PROP_AGR_1000, family="binomial", data=combined9) summary(LICLhab) LIPAhab<-glm(LIPA ~ Num.Surveys + T_ROAD_LEN_1000 + PROP_DEV_1000 + PROP_FOR_5000 + PROP_AGR_1000, family="binomial", data=combined9) summary(LIPAhab) LISPhab<-glm(LISP ~ Num.Surveys + PROP_DEV_1000 + PROP_FOR_5000 + PROP_AGR_1000, family="binomial", data=combined9) summary(LISPhab) LISYhab<-glm(LISY ~ Num.Surveys + T_ROAD_LEN_1000 + PROP_DEV_1000 + PROP_FOR_1000 + PROP_AGR_1000, family="binomial", data=compNOMN) summary(LISYhab) #this added the subset of wetland data but there's not a lot of these combwet<-merge(combined9, revisedareas, by="route") attach(combwet) cor.test(NPPres, Area300, use="pairwise.complete.obs") cor.test(NPPres, Area600, use="pairwise.complete.obs") cor.test(NPPres, Area1000, use="pairwise.complete.obs") cor.test(NPPres, Area5000, use="pairwise.complete.obs") cor.test(NPPres, Area10000, use="pairwise.complete.obs") cor(Area300, Area1000, use="pairwise.complete.obs") cor(Area300, Area10000, use="pairwise.complete.obs") cor(Area1000, Area10000, use="pairwise.complete.obs") attach(combined9) plot(state, richness, xlab="state", ylab="richness") plot(state, NPPres, xlab="state", ylab="richness") attach(combined9) cor.test(NPPres, T_ROAD_LEN_300, use="pairwise.complete.obs") cor.test(NPPres, T_ROAD_LEN_600, use="pairwise.complete.obs") cor.test(NPPres, T_ROAD_LEN_1000, use="pairwise.complete.obs") cor.test(NPPres, T_ROAD_LEN_5000, use="pairwise.complete.obs") cor.test(NPPres, T_ROAD_LEN_10000, use="pairwise.complete.obs") cor.test(NPPres, PROP_DEV_300, use="pairwise.complete.obs") cor.test(NPPres, PROP_DEV_600, use="pairwise.complete.obs") cor.test(NPPres, PROP_DEV_1000, use="pairwise.complete.obs") cor.test(NPPres, PROP_DEV_5000, use="pairwise.complete.obs") cor.test(NPPres, PROP_DEV_10000, use="pairwise.complete.obs") cor.test(NPPres, PROP_FOR_300, use="pairwise.complete.obs") cor.test(NPPres, PROP_FOR_600, use="pairwise.complete.obs") cor.test(NPPres, PROP_FOR_1000, use="pairwise.complete.obs") cor.test(NPPres, PROP_FOR_5000, use="pairwise.complete.obs") cor.test(NPPres, PROP_FOR_10000, use="pairwise.complete.obs") cor.test(NPPres, PROP_AGR_300, use="pairwise.complete.obs") cor.test(NPPres, PROP_AGR_600, use="pairwise.complete.obs") cor.test(NPPres, PROP_AGR_1000, use="pairwise.complete.obs") cor.test(NPPres, PROP_AGR_5000, use="pairwise.complete.obs") cor.test(NPPres, PROP_AGR_10000, use="pairwise.complete.obs") attach(combined9) cor.test(NPPres, WET_CONNECT, use="pairwise.complete.obs") cor.test(NPPres, TOTAL_CONNECT, use="pairwise.complete.obs") plot(region, PROP_AGR_1000) plot(region, T_ROAD_LEN_1000) plot(region, PROP_FOR_1000) plot(region, PROP_DEV_1000)