Schefferville - generalists/specialists; GAMS for 0.2 and 1.0 m2 plots (mean)

Author: Tammy L. Elliott

Date:December 21, 2015

R version 3.2.0

Show GAM results

0.2 m2 results

cooc.02.gam.sqrt.te<-gam(cooc.02.z~te(phy.dist.sqrt,gen.spec.02), dat=data.cooc.02)
summary(cooc.02.gam.sqrt.te)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cooc.02.z ~ te(phy.dist.sqrt, gen.spec.02)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)  
## (Intercept)  -0.1695     0.1007  -1.682   0.0931 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                                 edf Ref.df     F p-value   
## te(phy.dist.sqrt,gen.spec.02) 7.595  9.646 2.668 0.00397 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.0411   Deviance explained = 5.41%
## GCV = 5.7821  Scale est. = 5.6935    n = 561
#only those species pairs <30my

cooc.02.gam.30<-gam(cooc.z.02.30~te(phy.dist.30.sqrt,gen.spec.02.30), dat=data.cooc.02.30)
summary(cooc.02.gam.30)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cooc.z.02.30 ~ te(phy.dist.30.sqrt, gen.spec.02.30)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -0.6138     0.1711  -3.587  0.00051 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                                       edf Ref.df     F p-value  
## te(phy.dist.30.sqrt,gen.spec.02.30) 16.05  18.13 2.079   0.011 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.191   Deviance explained = 29.8%
## GCV = 4.1527  Scale est. = 3.5725    n = 122

1.0 m2 results

# final GAM models

cooc.gam.sqrt.te<-gam(cooc.z~te(phy.dist.sqrt,gen.spec), dat=data.cooc)
summary(cooc.gam.sqrt.te)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cooc.z ~ te(phy.dist.sqrt, gen.spec)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)
## (Intercept)  -0.1580     0.1139  -1.387    0.166
## 
## Approximate significance of smooth terms:
##                              edf Ref.df    F  p-value    
## te(phy.dist.sqrt,gen.spec) 13.83  16.01 3.84 7.41e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.0876   Deviance explained =   11%
## GCV = 7.4778  Scale est. = 7.2801    n = 561
#only those species pairs <30my

cooc.gam.30<-gam(cooc.z.30~te(phy.dist.30.sqrt,gen.spec.30), dat=data.cooc.30)
summary(cooc.gam.30)
## 
## Family: gaussian 
## Link function: identity 
## 
## Formula:
## cooc.z.30 ~ te(phy.dist.30.sqrt, gen.spec.30)
## 
## Parametric coefficients:
##             Estimate Std. Error t value Pr(>|t|)   
## (Intercept)  -0.6962     0.2142  -3.251  0.00154 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Approximate significance of smooth terms:
##                                    edf Ref.df     F p-value  
## te(phy.dist.30.sqrt,gen.spec.30) 14.83   16.9 1.795  0.0379 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## R-sq.(adj) =  0.157   Deviance explained =   26%
## GCV =   6.43  Scale est. = 5.5959    n = 122

Plot GAMS

# Top graphs are for 0.2m2 plots, whereas bottom are for 1.0m2 plots
textClick.bold<-function(express,col="black",font=2,cex=NULL){
par(mar = rep(0, 4),xpd=NA)
text(locator(1),express,col=col,cex=cex)
}

#Plot four plots side-by-side
#dev.new(width=4.9, height=6)
#layout(matrix(1:4,ncol=2), width = c(1,1),height = c(1,1))
par(mfrow=c(2,2))
par(mar=c(3.5,3,2.75,0.75), mgp=c(1.5,0.3,0), las=0)

my.vis.gam(cooc.02.gam.sqrt.te, axes=FALSE, type="response", plot.type = "contour", color="gray",  main="", mgp=c(1.75,0.5,0),xlab="Phylogenetic distance (sqrt)",cex.main=0.1, lwd=2,cex.lab=1.15, cex=2, ylab="Mean niche width", font.lab=1)
axis(1,  tck=0.025, cex.lab=1.25, cex.axis=1)
axis(2, tck=0.025,  cex.lab=1.25, cex.axis=1)
box(bty="o", lwd=2)

my.vis.gam(cooc.02.gam.30, axes=FALSE, type="response", plot.type = "contour", color="gray",  main="", mgp=c(1.75,0.5,0),xlab="Phylogenetic distance (sqrt)",cex.main=0.1, lwd=2,cex.lab=1.15, cex=2, ylab="Mean niche width", font.lab=1)
axis(1,  tck=0.025, cex.lab=1.25, cex.axis=1)
axis(2, tck=0.025,  cex.lab=1.25, cex.axis=1)
box(bty="o", lwd=2)

my.vis.gam(cooc.gam.sqrt.te, axes=FALSE, type="response", plot.type = "contour", color="gray",  main="", mgp=c(1.75,0.5,0),xlab="Phylogenetic distance (sqrt)",cex.main=0.1, lwd=2,cex.lab=1.15, cex=2, ylab="Mean niche width", font.lab=1)
axis(1,  tck=0.025, cex.lab=1.25, cex.axis=1)
axis(2, tck=0.025,  cex.lab=1.25, cex.axis=1)
box(bty="o", lwd=2)

my.vis.gam(cooc.gam.30, axes=FALSE, type="response", plot.type = "contour", color="gray",  main="", mgp=c(1.75,0.5,0),xlab="Phylogenetic distance (sqrt)",cex.main=0.1, lwd=2,cex.lab=1.15, cex=2, ylab="Mean niche width", font.lab=1)
axis(1,  tck=0.025, cex.lab=1.5, cex.axis=1)
axis(2, tck=0.025,  cex.lab=1.5, cex.axis=1)
box(bty="o", lwd=2)

#textClick.bold("(a)", cex=1.25)
#textClick.bold("(b)", cex=1.25)
#textClick.bold("(c)", cex=1.25)
#textClick.bold("(d)", cex=1.25)