W ¼ NS
1
F
max
ð1 e
ax
1
ÞþNS
2
F
max
1 e
a
R
N
x
1
ðÞ
hi
ð2:76Þ
Begon and Parker (1986) predicted that under this model the propagule size in
the second clutch will be less than in the first. It is instructive to continue the
analysis of this scenario to illustrate the computational approach (for a theoretical
justification of the model see Box 4.10 in Roff [2002]). Parameter values are set at
S
1
¼ 0.005, S
2
¼ 0.002, F
max
¼ 2, a ¼ 1, R ¼ 400, and N ¼ 100.
2.13.3 Plotting the fitness function
Because the total reserve is fixed, the size of the propagules in the first clutch
cannot exceed R/N ¼ 400/100 ¼ 4, and the size of the propagules in the second
clutch cannot exceed (R/N) x
1
.Ifx
1
> 4 then fitness is set to zero (this state can be
avoided by not exceeding 4 in the program) and if x
2
> (R/N) x
1
the expected
fecundity of offspring from the second clutch is set to zero simply by setting egg
size to zero (Figure 2.11).
R CODE (Figure 2.11):
Note the use of max to ensure that egg size is not smaller than 0.
rm(list¼ls()) # Remove all objects from memory
FITNESS <- function(x1) # Fitness function
{
# Parameter values
S1 <- 0.005; S2 <- 0.002; Fmax <-2;a<-1;N<- 100; R <- 400
ExpFec1 <- Fmax*(1-exp(-a*x1)) # Expected fecundity from 1st
clutch
x2 <- (R/N)-x1 # Propagule size in 2nd clutch
x2 <- max(x2,0) # If x2 <0 set x2¼0
ExpFec2 <- Fmax*(1-exp(-a*x2)) # Expected fecundity from 2nd
clutch
W <- N*(S1*ExpFec1þS2*ExpFec2) # Fitness
# Check to see if x1 is acceptable size
Xmax <- N*x1
if(Xmax>R) {W<-0 } # if x1 too big set fitness to zero
return(W) # Return fitness
}
# MAIN PROGRAM
x <- matrix(seq(from¼0, to¼4, length¼100)) # Vary x1 from 0 to 4
W <- apply(x,1,FITNESS) # Calculate and store W
# Plot results
plot(x,W, type¼’l’, xlab¼’Propagule size, x1’, ylab¼’Fitness,
R0’,las¼1,lwd¼3)
MATLAB CODE: See Section 2.18.25.
116 MODELING EVOLUTION