Define some colors:

pinkCH<-rgb(255,4,196, alpha=c(0,255), maxColorValue=255)
bluePH<-rgb(18,127,237, alpha=c(0,255), maxColorValue = 255)
orangeAP<-rgb(255,168,0, alpha=c(0,255), maxColorValue = 255)
redGL<-rgb(232,0,0, alpha=c(0,255), maxColorValue = 255)

Read in .csv file and rename population segments:

londat<-read.csv("vermNBlatWKbk.csv", header=T)
londat$popseg<-factor(londat$popseg, levels = c("ph_bwwa", "ch_bwwa", "sapp_bwwa", "napp_bwwa", "wgl_gwwa", "egl_gwwa", "sapp_gwwa", "napp_gwwa"))

Boxplot of nonbreeding longitude by population:

boxplot(nbLON~popseg,data=londat, ylim=c(60,100),sort=c("ph_bwwa", "ch_bwwa", "sapp_bwwa", "napp_bwwa", "wgl_gwwa", "egl_gwwa", "sapp_gwwa", "napp_gwwa"), col=c("#127FED", "#FF04C4", "#FFA800", "#FFA800", "#E80000","#E80000", "#FFA800", "#FFA800"))

Plot nonbreeding longitude as a function of breeding (deployment site) longitude for all Vermivora:

lm1<-lm(londat$nbLON~londat$depLON)
summary(lm1)
## 
## Call:
## lm(formula = londat$nbLON ~ londat$depLON)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -15.5611  -2.2929   0.3217   4.6549  10.6967 
## 
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    56.1189     9.2438   6.071 7.66e-08 ***
## londat$depLON   0.3099     0.1064   2.913  0.00493 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 6.418 on 64 degrees of freedom
## Multiple R-squared:  0.117,  Adjusted R-squared:  0.1032 
## F-statistic: 8.483 on 1 and 64 DF,  p-value: 0.00493
plot(londat$nbLON~londat$depLON, ylab="Nonbreeding longitude (degrees W)", xlab="Deployment site longitude (degrees W)", main = "Vermivora")
abline(lm(londat$nbLON~londat$depLON))

Subset londat dataframe to include only blue-winged warblers:

bw<-subset(londat, sp==2)

Nonbreeding longitude as a function of breeding (deployment site) longitude for all blue-winged warblers:

lm2<-lm(bw$nbLON~bw$depLON)
summary(lm2)
## 
## Call:
## lm(formula = bw$nbLON ~ bw$depLON)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -9.5314 -1.0191 -0.1661  1.3069  5.0197 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 63.59230    7.86146   8.089 3.54e-08 ***
## bw$depLON    0.28677    0.09495   3.020  0.00609 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.877 on 23 degrees of freedom
## Multiple R-squared:  0.284,  Adjusted R-squared:  0.2528 
## F-statistic: 9.121 on 1 and 23 DF,  p-value: 0.006095
plot(bw$nbLON~bw$depLON, ylab="Nonbreeding longitude (degrees W)", xlab="Deployment site longitude (degrees W)", main = "Blue-winged warblers")
abline(lm2)

Nonbreeding longitude as a function of breeding (deployment site) longitude for blue-winged warblers excluding 1 outlier (MAB05 – wintered in northern South America):

lm2.1<-lm(bw$nbLON~bw$depLON, subset = bw$nbLON > 80 )
summary(lm2.1)
## 
## Call:
## lm(formula = bw$nbLON ~ bw$depLON, subset = bw$nbLON > 80)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.6884 -1.1411 -0.5685  0.8446  4.5434 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 74.11956    5.68526   13.04 7.96e-12 ***
## bw$depLON    0.16470    0.06834    2.41   0.0248 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.949 on 22 degrees of freedom
## Multiple R-squared:  0.2089, Adjusted R-squared:  0.1729 
## F-statistic: 5.809 on 1 and 22 DF,  p-value: 0.02475
plot(bw$nbLON~bw$depLON, subset = bw$nbLON > 80, ylab="Nonbreeding longitude (degrees W)", xlab="Deployment site longitude (degrees W)", main = "Blue-winged warblers (outlier removed)")
abline(lm2.1)

Subset londat dataset to include all golden-winged warblers:

gw<-subset(londat, sp==1)

Nonbreeding longitude as a function of breeding (deployment site) longitude for golden-winged warblers:

lm3<-lm(gw$nbLON~gw$depLON)
summary(lm3)
## 
## Call:
## lm(formula = gw$nbLON ~ gw$depLON)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -6.9194 -3.6051  0.2727  1.7749 12.5687 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 13.56289    8.84942   1.533    0.133    
## gw$depLON    0.74993    0.09912   7.566 3.62e-09 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 4.52 on 39 degrees of freedom
## Multiple R-squared:  0.5948, Adjusted R-squared:  0.5844 
## F-statistic: 57.25 on 1 and 39 DF,  p-value: 3.624e-09
plot(gw$nbLON~gw$depLON, ylab="Nonbreeding longitude (degrees W)", xlab="Deployment site longitude (degrees W)", main = "Golden-winged warblers")
abline(lm3)

Subset golden-winged warbler dataframe into only Appalachian populations:

gwAM<-subset(gw, popseg == "napp_gwwa"|popseg == "sapp_gwwa")

Nonbreeding longitude as a function of breeding (deployment site) longitude for golden-winged warblers breeding in the Appalachian Mountains:

lm4<-lm(gwAM$nbLON~gwAM$depLON)
summary(lm4)
## 
## Call:
## lm(formula = gwAM$nbLON ~ gwAM$depLON)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.8883 -0.2500  0.2416  0.8261  2.1203 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)   
## (Intercept)  35.8280    10.8608   3.299  0.00803 **
## gwAM$depLON   0.4245     0.1332   3.187  0.00971 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.665 on 10 degrees of freedom
## Multiple R-squared:  0.5039, Adjusted R-squared:  0.4543 
## F-statistic: 10.16 on 1 and 10 DF,  p-value: 0.009706
plot(gwAM$nbLON~gwAM$depLON,ylab="Nonbreeding longitude (degrees W)", xlab="Deployment site longitude (degrees W)", main = "Appalachian golden-winged warblers")
abline(lm4)

Subset golden-winged warbler dataframe to include only individuals breeding in the Great Lakes region:

gwGL<-subset(gw, popseg == "wgl_gwwa"|popseg == "egl_gwwa")

Nonbreeding longitude as a function of breeding (deployment site) longitude for golden-winged warblers breeding in the Great Lakes:

lm5<-lm(gwGL$nbLON~gwGL$depLON)
summary(lm5)
## 
## Call:
## lm(formula = gwGL$nbLON ~ gwGL$depLON)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -8.0657 -0.8212 -0.3205  0.6809  5.1681 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 62.66601    8.01036   7.823 2.06e-08 ***
## gwGL$depLON  0.23595    0.08679   2.719   0.0113 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.685 on 27 degrees of freedom
## Multiple R-squared:  0.2149, Adjusted R-squared:  0.1858 
## F-statistic: 7.392 on 1 and 27 DF,  p-value: 0.01131
plot(gwGL$nbLON~gwGL$depLON, ylab="Nonbreeding longitude (degrees W)", xlab="Deployment site longitude (degrees W)", main = "Great Lakes golden-winged warblers")
abline(lm5)

Nonbreeding longitude as a function of breeding (deployment site) longitude for golden-winged warblers breeding in the Great Lakes excluding an outlier (ONG10):

lm5.1<-lm(gwGL$nbLON~gwGL$depLON, subset = gwGL$nbLON > 75)
summary(lm5.1)
## 
## Call:
## lm(formula = gwGL$nbLON ~ gwGL$depLON, subset = gwGL$nbLON > 
##     75)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -5.5353 -1.0390 -0.3685  0.5036  5.2826 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 75.21200    6.87393  10.942 3.15e-11 ***
## gwGL$depLON  0.10353    0.07413   1.397    0.174    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.088 on 26 degrees of freedom
## Multiple R-squared:  0.06978,    Adjusted R-squared:  0.034 
## F-statistic:  1.95 on 1 and 26 DF,  p-value: 0.1744
plot(gwGL$nbLON~gwGL$depLON, subset = gwGL$nbLON > 75, ylab="Nonbreeding longitude (degrees W)", xlab="Deployment site longitude (degrees W)", main = "Great Lakes golden-winged warblers (outlier removed)")
abline(lm5.1)

Recombine golden-winged warbler individuals and name populations

