## Abstract

In order to avoid both starvation and disease, animals must allocate resources between energy reserves and immune defence. We investigate the optimal allocation. We find that animals with low reserves choose to allocate less to defence than animals with higher reserves because when reserves are low it is more important to increase reserves to reduce the risk of starvation in the future. In general, investment in immune defence increases monotonically with energy reserves. An exception is when the animal can reduce its probability of death from disease by reducing its foraging rate. In this case, allocation to immune defence can peak at intermediate reserves. When food changes over time, the optimal response depends on the frequency of changes. If the environment is relatively stable, animals forage most intensively when the food is scarce and invest more in immune defence when the food is abundant than when it is scarce. If the environment changes quickly, animals forage at low intensity when the food is scarce, but at high intensity when the food is abundant. As the rate of environmental change increases, immune defence becomes less dependent on food availability. We show that the strength of selection on reserve-dependent immune defence depends on how foraging intensity and immune defence determine the probability of death from disease.

## 1. Introduction

It is widely acknowledged that an animal's nutritional or energetic state can have a strong effect on its response to pathogens and parasites (Michael & Bundy 1992; Chandra 1996, 1997, 1999, 2002; Demas & Nelson 1998; Klasing 1998; Coop & Kyriazakis 1999, 2001; Demas 2004). An obvious explanation for this fact is that animals in poor condition are more susceptible to disease because they do not have the necessary resources to mount an adequate response. Although such constraints are likely to exist, we argue that another effect needs to be considered. Animals must decide between allocating resources to energy reserves and immune defence. Thus, when reserves are needed to avoid starvation, there is a trade-off between the risks of starvation and disease. The value in terms of future reproductive success of an increase in reserves depends on an animal's current level of reserves (McNamara & Houston 1986; Clark 1994; Houston & McNamara 1999; Clark & Mangel 2000). This value is typically high when reserves are low and decreases as reserves increase. When reserves are high, the value of an increase in reserves is often very low (McNamara & Houston 1986; Houston & McNamara 1999). This effect will tend to mean that the optimal allocation to immune defence decreases as reserves decrease. A second effect will augment this tendency. When the reserves of an animal are low, the value of its life is low. The animal should therefore be prepared to take risks, in terms of disease, in order to increase reserves. In contrast, when reserves are high, the value of the animal's life is high and the animal should guard this asset by investing in immune defence. In this paper, we formalize these ideas in an analytic model and prove that it is optimal to increase the allocation to immune defence as reserves increase. We also illustrate and explore the magnitude of the effects and their dependence on parameters in a computational model. Immunity is accomplished by processes that are constitutive in all of the body's cells as well as by the actions of leucocytes. Our model integrates these processes into a single measure of immunity, which we quantify in terms of energetic costs devoted to all functions necessary for immune defences.

Although there have been previous models of optimal immune defence (e.g. Shudo & Iwasa 2001; Medley 2002; van Boven & Weissing 2004), our models are the first to consider the state-dependent effects. In both of our models, we find the optimal way in which foraging intensity and immune defence should depend on reserves. In addition, we use the computational model to establish the selective advantage that results from state-dependent defence. Our models use energy to illustrate the generalized relationships between nutrient reserves, ecological variables and optimal immunity; however, the resulting general trends should be valid for other nutrients, including protein, vitamins and trace minerals, that are also critical for immunocompetence.

## 2. The analytic model

Let *V*(*x*, *t*) denote the reproductive value of an individual with reserves *x* at time *t*, given that behaviour is optimal. The function *V* specifies the expected future reproductive success of the animal and is the current value of the animal's life (Houston & McNamara 1999). The rate at which reproductive value increases with increasing energy reserves, ∂*V*/∂*x*, measures the value, in terms of future reproductive success, of an increase in reserves. The ratio of this marginal value of food to the value of life,(2.1)is crucial in determining the optimal trade-off between starvation and predation (Houston & McNamara 1989, 1999; Clark 1994; Brown & Kotler 2004). We show below that it is also central to the optimal allocation to immune defence. Note that as *V*(*x*, *t*) usually increases with increasing *x* and ∂*V*/∂*x* usually decreases with increasing *x*, the ratio *R*(*x*) typically decreases as *x* increases (McNamara 1990; Houston & McNamara 1999).

