Output[Igen,2] <- Nos.of.Rocks/N # Proportion of Rocks
Output[Igen,3] <- Nos.of.Scissors/N # Proportion of Scissors
Output[Igen,4] <- Nos.of.Papers/N # Proportion of Papers
Output[Igen,5] <- Prop.R # Frequency of allele R
Output[Igen,6] <- Prop.S # Frequency of allele S
Output[Igen,7] <- Prop.P # Frequency of allele P
# Calculate new proportion of Rocks by applying fitness criterion
Propns <- FITNESS(Morph,PayoffMatrix,Genotypes)
Prop.R <- Propns[1] # Frequency of allele R
Prop.S <- Propns[2] # Frequency of allele R
Prop.P <- Propns[3] # Frequency of allele R
} # End of Igen loop
par(mfrow=c(2,2)) # 4 plots per page
plot(Output[,1], Output[,2], type=’l’, xlab=’Generation’,
ylab=’Morph Proportions þ X’, ylim=c(0.0,1.8)) # Plot Rocks
lines( Output[,1], Output[,3]þ0.5, lty=2) # Add Scissors to plot
lines( Output[,1], Output[,4]þ1.0, lty=3) # Add Papers to plot
# Add predicted line to plots
lines(Output[,1], rep(0.3333,MaxGen)) # “Predicted” ESS
lines(Output[,1], rep(0.3333þ0.5,MaxGen)) # “Predicted” ESS
lines(Output[,1], rep(0.3333þ1,MaxGen)) # “Predicted” ESS
# Plot Allele frquencies
plot(Output[,1], Output[,5], type=’l’, xlab=’Generation’,
ylab=’Allele Proportions’, ylim=c(0.0,1)) # Plot Rocks
lines( Output[,1], Output[,6], lty=2) # Add Scissors to plot
lines( Output[,1], Output[,7], lty=3) # Add Papers to plot
# Phase plots showing proportion of two morphs
plot(Output[,2],Output[,3],type=’l’, xlab=’Rocks’, ylab=’S-
cissors’)
plot(Output[,2],Output[,4],type=’l’, xlab=’Rocks’, ylab=’Pa-
pers’)
# plot(Output[,3],Output[,4],type=’l’, xlab=’Scissors’, ylab=’
Papers’)
# Print mean proportions starting at generation 400
print(’ Mean proportions (R,P,S) from Generation 400 to MaxGen’)
c(mean(Output[400:MaxGen,2]),mean(Output[400:MaxGen,3]),
mean(Output[400:MaxGen,4]))
print(’ Mean allele freqs (R,P,S) from Generation 400 to MaxGen’)
c(mean(Output[400:MaxGen,5]),mean(Output[400:MaxGen,6]),
mean(Output[400:MaxGen,7]))
OUTPUT: (Figure 5.9)
314 MODELING EVOLUTION