gwAM$pop<-"AM"
gwGL$pop<-"GL"
GW<-rbind(gwAM, gwGL)
head(GW)
##    birdID depLAT depLON    nbLON     nbLAT sp    popseg pop
## 37  TNG13 36.291 84.302 71.36582 11.983529  1 sapp_gwwa  AM
## 56  PAG12 40.995 77.701 69.86366 11.983529  1 napp_gwwa  AM
## 57   PA05 41.380 75.180 69.86366 11.983529  1 napp_gwwa  AM
## 58   PA11 41.380 75.180 63.85500  9.980643  1 napp_gwwa  AM
## 59  VAG01 38.260 79.627 71.36582 11.983529  1 sapp_gwwa  AM
## 60  VAG02 38.260 79.627 69.86366 11.983529  1 sapp_gwwa  AM

Boxplot of golden-winged warbler nonbreeding longitude by population (AM = Appalachian Mountains; GL = Great Lakes)

lm6<-lm(GW$nbLON~GW$pop)
summary(lm6)
## 
## Call:
## lm(formula = GW$nbLON ~ GW$pop)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -11.0331  -0.5424  -0.0173   0.9842   5.9914 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  70.4061     0.8058   87.38   <2e-16 ***
## GW$popGL     13.9957     0.9581   14.61   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 2.791 on 39 degrees of freedom
## Multiple R-squared:  0.8455, Adjusted R-squared:  0.8415 
## F-statistic: 213.4 on 1 and 39 DF,  p-value: < 2.2e-16
boxplot(GW$nbLON~GW$pop, xlab="Population", ylab="Nonbreeding longitude (degrees W)", main="Golden-winged warblers", col=c("#FFA800", "#E80000"))

Reintroduce blue-winged warbler individuals to the dataframe:

BW<-bw
BW$pop<-c("BW")
BWGW<-rbind(GW, BW)
BWGW$pop<-factor(BWGW$pop, levels = c("AM", "GL", "BW"))

Boxplot of nonbreeding longitude among Appalachian Mountain (AM) and Great Lakes (GL) golden-winged warblers and blue-winged warblers (BW), range-wide.

lm7<-lm(BWGW$nbLON~BWGW$pop)
summary(lm7)
## 
## Call:
## lm(formula = BWGW$nbLON ~ BWGW$pop)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -12.4004  -0.5363   0.1176   0.9842   6.1263 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  70.4061     0.8681   81.11   <2e-16 ***
## BWGW$popGL   13.9957     1.0322   13.56   <2e-16 ***
## BWGW$popBW   16.8652     1.0561   15.97   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 3.007 on 63 degrees of freedom
## Multiple R-squared:  0.8092, Adjusted R-squared:  0.8031 
## F-statistic: 133.6 on 2 and 63 DF,  p-value: < 2.2e-16
boxplot(BWGW$nbLON~BWGW$pop, sort=c("AM", "GL", "BW"), xlab="Group", ylab="Nonbreeding longitude (degrees W)", col=c("#FFA800", "#E80000", "chartreuse3"))

devtools::session_info()
##  setting  value                       
##  version  R version 3.3.2 (2016-10-31)
##  system   x86_64, mingw32             
##  ui       RTerm                       
##  language (EN)                        
##  collate  English_United States.1252  
##  tz       America/New_York            
##  date     2018-02-06                  
## 
##  package   * version date       source        
##  backports   1.0.5   2017-01-18 CRAN (R 3.3.2)
##  devtools    1.12.0  2016-06-24 CRAN (R 3.3.2)
##  digest      0.6.11  2017-01-03 CRAN (R 3.3.2)
##  evaluate    0.10    2016-10-11 CRAN (R 3.3.2)
##  htmltools   0.3.5   2016-03-21 CRAN (R 3.3.2)
##  knitr     * 1.15.1  2016-11-22 CRAN (R 3.3.2)
##  magrittr    1.5     2014-11-22 CRAN (R 3.3.2)
##  memoise     1.0.0   2016-01-29 CRAN (R 3.3.2)
##  Rcpp        0.12.9  2017-01-14 CRAN (R 3.3.2)
##  rmarkdown * 1.3     2016-12-21 CRAN (R 3.3.2)
##  rprojroot   1.2     2017-01-16 CRAN (R 3.3.2)
##  stringi     1.1.2   2016-10-01 CRAN (R 3.3.2)
##  stringr     1.1.0   2016-08-19 CRAN (R 3.3.2)
##  withr       1.0.2   2016-06-20 CRAN (R 3.3.2)
##  yaml        2.1.14  2016-11-12 CRAN (R 3.3.2)