Consider an animal that must choose how hard to work in order to obtain food. Let the animal have reserves *x* at time *t*. Suppose that between time *t* and time *t*+*δ* (where *δ* is small) the animal forages with intensity *u* and expends energy on immune defence at rate *z*. Thus, during this time interval, the animal has net rate of energy gain *γ*(*u*, *x*)−*z*. We denote its predation rate by *M*(*u*, *x*) and its mortality rate from disease by *λ*(*z*). Then, the animal is alive at time *t*+*δ* with probability 1−[*γ*(*z*)+*M*(*u*, *x*)]*δ* (to first order in *δ*), and if it is alive it has energy reserves *x*+[γ(*u*, *x*)−*z*]*δ* at this time. Thus, given that behaviour after time *t*+*δ* is optimal, the animal's expected future reproductive success is(2.2)to first order in *δ*. Taylor expanding the function *V* and again ignoring terms of higher order in *δ* gives(2.3)From this expression, we see that *H*(*u*, *z*) is maximized if(2.4)is maximized as a function of *u* (cf. Houston & McNamara 1989, 1999), and(2.5)is minimized with respect to *z*.

To find the optimal value, *z*^{*}(*x*), of *z* we differentiate equation (2.5) with respect to *z* and set the derivative to zero:(2.6)Because we are looking for the minimum, the second derivative must also be positive,(2.7)From equation (2.6), it follows that(2.8)where *R*(*x*) is given by equation (2.1). To investigate the dependence of optimal immune defence on reserves, we differentiate equation (2.8) with respect to *x*. This gives Since *R*′(*x*)<0 and condition (2.7) holds, it follows that(2.9)that is, the optimal allocation to immune defence increases as energy reserves increase.

The trade-off between allocation to reserves as opposed to immune defence is analogous to the trade-off between reserves and predation risk. When there is a trade-off between food and predation, it is well known that the acceptable predation risk decreases as reserves increase (McNamara 1990; McNamara & Houston 1990; Clark 1994; Houston & McNamara 1999). Our results on optimal allocation to immune defence are the direct analogue of these results.

## 3. The computational model

We now consider a computational model that goes beyond the analytic model in allowing the infection rate to depend on behaviour. We consider an animal's behaviour over an extended period such as winter during which it is not growing or reproducing (for discussion of the general allocation problem see Coop & Kyriazakis 1999). The animal is characterized by its stored energy reserves. We ignore the day–night cycle and divide each day into 100 equally spaced decision epochs. At a decision epoch, the animal simultaneously controls its foraging intensity and its investment of energy in immune function. We identify foraging intensity with the proportion of time spent foraging between decision epochs. Thus 0≤*u*≤1. Increasing foraging intensity not only increases the chance that the animal finds food by the next decision epoch, but also increases the risk of being predated. Predation risk also increases with energy reserves (for discussion see Witter & Cuthill 1993 and Cuthill & Houston 1997). Details are given in the electronic supplementary material, appendix. The change in energy reserves between decision epochs equals the energy found from food minus expenditure on metabolic activity and immune defence (see appendix in the electronic supplementary material). If energy reserves fall to zero, the animal dies of starvation.

