#======================================================= # Figure 8.6.R. # R script to draw a scatterplot of sustainable yield vs. # harvesting effort for shrimp data from the Gulf of Mexico, # with parabolic yield-effort curve superimposed. #======================================================= #--------------------------------------------------------- # 1. Read and plot the data. # (a data file named shrimp_yield_effort_data.txt is assumed # to be in the working directory of R) #--------------------------------------------------------- df=read.table("shrimp_yield_effort_data.txt",header=TRUE) attach(df) plot(effort,yield,type="p",xlab="harvest effort",ylab="sustainable yield") detach(df) #--------------------------------------------------------- # 2. Calculate parabolic yield-effort curve and overlay it on # scatterplot. #--------------------------------------------------------- elo=100 # Low value of effort for calculating quadratic. ehi=350 # High value of effort. eff=elo+(0:100)*(ehi-elo)/100 # Range of effort values g=0.002866 h=1.342 sy=-g*eff^2+h*eff # Sustainable yield calculated for range of # effort values. points(eff,sy,type="l") # Add the quadratic model to the plot.