derivation) and hence all values greater than this can be set to zero (coding given
in figure caption). A plausible model for this type of function (i.e., single maxi-
mum) is that offspring survival and body size, which controls future fecundity,
decreases with clutch size but, because fitness is equal to clutch size times, the
expected fecundity of each offspring, fitness initially increases with clutch size.
The optimum clutch size for a single clutch can be obtained from the calculus
dBenefit
i;n
dn
¼ b
i
þ 2c
i
n þ 3d
i
n
2
ð6:20Þ
The optimum clutch size is then found by setting dBenefit
i;n
=dn ¼ 0 and solving the
resultant quadratic (see Scenario 1 of Chapter 2), say n*. It will never be optimal for
a female to lay more eggs than n*, but it could be optimal to lay fewer eggs if the
host is of poor quality and the female is likely to find higher quality hosts in the
future. As noted above, to avoid the unreal behavior of at least one of the single
host fit we set values greater than n* equal to zero.
3. The probability of encountering a host is constant but different for each host,
designated as Pbenefit
i
, where i is the ith host type. Thus the probability of not
encountering a host, P
0
,is
Host.coeff[3,] <- c(-0.1048, 2.2097, -0.0878, 0.0004222)
Host.coeff[4,] <- c(-0.0524, 2.0394, -0.0339, -0.0003111)
# Calculate benefit as a function of
# clutch size (rows) and Host type (columns)
Clutch <- seq(from = 0, to = Xmax)
Benefit <- matrix(0, Max.Index, 4) # Zero to Xmax
for (I.Host in 1:4) # Iterate over host types
{
Benefit[,I.Host] <- Host.coeff[I.Host,1] + Host.coeff[I.
Host,2]*Clutch + Host.coeff[I.Host,3]*Clutch^2 + Host.coeff[I.
Host,4]*Clutch^3
}
# Plot data
plot(Clutch, Benefit[,1],type=‘l’, xlab=‘Clutch size’,ylab=“-
Female Fitness”, las=1, lwd=4)
# lwd = line width, lty = line type,1=solid, 2=dashed, 3=dotted,
4=dotdash,
for (i in 2:4){lines(Clutch, Benefit[,i],type=‘l’, lwd=4,
lty=i)}
SHM <- c(9,12,14,23) # Set single host maximum. See text for
derivation
# Make all values > than SHM=0. Note that we use 1 because of zero
class
for (i in 1:4){Benefit[(SHM[i]+1):Max.Index,i] <- 0}
DYNAMIC PROGRAMMING 377