An animal's probability of death from disease will depend on the rate *z* which it invests in its immune defence. It is also possible that high rates of energy intake are associated with high risks of infection (e.g. Hutchings *et al*. 2001*a*,*b*, 2002*a*,*b*; Bustnes & Galaktionov 2004; Madsen *et al*. 2007). To represent this effect, we allow the probability of infection and death to depend on both *z* and *u*. If the animal forages with intensity *u*, and invests at rate *z* in its immune defence, then it is infected and dies at the next decision epoch with probability *D*(*u*, *z*). To investigate the robustness of our conclusions, we consider two forms of dependence on *z*. *D*(*u*, *z*) is given by either(3.1)or(3.2)Although we do not want to be specific about the various processes of infection, illness and death that underlie these equations, it is convenient to view *d*_{0} as the rate of challenge by pathogens (which depends on the abundance of pathogens in the environment) when the animal does not forage and *d*_{1} as the increase in risk associated with foraging. This means that when *d*_{1} is zero, foraging behaviour has no effect on risk, but when *d*_{1}>0, the animal can influence its risk by choosing its foraging intensity. The parameters *K* in equation (3.1) and *L* in equation (3.2) are measures of the efficiency of the immune defence: the larger the value of *K* or *L*, the more effective is a given level of resource allocated to defence. The functions given by equations (3.1) and (3.2) are broadly similar in that probability of death from disease *D* decreases and tends to zero with increasing investment in defence. They differ in the marginal effect of additional investment. When equation (3.2) holds, each additional unit of energy devoted to defence reduces *D* by a given proportion. In contrast, when equation (3.1) holds, the proportional effect on *D* decreases with the amount of energy already invested.

During the winter, there are three sources of mortality: starvation, predation and disease. A strategy for the animal specifies how its foraging intensity, *u*, and allocation, *z*, depend on its energy reserves. These decision variables determine the levels of mortality from the three sources. For example, an animal can reduce its predation risk by reducing its foraging intensity, but this leads to lowered reserves, which increases the probability of starvation and can also increase the risk of death from disease because less energy can be afforded for immune defence.

We use dynamic programming to find the strategy (i.e. the optimal foraging intensity, *u*^{*}, and optimal allocation, *z*^{*}) that minimizes the long-term mortality rate. This strategy maximizes the animal's probability of survival over the winter (McNamara 1990). We emphasize that the model characterizes the animal's general ecology (e.g. availability of food, prevalence of disease, dependence of predation on state and foraging behaviour). From this we find the optimal behaviour and the resulting levels of mortality.

