T&E.figures.txt

File Name: T&E.figures.txt

Author: Abt Associates Inc. Created: 5/27/2010 Updated: 12/15/2010 Purpose: R Script to create ECDF plots found in the T&E Chapter.

library(countreg)

facs=read.csv("facilities-no.california.csv") spp=read.csv("species.csv")

## ecdf plot of all facilities by species png(file="facility.all.ecdf.png",width=768,height=768,pointsize=24) par(mfrow=c(1,1)) plot(ecdf(facs$all),verticals=TRUE,xlab="Species per Facility",ylab="Cumulative Proportion of Facilities",xlim=c(-.05,28),main="",family="serif",cex.lab=1.2,cex=1.1,cex.axis=1 .1) dev.off()

## ecdf plot of all species by facility png(file="species.all.ecdf.png",width=768,height=768,pointsize=24) par(mfrow=c(1,1)) plot(ecdf(spp$facilities),verticals=TRUE,xlab="Facilities per Impacted Species",ylab="Cumulative Proportion of Species",xlim=c(-.05,160),main="",family="serif",cex.lab=1.2,cex=1.1,cex.axis=1.1 ) dev.off()

## ecdf plot of all species subsets by facility png(file="species.ecdf.png",width=1024,height=768,pointsize=24) par(mfrow=c(2,3)) par(oma=c(5,5,5,5)); par(mar=c(0.25,0.25,0.25,0.25)) plot(ecdf(subset(spp,spp$group=="o")$facilities),verticals=TRUE,xlab="Facilities per Impacted Species",ylab="Cumulative Proportion of Species",xlim=c(-.05,8),main="",family="serif",cex.lab=1.2,cex=1.1,cex.axis=1.1,y lim=c(0,1.1),xaxt="n",yaxt="n") mtext("Freshwater Fish (21)",line=-1.3,family="serif") axis(3,family="serif");axis(2,family="serif") mtext("Proportion of Species",side=2,line=2.5,cex=1.2,family="serif",at=-.08)

plot(ecdf(subset(spp,spp$group=="mar")$facilities),verticals=TRUE,xlab="Facilitie s per Impacted Species",ylab="Cumulative Proportion of Species",xlim=c(-.05,12),main="",family="serif",cex.lab=1.2,cex=1.1,cex.axis=1.1, xaxt="n",yaxt="n",ylim=c(0,1.1)) mtext("Marine Fish (3)",line=-1.3,family="serif") axis(3,family="serif")

plot(1, type="n", axes=F, xlab="", ylab="")

plot(ecdf(subset(spp,spp$group=="a")$facilities),verticals=TRUE,xlab="Facilities per Impacted Species",ylab="Cumulative Proportion of Species",xlim=c(-.05,65),main="",family="serif",cex.lab=1.2,cex=1.1,cex.axis=1.1, ylim=c(0,1.1)) mtext("Anadromous Fish (13)",line=-1.3,family="serif")

plot(ecdf(subset(spp,spp$group=="m")$facilities),verticals=TRUE,xlab="Facilities per Impacted Species",ylab="Cumulative Proportion of Species",xlim=c(-.05,85),main="",family="serif",cex.lab=1.2,cex=1.1,cex.axis=1.1, ylim=c(0,1.1),yaxt="n") mtext("Freshwater Mussels (43)",line=-1.3,family="serif") mtext("Facilities per Species",side=1,line=2.5,cex=1.2,family="serif")

plot(ecdf(subset(spp,spp$group=="t")$facilities),verticals=TRUE,xlab="Facilities per Impacted Species",ylab="Cumulative Proportion of Species",xlim=c(-.05,160),main="",family="serif",cex.lab=1.2,cex=1.1,cex.axis=1.1 ,ylim=c(0,1.1),yaxt="n")
Page 1T&E.figures.txt

mtext("Sea Turtles (6)",line=-1.3,family="serif")

dev.off()

## ecdf plots of all species within regions png(file="regions.ecdf.png",width=1024,height=1024,pointsize=24) regs=levels(facs$regs) regs[4]="Inland*" regs[9]="California" facs$regs[which(facs$regs=="Hawaii")]="West Coast" changes=read.csv("GL.changes.csv") changes[,2]=as.character(changes[,2]) for(i in 1:dim(changes)[1]){

facs$regs[which(facs$surveyid==as.character(changes[i,1]))]=as.character(changes[ i,2]) }

par(mfrow=c(3,3)) par(cex.axis=1.3) par(oma=c(5,5,5,5)); par(mar=c(0,0,0.25,0.25)) reg.count=c(67,30,0,669,54,26,17,0,8) for(i in c(9,6,3,5,7,3,2,1,4)){ if(i!=4&i!=3) plot(ecdf(subset(facs,facs$regs==levels(facs$regs)[i])$all),verticals=TRUE,xlab=" Number of Species per Facility",ylab="Cumulative Proportion of Facilities",xlim=c(-.05,8),main="",family="serif",cex.lab=1.2,cex=1.1,cex.axis=1. 1,yaxt="n",xaxt="n",ylim=c(0,1.1)) if(i==3)plot(0,0,yaxt="n",xaxt="n",ylim=c(-2,-1),xlim=c(-4,-2),bty="n") if(i==4) plot(ecdf(subset(facs,facs$regs==levels(facs$regs)[i])$all),verticals=TRUE,xlab=" Number of Species per Facility",ylab="Cumulative Proportion of Facilities",xlim=c(-.05,28),main="",family="serif",cex.lab=1.2,cex=1.1,cex.axis=1 .1,yaxt="n",xaxt="n",ylim=c(0,1.1)) if(i!=3) mtext(paste(regs[i]," (",reg.count[i],")",sep=""),line=-1.3,family="serif") #if(i>6) axis(1,family="serif",cex=1.3) if(i==4|i==2|i==1) axis(1,family="serif",cex=1.3) if(i==2|i==9|i==5) axis(2,at=c(0,0.2,0.4,0.6,0.8,1.0),labels=TRUE,family="serif",cex=1.3) if(i==6|i==7|i==4) axis(4,at=c(0,0.2,0.4,0.6,0.8,1.0),labels=TRUE,family="serif",cex=1.3) if(i==5) mtext("Proportion of Facilities",side=2,line=2.5,cex=1.2,family="serif") if(i==1) mtext("Species per Facility",side=1,line=2.5,cex=1.2,family="serif") } dev.off()

Page 2