In presenting the results we refer to the minimum possible rate of energy expenditure per day as basal metabolic rate (BMR). Note that in our terminology BMR does not include expenditure on immune defence. Since the minimum expenditure per decision epoch is *b*_{0} (see appendix in the electronic supplementary material) and there are 100 decision epochs per day, BMR=100*b*_{0}. Results about the rate of expenditure on the immune defence are expressed in terms of *z*/*b*_{0}, which is the rate relative to BMR.

## 4. Results

Because metabolic expenditure and/or predation risk increase with energy reserves, under all parameters investigated the optimal foraging intensity decreases as energy reserves increase, except if reserves are very low, when animals forage with maximum intensity (figure 1*b*). As a consequence, the level of energy reserves is regulated by behaviour and not by an upper limit on reserves (cf. Houston & McNamara 1993; McNamara *et al*. 1994; Houston *et al*. 1997). Our baseline values for parameters are given in the electronic supplementary material, table 1. For these parameters, the animal chooses to regulate reserves so that mean reserves are around one and a half units (of energy expended in a day at BMR; figure 3*c*). Thus, the animal can survive less than 2 days without food at minimum expenditure. This case might be appropriate for a small passerine bird or insectivorous mammal.

### (a) The optimal strategy

For most of the parameter combinations, the energy spent on immune defence increases with the level of energy reserves (as illustrated in figure 1*a*). In some exceptional cases, when foraging intensity has a large effect on the probability of death from disease, the amount spent on immune defence does not increase with reserves (figure 1*a*, thick grey lines).

Mortality from disease decreases steeply with reserves when reserves are very low (figure 1*c*). When reserves are higher, mortality tends to level off. Regardless of reserves, mortality does not markedly increase with the intensity of infectious challenges, largely because investment in immune defence increases with disease pressure.

Figure 1*d* illustrates how the animals' reproductive value changes with reserves in the computational model. Note that the reproductive value increases with reserves, but the rate of increase decreases, as assumed by the analytic model.

In order to investigate the selection pressure (e.g. Houston & McNamara 1986; McNamara & Houston 1990, 1992; Houston *et al*. 1992) on reserve-dependent immune investment, we performed runs where we constrained the model animals to use a fixed, reserve-independent immune investment. Optimizing this fixed investment in the baseline case (figure 2*a*) shows that animals invest less in the immune defence when investment is fixed. This reduction occurs in order to avoid high starvation risk when reserves happen to drop. In this case, overwinter survival is much lower under the best fixed investment than under the optimal reserve-dependent strategy (figure 2*a*). Further computations show that the selective advantage of the flexible investment is most pronounced when the environment is harsh, i.e. overwinter survival is lower (figure 2*b*) and is reduced when the probability of death from disease *D*(*u*, *z*) is given by equation (3.2) rather than equation (3.1). The form of the equation for *D* matters owing to the difference in the marginal value of investment. When equation (3.1) holds, once *D* has been reduced to a reasonable level, additional investments in defence have little effect unless they are large; and large investments can only be afforded at high reserves. This makes state-dependent decision making important in this case.

### (b) Effects of food supply

Increasing the mean amount of food available per unit time, *p*_{f}*a*_{f}, increases the rate of investment in the immune defence, *z* (figure 3*a*), and decreases the overwinter mortality from all sources (figure 3*b*). Increasing the variance in food, , decreases the investment in immune defence (figure 3*d*) and increases the overwinter mortalities (figure 3*e*). Increasing mean food availability reduces starvation risk and increases energy available for immune defence. In contrast, increasing the variance in food increases starvation risk and hence increases the benefit of storing energy as opposed to spending it on immune defence.

The mean level of reserves first slightly increases (since there is not enough food to maintain a high level of reserves at low food availability) and then decreases as the mean amount of food increases (figure 3*c*). Increasing the variance in food has a simpler effect; mean reserves increase over the whole range of variance studied, though the increase is decelerating (figure 3*f*; cf. Houston & McNamara 1993).

### (c) Changing food availability

We extend the current model to allow food availability to change over time (for details see appendix in the electronic supplementary material). Changes might be due, for example, to changes in weather or prey behaviour. Under these circumstances, an animal's optimal level of immune defence and optimal foraging intensity will depend on both its energy reserves and current food availability (figure 4). Computations are based on food availability changing between three levels: high, medium and low. When food availability is high, the animal invests more in immune defence than when it is medium or low (figure 4*a*). The effect of food availability on immune defence depends on how fast the environment changes. If the animal expects current food availability to persist for a long period of time (i.e. the environment changes slowly; low value of *p*_{c}), then the difference in investment in immune defences is significant (figure 4*b*). On the other hand, if the environment changes quickly (high *p*_{c}), then the level of investment in immune defence hardly changes with current food availability (figure 4*b*).

The effect of rate of environmental change on the optimal foraging intensity is shown in figure 4*c*. When the environment is quite stable (low *p*_{c}), animals forage most intensely when the food availability is low. In contrast, when the environment changes quickly, animals forage at low intensity when food availability is low, but have maximal foraging intensity at high food availability.

## 5. Discussion

Our models are the first models of immunity to establish that optimal defence should be state dependent. In addition, the computational model is novel in that immunity is considered in a broad ecological context in which sources of mortality and their dependence on state and behaviour are explicit. Under the conditions of the analytic model, we have proved that the optimal allocation increases with reserves. In the more general computational model, we find the same pattern in cases which are covered by the analytic model. We emphasize that the result is not simply a direct consequence of the limit imposed by available reserves; it is optimal to allocate less than the available amount to defence (figure 1). We also illustrated the effect of an increasing risk of death from disease with foraging intensity. This might occur because an increase in foraging intensity increases the probability of ingesting parasites or pathogens (Hutchings *et al*. 2001*a*,*b*, 2002*a*,*b*, 2006; Bustnes & Galaktionov 2004). In this case (a case not covered by the analytic model), optimal allocation to immunity may peak at an intermediate level of reserves (figure 1*a*, thick grey lines). This is because at high reserves foraging intensity, and hence risk of death from disease, is reduced. This emphasizes that animals can control diseases not just by the means of immune defence, but by behaviour too.

The amount of energy spent on optimal immune defence depends on the form of the mortality function *D*(*u*, *z*). When the function is given by equation (3.2), the mean energy expenditure ranges from 0.2 to 0.35 BMR which is comparable to the values found by Freitak *et al*. (2003), Martin *et al*. (2003) and Eraud *et al*. (2005). The function given by equation (3.1) results in higher levels of energy expenditure (between 0.5 and 1.5 BMR). It must be remembered, however, that our model is based on a single line of defence, so it is not easy to compare our results directly with data from animals which change the allocation to immune defence once they become infected (Shudo & Iwasa 2001).

In the context of an animal choosing between two options that differ in terms of energetic gain and predation risk, McNamara & Houston (1990) and Houston *et al*. (1992) show that the optimal state-dependent strategy has a much higher fitness than state-independent strategies. In that case, the optimal state-dependent strategy is compared with strategies that have a fixed probability of choosing an option. In evaluating the selective advantage of state-dependent immune defence, we compare the optimal strategy with a strategy that uses the best state-independent level of investment in immune defence. Under this strategy, the foraging intensity is optimal given the level of reserves, so that foraging behaviour can to some extent compensate for the fixed level of immune defence. As a result, there are environments in which the selective advantage of state-dependent immune defence is small. In addition, the magnitude of the selective advantage depends on the form of *D*(*u*, *z*) with equation (3.2) resulting in smaller effects than equation (3.1).

To isolate the effect that we are interested in, we have assumed that there is no increase in susceptibility to disease as reserves decrease and that there is no direct effect of reserves on the probability of death from disease. With these assumptions, the reserve-dependent allocation to defence means that for low reserves as reserves decrease, death from disease increases.

Figure 3*b* shows that as mean food availability increases, death from predation and death from disease both decrease. This means that it is possible that improving the food supply reduces disease, even though there is no direct effect of reserves on disease, and highlights the importance of food in combating disease.

It can be seen from figure 3*b*,*e* that the optimal strategy can result in some sources of mortality being higher than others. This is not surprising. A general feature of an optimal solution is that it is not the levels of factors but their slopes that are equal (e.g. McNamara & Houston 1987; Houston & McNamara 1999). Even if a level of mortality is small, it does not mean that it is insignificant. For example, McNamara *et al*. (1987) investigate optimal daily routines of singing and foraging. The routines are driven by the threat of starvation, but at the optimal solution, levels of starvation are very low. In the current model, the strategy is driven by the threat of disease, but at the optimal solution, levels of death from disease are typically low.

The pattern of an increase in immune defence with increasing reserves is based on the state-dependent optimal strategy within a particular environment. A different pattern may emerge if we consider the optimal behaviour for each of a range of environments. For example, figure 3*d–f* shows that as the variability in food is increased while the mean is kept constant, immune defence decreases (figure 3*d*) and energy reserves increase (figure 3*f*). Thus, across environments, there is a negative correlation between reserves and immune defence. This sort of counter-intuitive correlation has been observed in other contexts; across environments there can be a positive correlation between energy reserves and death from predation (Houston & McNamara 1993; McNamara *et al*. 2001).

We have kept our models simple in order to establish the importance of state-dependent decisions about immunity. Future work could include components of state other than energy reserves and could explore immunity in the context of an annual cycle that includes breeding.

## Acknowledgments

We thank two anonymous referees for their helpful comments. J.M.M. acknowledges the support of the Leverhulme Trust. Z.B. was supported by a BBSRC grant to A.I.H and J.M.M. K.C.K. acknowledges the support of NSF (IBN 0212587). The study was supported by OTKA grants NF 61143 and T046661.

## Footnotes

Electronic supplementary material is available at http://dx.doi.org/10.1098/rspb.2007.0934 or via http://www.journals.royalsoc.ac.uk.

- Received August 11, 2007.
- Accepted August 20, 2007.

- © 2007 The Royal Society