key: cord-0005310-2lz4fr5e authors: Davis, Courtney L.; Adler, Frederick R. title: Mathematical Models of Memory CD8(+) T-Cell Repertoire Dynamics in Response to Viral Infections date: 2013-02-02 journal: Bull Math Biol DOI: 10.1007/s11538-013-9817-6 sha: f968580d78a252c8083a50dcb6c3ac62a7933400 doc_id: 5310 cord_uid: 2lz4fr5e Immunity to diseases is conferred by pathogen-specific memory cells that prevent disease reoccurrences. A broad repertoire of memory T-cells must be developed and maintained to effectively protect against viral invasions; yet, the total number of memory T-cells is constrained between infections. Thus, creating memory to new infections can require attrition of some existing memory cells. Furthermore, some viruses induce memory T-cell death early in an infection, after which surviving cells proliferate to refill the memory compartment. We develop mathematical models of cellular attrition and proliferation in order to examine how new viral infections impact existing immunity. With these probabilistic models, we qualitatively and quantitatively predict how the composition and diversity of the memory repertoire changes as a result of viral infections. In addition, we calculate how often immunity to prior diseases is lost due to new infections. Comparing our results across multiple general infection types allows us to draw conclusions about, which types of viral effects most drastically alter existing immunity. We find that early memory attrition does not permanently alter the repertoire composition, while infections that spark substantial new memory generation drastically shift the repertoire and hasten the decline of existing immunity. ies that help remove extracellular pathogens, while memory CD8 + T-cells kill infected host cells to eliminate viruses inside. Immune protection requires the persistence of memory cells; yet, between infections the total number of memory cells returns to a relatively constant level (Freitas and Rocha 1993; Tanchot and Rocha 1995) . Maintaining this homeostatic memory compartment size despite post-infection influxes requires that some existing memory be replaced by newly generated memory cells. Even when the memory compartment permanently grows after infection, some loss of prior memory can occur (Vezys et al. 2009 ). Thus, immune memory established via infections or vaccination can decline upon subsequent infections by other pathogens (De Boer et al. 2003; Selin et al. 1999) . We explore the impact of new infections on existing immune memory under homeostatic constraints. For simplicity, we assume a constant homeostatic memory compartment size, but we discuss how to extend our models and results to allow for compartment growth. Most infections add newly generated memory cells to a full memory compartment (Janeway et al. 2005) . The resulting scarcity of survival signals like interleukin 15 (IL-15) prompts passive attrition, the death of memory cells following an infection to restore the homeostatic memory compartment size (Kennedy et al. 2000; Ku et al. 2000; Selin et al. 2006; Welsh et al. 2004b ). Viruses such as SARS, measles, influenza, and West Nile also cause a large number of memory T-cells to die in the first 1-4 days of infection, a process called active attrition, and create an immunedeficient environment known as lymphopenia (Bahl et al. 2006; Kim et al. 2005; Selin et al. 2006; Welsh et al. 2004a Welsh et al. , 2004b . Surviving memory cells as well as some naive cells then proliferate (and differentiate if necessary) to refill the memory compartment, a process termed lymphopenic (or homeostatic) proliferation (Almeida et al. 2005; Goldrath 2002; Sprent and Surh 2001) . However, the memory compartment might not return to its previous composition, which means that immunity to some diseases could be weakened or lost (Selin et al. 1996 (Selin et al. , 1999 . Memory B, CD8 + T, and CD4 + T cells are all subject to homeostatic regulation, yet different memory pools are independently maintained Rocha 1993, 2000; Kitamura et al. 1991; Mombaerts et al. 1992; Tanchot et al. 2000; Rahemtulla et al. 1991; Zijlstra et al. 1990; Cosgrove et al. 1991) . We focus on how the memory CD8 + T-cell population changes with new viral infections. Every T-cell possesses a T-cell receptor that recognizes a specific peptide sequence (antigen) complexed with MHC molecules. We define a T-cell lineage as all T-cells that possess the same Tcell receptor (i.e., a T-cell clone). The range and size of lineages covered by existing memory CD8 + T-cells defines the memory CD8 + T-cell repertoire. The composition of the memory repertoire determines the breadth of diseases against which the host is immune. We explore how active attrition, new memory generation, and homeostatic regulation of the memory CD8 + T-cell compartment impact the lineage distribution in the memory repertoire, and thus alter overall immunity. Memory repertoire changes have been examined experimentally by infecting inbred mice with sequences of heterologous viruses and sacrificing them at different times to count disease-specific memory CD8 + T-cells (Selin et al. 1996 (Selin et al. , 1999 Chapdelaine et al. 2003; Bahl et al. 2006) . However, inbred mice with the same infection history possess private specificities for diseases, so these repertoire snapshots cannot precisely show how memory lineages change in a single host (Kim et al. 2005; Welsh et al. 2006) . Nevertheless, these experiments substantiate the hypothesis that memory to one disease is diminished upon subsequent infection with other pathogens Selin et al. 1996 Selin et al. , 1999 Selin et al. , 2006 . Using MHC tetramers to observe changes in particular memory lineages following proliferative immune responses yields similar results (McNally et al. 2001; Kim et al. 2005) . MHC tetramers have also shown that substantial attrition of bystander memory CD8 + T-cells occurs early in infection followed by an imperfect rebound in lineage frequencies leading into homeostasis (McNally et al. 2001; Kim and Welsh 2004; Selin et al. 2006) . The authors hypothesize that post-infection (passive) attrition of memory cells should permanently alter the memory repertoire less than early, active attrition of memory Selin et al. 2006) . Mathematicians have investigated immune repertoire dynamics by using probabilistic and statistical methods to estimate the number of lineages in the T-cell repertoire (Barth et al. 1985; Behlke et al. 1985; Hsieh et al. 2006; Pacholczyk et al. 2006; Sepúlveda et al. 2010) . Sepúlveda et al. (2010) evaluate both the frequency and size of T-cell lineages within the T-cell repertoire at one time point using Poisson abundance models. Venturi et al. (2007) use statistical approaches to compare sampled repertoires of T-cells (including memory T-cells) from different mice to determine how individual hosts respond differently to infections. Three models examine how infections alter the memory repertoire over time. The first, by Antia et al. (1998) was extended by Ganusov et al. (2006) ; they model changes in memory CD8 + T-cell lineage sizes following infections that induce new memory cell generation followed by passive attrition to restore a constant homeostatic memory compartment size. They enforce compartment constancy via a frequency-proportionate decrease in all memory lineages after an infection, and find that decay in existing memory lineages is directly proportional to the total number of cells in previously unoccupied memory lineages and inversely proportional to the homeostatic size of the memory compartment (Antia et al. 1998; Ganusov et al. 2006) . Selin et al. (2004) used IMMSIM, a cellular automata model of the immune system, to determine that active attrition hinders the growth of medium-affinity cross-reactive T-cell memory allowing new lineages with higher affinities to arise while passive attrition leads to lineage codominance. We build on Ganusov's model by using stochastic processes to model new memory generation and passive attrition and to judge their impact on the entire memory compartment. We additionally consider infections in which active attrition and lymphopenic proliferation occur. A stochastic rather than deterministic approach allows us to determine lineage extinction likelihoods, extinction waiting times, lineage size probability distributions, and biodiversity shifts not captured by mean lineage dynamics. We develop two mathematical models to examine three infection scenarios (Fig. 1 , Table 2 ): (1) Active attrition and lymphopenic proliferation: 20-80 % of memory CD8 + Tcells die regardless of lineage early in infection. Surviving cells then proliferate to refill the memory compartment. Fig. 1 An overview of the infection types is given. Individual infection scenarios are: (a) Active attrition (AA) and lymphopenic proliferation (LP), (b) New memory cell generation (NG) and passive attrition (PA), (c) Active attrition and new memory cell generation and either passive attrition or lymphopenic proliferation (LP). Infections that induce active attrition reduce the memory compartment below its homeostatic size. Infections that spark sufficient new memory cell generation boost the memory compartment above its homeostatic size. The degree of attrition or proliferation vary throughout this paper, and the heights depicted here are not to scale. Bona fide memory versus newly differentiated naive cell contributions in (a) vary (2) Antigen-induced new memory cell generation and passive attrition: A virus stimulates an immune response and new memory cell generation followed by passive attrition to return the now overfilled compartment to its homeostatic size. (3) Active attrition combined with antigen-induced immune responses: Unlike in (1), this scenario includes an antigen-induced immune response that specifically targets the attrition-causing virus after the initial active attrition event. Then, following the immune response, either passive attrition or lymphopenic proliferation occurs to restore the compartment to its homeostatic size. We create mathematical models of cellular attrition and proliferation by solving multiple coupled Markov death or birth processes. We use these in sequence to find probability distributions for the final size of every memory lineage after various types of viral infections. With these distributions, we explore how lineage size and diversity differ from the initial repertoire, examine the likelihood of lineage extinctions, and in some cases calculate the average number of infections until a lineage is lost. We gain new insight into how infections affect both individual lineages and the whole memory CD8 + T-cell repertoire. This allows us both qualitatively and quantitatively to examine how immunity conferred by memory CD8 + T-cells changes with infections and to predict how long immunity to a disease may last. It also enables us to compare the relative impact of active versus passive attrition on the memory repertoire. The attrition model gives the probability that active or passive attrition reduces an initial memory repertoire to a particular post-attrition repertoire. We write the active attrition model; the same model, with a change of input and output repertoire notation, also captures passive attrition. The initial memory CD8 + T-cell repertoire is represented as a vector, m, of cell numbers m i across lineages i. We assume there is a constant total number, m c = m i , of cells in M memory lineages within the memory CD8 + T-cell compartment at homeostasis. Active attrition reduces the memory repertoire from m to a, which has a i cells in lineage i and a total of a c = a i memory cells that survive attrition. To derive the model, we begin with a Markov death process. We assume that attrition affects each cell with equal probability regardless of lineage, which is consistent with the fact that the type-I interferons that induce attrition act independently of the T-cell receptors that define a cell's lineage (Bahl et al. 2006; Chapdelaine et al. 2003; McNally et al. 2001) . At each step, one cell is lost from a lineage with probability equal to the size of the lineage divided by the total cell number. Assuming one cell dies at every time step lets us ignore time and leads to the model where p( a| m, a c ) is the probability that repertoire m decays to repertoire a of size a c and e i is an M-length unit vector with a 1 at position i. By solving individual cases, generalizing, and verifying the solution, we find that the Markov death process is solved exactly by the multivariate hypergeometric distribution when 0 ≤ a i ≤ m i for all i and a c ≤ m c . This multivariate hypergeometric distribution (Johnson and Kotz 1977) models the active attrition of memory cells early in infection. To model the passive attrition that restores the homeostatic memory compartment size following infections, we simply change notation so that attrition begins with the repertoire, s, that results from antigen-induced generation of new memory cells and attrition ends with repertoire a of size m c ; that is, where s has s c = s i cells following antigen-induced memory generation. The notation is summarized in Table 1, and Table 2 tracks how models are applied for the different infection types. We capture lymphopenic proliferation and antigen-induced memory cell generation with a weighted proliferation model that assumes cells proliferate according to a weight assigned to their lineage. This weight describes how well the cells compete for proliferation signals. If every cell is equally likely to proliferate regardless of lineage, the weighted proliferation model reduces to an unweighted model as time → ∞. If naive T-cells are present to contribute to lymphopenic proliferation, they survived any attrition of the naive compartment. For simplicity, we ignore naive cell attrition and other dynamics prior to their differentiation and entrance into the memory compartment; hence, the active attrition model includes only memory cells. Active attrition reduces the initial memory repertoire to the repertoire a. After this, we allow for the influx of a repertoire n with n c newly differentiated naive cells across N lineages that will contribute to refilling the memory compartment. We assume that at the start of lymphopenic proliferation, all naive cells that will contribute to lymphopenic proliferation have already differentiated. The lymphopenic proliferation model begins with the repertoire A = [ a, n] containing A c = a c + n c cells. During antigen-induced proliferative responses, A = m, the pre-infection memory CD8 + T-cell repertoire. To include primary immune responses in which naive cells generate new memory cells, we can set A = [ m, n] , where here n is the repertoire of naive cells specific for the invading antigen. We model the generation of new memory cells directly by skipping the effector cell stage and quantifying how many new memory cells are generated per lineage for a given repertoire of initial, preinfection cells. Thus, the repertoire A grows until a predetermined peak number, κ c , of newly generated memory cells is reached. During proliferation, lineage i increases from A i to s i cells, where i ranges from 1 to L, the total number of lineages. If naive cells contribute to proliferation, L = M + N ; otherwise, L = M. We enforce that lymphopenic proliferation stops when the compartment refills to size m c by setting the probability that a repertoire contains more than m c cells to be zero. Similarly, antigen-induced memory cell generation ends when the total number of cells reaches the prescribed peak, κ c . We develop a weighted proliferation model and allow cells in different lineages to have unequal propensities for proliferation by assigning each lineage a proliferation weight, w i . We assume that for nearly all of the proliferation phase, each lineage grows independently according to its own weight. When the memory compartment needs only one more cell to reach its homeostatic size (lymphopenic proliferation) or the proliferation peak (antigen-induced memory cell generation), lineages cease dividing independently, and all lineages compete for the final proliferation signal. We write the lymphopenic proliferation case; the antigen-induced new memory generation model is identical aside from notation. We model independent lineage division with a Yule process, and we use a timedependent, multiple-lineage Markov birth process to model the final cell division. Let p(s i , t|A i , t 0 , w i , m c ) be the probability that lineage i has s i cells at time t, given that it ended active attrition and started lymphopenic proliferation with A i cells at time t 0 , its cells proliferate with weight w i , and proliferation ends with m c cells across lineages. We first derive the time-dependent Yule process for each lineage i when s c < m c and t > 0. The proliferation rate is proportional to the number of cells in the lineage and its weight. With time step t and t 0 = 0, As t → 0, this yields the following Yule process when s c < m c , s i ≥ A i for all i, and t > 0: where the boundary conditions and initial conditions for the s c < m c case are The solution of a Yule process solution is (Karlin and Taylor 1975) Cells in all lineages compete for the final proliferation signal to fill the memory compartment and end lymphopenic proliferation. When s c = m c and t > 0, the Markov process is where e i is an L-length unit vector with a 1 at position i. Thus, as t → 0, The boundary conditions and initial conditions for the joint distribution when s c = m c are as follows: Since lineages are independent when s c − 1 < m c , the marginal probabilities in Eq. (10) equal Yule process solutions. When s c = m c = A c , s i ≥ A i for all i, and t > 0, we integrate both sides over time and use a boundary condition (Eq. (13)) to find the solution Overall, the joint probability distribution for the number of cells in each lineage at the end of lymphopenic proliferation, as calculated from the weighted proliferation model, is given by Eqs. (11) (12) (13) (14) (15) . In practice, computing probabilities from the multilineage weighted proliferation model is prohibitively slow. Hence, we implement the two lineage case If we instead consider antigen-induced memory cell generation, we change notation but not the structure or derivation of the model. Specifically, we preset a peak κ c = s c , use p( s, t| m, 0, w, κ c ) in Eq. (15) or Eq. (16), and use boundary conditions If all cells are equally likely to proliferate ( w = 1), the weighted proliferation model reduces to an unweighted proliferation model, which as t → ∞ is solved by the multivariate negative hypergeometric distribution where s c = m c at the completion of lymphopenic proliferation and s c = κ c following antigen-induced generation of memory cells. For Eq. (21) to be valid when A i = 0 for some i, we must set −1 0 = 1 and if y < x, for any z let y i=x z = 1. Rather than time-intensively calculating the probability of every possible outcome of attrition, we find the probability distributions for the lineage sizes after an attrition event by sampling from the multivariate hypergeometric distribution (Eq. (2)) using the BiasedUrn package in R (Fog 2007) . We choose an initial repertoirem for active attrition and a given repertoire s that results from antigen-induced memory cell generation for passive attrition-and a fixed degree of memory compartment attrition. During active attrition, we assume either 80 % or 20 % death of all memory CD8 + T-cells down to a population of a c total cells, while for passive attrition we require that the population decays to the homeostatic compartment size, m c . With the BiasedUrn function rMWNCHypergeom, we sample a c (or m c ) cells from the initial distribution without replacement. We repeat this thousands of times and import the results as a matrix into MATLAB, where it is sorted to find the frequency with which unique outcomes occur. These data give an accurate image of the probability distributions for the sizes of each lineage after attrition. Following active attrition, we initialize lymphopenic proliferation using each unique outcome of active attrition one at a time. To guarantee that m c (or κ c ) is reached, we use the limit of the weighted proliferation model (Eq. (16)) as t → ∞ to find the conditional probability distribution for the final size of each lineage based on each attrition outcome. Since this model does not lend itself to sampling, we use Riemann sums to numerically calculate the integrals. Finally, we multiply the conditional probabilities from the proliferation model by the probability that active attrition results in that specific repertoire and sum over all possible repertoires that are unique outcomes of active attrition; that is, With more than two lineages, we must also sum over all repertoires in which lineage i has s i cells to find the probability of each final lineage size. We thus obtain the lineage-size probability distributions that result from an initial memory repertoire m undergoing both active attrition and lymphopenic proliferation. Because it is prohibitively slow to numerically calculate multiple-lineage solutions, we consider only two-lineage weighted systems. To find the final-size probability distributions for a system with more than two lineages, we take an "us versus them" approach, in which we calculate the distribution of lineage i by pitting lineage i against the sum of all other lineages. We find the final distributions for every lineage by sequentially challenging each lineage against the rest. To account for possibly diverse lineage weights in the "them" group, we use the arithmetic mean of the weights of these lineages to approximate the effective weight of "them," while the "us" group keeps its original weight. If all cells have equal proliferative weights (unweighted case), we can calculate proliferation probabilities by sampling from the multivariate negative hypergeometric distribution (Eq. (21)), which is considerably faster and allows for larger lineage numbers. To do this, we created a program in MATLAB that generates random variates from a multivariate negative hypergeometric distribution using a structure similar to the MATLAB program Randraw (Bar-Guy and Podgaetsky 2005). We use this to sample a million variates initialized with each unique attrition outcome. Our numerical sampler outputs lineage size probabilities rather than repertoire probabilities; thus, we multiply the post-proliferation and post-attrition outcome probabilities and sum over all unique post-attrition repertoires to obtain the final-size probability distributions. To calculate the distributions for an infection that antigenically stimulates new memory cell generation followed by passive attrition to restore homeostasis, we reverse these processes. That is, we start with an initial repertoire m and first obtain peak repertoires with κ c cells either by directly computing the probabilities with the weighted proliferation model or by sampling variates from the unweighted model. The resulting peak repertoires are sorted for frequency, and unique outcomes initialize the attrition model, for which the BiasedUrn sampler determines the conditional probabilities of obtaining each lineage size after passive attrition. Multiplying these by the probability that the repertoire that initialized attrition resulted from new memory generation and summing over all intermediate peak outcomes produces the overall distributions for the final lineage sizes that result from initial repertoire m. A single infection could stimulate both active attrition and antigen-dependent memory T-cell proliferation. We assume active attrition, which occurs 1-4 days postexposure Bahl et al. 2006) , precedes antigen-induced proliferation and generation of new memory cells, and we consider two scenarios. First, active attrition is followed by antigen-induced proliferation, which overfills the memory compartment and necessitates a subsequent passive attrition event to restore the compartment's homeostatic size. Second, active attrition followed by antigen-induced proliferation does not completely fill the memory compartment, and thus an antigenindependent lymphopenic proliferation stage (possibly with different proliferation weights than the antigen-dependent phase) is required to restore homeostasis. We explore these scenarios with the same attrition and proliferation models and similar numerical approaches to those described previously. For each repertoire, we quantify diversity changes in the memory compartment by computing the initial and average final Simpson's indices. Simpson's index is a biodiversity measurement that gives the likelihood that two cells chosen at random belong to the same lineage; it is calculated as (Simpson 1949 where s i is the final size of lineage i. Indices close to 1 signify a memory compartment dominated by one lineage, while indices close to 0 connote an even division of cells across lineages. We calculate the final Simpson's index as a weighted average of the individual indices over all possible final repertoires. To compute the probability that lineage i goes extinct during a single active attrition event, we fix a i = 0 in the attrition model (Eq. (2)); this matches the yintercepts of the distribution graphs. Passive attrition extinction probabilities can be calculated identically if the exact repertoire at the peak is known. However, to find the single-infection extinction probability given a lineage's precursor size before antigeninduced proliferation, we must sum over the attrition model's extinction probabilities for every possible peak repertoire multiplied by the probability of that peak repertoire. Thus, the probability that lineage 2 goes extinct given initial repertoire m = [m 1 , m 2 ] of size m c with weights w and peak κ c is In some cases, we can mathematically determine how many infections, on average, must occur before the first lineage goes extinct for a given initial memory repertoire. This requires assuming that all infections incur the same overall degrees of attrition and proliferation. The process is extremely slow computationally, thus we confine its use to infections with active attrition followed by unweighted lymphopenic proliferation. To find the average waiting time (in infections) until the first lineage extinction for a two-lineage compartment, we let T k be the expected number of active attrition events until a lineage that starts with k cells either becomes extinct or gains all memory cells (i.e., the other lineage becomes extinct). T 0 = 0 and T m c = 0, and for 0 < k < m c , T k obeys the recursion (Karlin and Taylor 1975) where p kj is the probability that a lineage with k cells prior to active attrition has j cells at the start of the next attrition event (after lymphopenic proliferation). Letting T be a vector with entries T k ranging from T 1 to T m c −1 and letting P be a matrix with entries p kj where k and j range from 1 to m c − 1, the mean number of infections until a lineage extinction for any initial condition k is found by solving for T , where the identity matrix I matches P in size and 1 has length m c − 1 (Karlin and Taylor 1975) . To calculate the average number of infections until the first lineage in a multilineage repertoire dies out, we take the minimum of a set of exponentially distributed random variables with means T m i , where m i is the initial size of lineage i. Since the calculation for finding T m i can only consider two lineages at a time, T m i is computed by setting m i against the other m c − m i cells and then doing the matrix calculation given earlier. Parameterizing an exponential distribution with the minimum T m i gives the waiting-time distribution until one of the many lineages becomes extinct. We develop two mathematical models to examine three infection scenarios ( Fig. 1 and Table 2 ). We compare the dynamics of viruses that induce active attrition followed by lymphopenic proliferation, more classical infections characterized by new memory cell generation followed by passive attrition, and combinations in which an activeattrition-inducing virus sparks an antigen-activated immune response. We begin with a variety of initial memory CD8 + T-cell repertoires with memory compartment size m c and apply the attrition (Eq. (2)) and proliferation (Eqs. (11-15)) models sequentially to obtain the probability distributions for the final size of every lineage in the memory repertoire. These give the probability that a given memory lineage that undergoes both attrition and proliferation ends with 0 through m c cells. With these distributions, we compute the initial and average final Simpson's indices (Table 3 ) and the probability that each lineage goes extinct during a single attrition event (Table 4 ). Simpson's index is a biodiversity measurement that gives the likelihood that two cells chosen at random belong to the same lineage; thus, higher Simpson's indices correspond to lower diversity. The biggest change to compartment diversity occurs when one lineage goes extinct during attrition, and we calculate that likelihood. This is especially true after thymus involution in adulthood, after which [ 0, 1] pk 5,000 0 0 Each lineage's probability of extinction in a single infection given an initial repertoire is provided for a variety of repertoires, weights, degrees of attrition (for active attrition), and proliferation peaks (for passive attrition). The probability that the initially smaller lineage in the repertoire becomes extinct is given in the fifth column while the likelihood that the initially larger lineage goes extinct is in the sixth column. Extinctions only occur during attrition events; thus, infections that induce active attrition have the same extinction probabilities regardless of the weighting of subsequent proliferation events. Extinctions during passive attrition are calculated assuming a given initial repertoire rather than a given peak repertoire. Abbreviations-AA: active attrition, NG: new memory generation, PA: passive attrition, att: attrition, pk: peak, mem: memory cells there is only a small source of new T-cell receptor diversity (Janeway et al. 2005; Kendall 1981 ). Even before involution, mice have only an estimated 100-200 existing epitope-specific naive CD8 + T-cells from which to generate novel memory lineages (Blattman et al. 2002) . Because computations are slow with the weighted proliferation model, we consider repertoires with two lineages (or two groups of lineages) and small memory compartment sizes. An "us versus them" approach is used to consider more than two lineage groups. We assume one lineage is rare, and thus initially comprises 20 % or less of the compartment. We consider compartments with 100 to 100,000 memory cells, and with these, we identify subtle repertoire changes that are difficult to discern in larger compartments; yet, we show that most small-compartment conclusions hold for larger sizes. We first model infections in which memory lineages undergo active attrition, after which surviving cells proliferatively refill the memory compartment. We use an unweighted attrition model (Eq. (2)) since the type-I interferon-based mechanism that induces early memory cell death is independent of the T-cell receptor that defines a cell's lineage (McNally et al. 2001; Bahl et al. 2006; Chapdelaine et al. 2003) . After active attrition, we allow for the influx of a repertoire of already differentiated naive cells that can help to refill the memory compartment. In lymphopenic conditions, bona fide memory CD8 + T-cells proliferate in response to excess IL-15, a lineage-independent signal (Kennedy et al. 2000; Surh and Sprent 2005) . However, some memory lineages may bind or respond to IL-15 better than others due, for example, to unequal cytokine receptor numbers. Naive CD8 + T-cells stimulated by IL-7 and antigenic triggering of their T-cell receptors can differentiate directly into memory cells and proliferate along with bona fide memory cells to refill the memory compartment (Cho et al. 2000; Surh and Sprent 2005) . Thus, newly differentiated naive cells may respond to proliferation signals differently from bona fide memory cells and than other newly differentiated naive cell lineages. The weighted proliferation model (Eqs. (11-15) ) accounts for possible variability in memory cell proliferation and potential naive cell contributions via lineage weights. We employ a range of proliferation weights, but we assume that naive lineages have much smaller weights than memory lineages to be consistent with experimental data (Almeida et al. 2005; Tanchot and Rocha 1995) . If all lineage weights are equal (e.g., for memory cells with similar IL-15 receptor numbers), we may use the unweighted proliferation model (Eq. (21)) to compute the lineage size probabilities efficiently, which enables us to determine lineage extinction times for bona fide memory cell models. We consider scenarios with only memory lineages (unweighted and weighted), a mix of memory and naive lineages, and only naive lineages, such as what might occur during adoptive transfer experiments. Unless otherwise stated, we assume minor active attrition that kills 20 % of memory cells or drastic attrition that destroys 80 % of the initial memory compartment; following active attrition, lymphopenic proliferation restores the original memory compartment size. For these scenarios, we assume no antigen-induced immune response occurs in order to discern more clearly the impact of active attrition itself. To investigate active attrition followed by lymphopenic proliferation when all cells proliferate with equal likelihood, we consider equally weighted memory lineages in 100-to 100,000-cell compartments. The distributions that result from pairing the attrition and proliferation models are shown in Fig. 2a -b along with the mean final size and standard deviation of each lineage. Because the process is unbiased, on average each lineage returns to its initial size. Higher degrees of attrition or larger compartment sizes causes greater variance in the final lineage sizes. Correspondingly, higher degrees of attrition have higher coefficients of variation; larger compartments have smaller coefficients of variation because mean lineage sizes increase faster than their deviations. Furthermore, the final distributions are skewed in small compartments such that the smaller lineage's mode is less than its mean and the larger lineage's mode is higher. Larger compartments exhibit less skewing. We find little-to-no decrease in the diversity of the memory compartment on average. For small lineages, extinctions are possible but highly unlikely (Table 4) . Even with excessive degrees of attrition, extinctions are highly improbable with lineage sizes greater than 100 cells. Hence, it should take multiple attrition events for one CD8 + T-cell lineage, and the immune protection it confers, to entirely disappear. If we assume that all infections incur the same degree of active attrition, we can mathematically determine how many infections, on average, must occur before the first lineage goes extinct for a given initial memory repertoire. This is computationally fea- sible only with small lineages sizes and equal weights. We find using 100-and 1,000cell models that the mean number of infections until extinction increases rapidly with less attrition, larger lineages, or larger compartments (Figs. 2c-d) . A same-sized lineage becomes extinct after fewer infections in a 100-cell than a 1000-cell compartment. When bona fide memory cells undergo drastic (80 %) attrition and then have unequal proliferation weights, lineage sizes change (Fig. 3a) . Lower relative weights, here on the smaller lineage, skew and shift the final-size probability distributions from the equally weighted case. A highly proliferative lineage expands and displaces less proliferative phenotypes. In Fig. 3a , the diversity of the compartment, as measured by Simpson's index (Table 3) , decreases; however, diversity increases if the smaller lineage has the larger weight and thus grows to a more balanced portion of the compartment. Single-infection extinction probabilities for the memory lineages (Table 4) remain unchanged from the unweighted case because extinctions only occur during attrition. Nevertheless, if a memory cell develops that has a proliferative advantage over other memory cells, it will take over more of the memory compartment during infections that cause active attrition and lymphopenic proliferation. After memory cells undergo active attrition, newly differentiated naive cells can enter the memory compartment and compete with surviving bona fide memory cells for proliferation signals, albeit with smaller proliferative weights, until the original memory compartment size is restored (Almeida et al. 2005; Tanchot and Rocha 1995) . We vary the naive lineage weights, while the bona fide memory cells have maximum proliferative potential with weight 1. The bona fide memory cell population undergoes either 80 % or 50 % attrition. (We do not consider 20 % attrition because the number of surviving bona fide memory cells plus newly differentiated naive cells would exceed the homeostatic compartment size, m c .) The relative weights and degree of attrition can substantially impact lineage dominance (Figs. 3b-d). Simpson's index, which is initially 1 when only the bona fide memory lineage is present, reflects the degree to which immigration of naive cells increases the diversity of the memory compartment (Table 3) . Neither lineage may go extinct under less than 100 % memory attrition; this is because only lineages that undergo active attrition may die, which rules out naive lineage extinctions, and a nonzero percentage of the single memory lineage must survive to fulfill the less-than-100 % attrition requirement. If we compare the 100-cell compartment (Fig. 3c) to the 1,000-cell compartment (Fig. 3b) , we find that the mean final lineage sizes are equally proportional to the compartment size assuming similar weights and degrees of attrition, although the probability of attaining these means varies with compartment size. Furthermore, the final diversity of the compartment is nearly identical between these cases. We therefore expect the same trends to hold when lineage and compartment sizes are larger. Soon after birth, the initially empty memory compartment is filled by naive cells that differentiate directly into memory cells and proliferate (Stockinger et al. 2004) . Similarly, naive cells adoptively transferred into mice genetically incapable of producing T-cells proliferate to fill the peripheral T-cell compartments (Cho et al. 2000; Almeida et al. 2005; Goldrath 2002; Sprent and Surh 2001) . In such instances, the host begins with an empty memory compartment that is filled-possibly to less than the wild-type homeostatic memory compartment size-with only newly differentiated naive cells. With the weighted proliferation model alone, we find the resultant probability distributions (Figs. 3e-f) and Simpson's indices (Table 3) , which show marked differences from cases with memory cells initially present (Figs. 3a-d) . Simpson's index for any repertoire is initially zero since the memory compartment begins empty. In Figs. 3e-f, lineages with lower precursor frequencies of differentiated cells are less likely per capita to divide and thus have smaller weights. For these repertoires, we predict how much one lineage takes over the memory compartment when the other has less ability to divide. Reversing these weights, we find that a small lineage with a sufficiently high weight relative to an initially larger lineage can grow to take over the majority of the memory compartment (not shown). By comparing repertoires that expand to 1,000 cells ( Fig. 3f and others not shown), we find that the initial number of cells influences the final repertoire. Lineages that begin small are more prone to stochastic effects that allow larger lineages to dominate a greater percentage of the memory compartment. This causes the probability distributions for small initial repertoires to be more skewed than for larger initial repertoires and correspondingly less diverse. Comparing a 100-cell compartment that initially possesses an 8-and a 2-cell lineage (Fig. 3e) with a 1,000-cell compartment that begins with an 80-and a 20-cell lineage (Fig. 3f) , we see that with a proportionate increase, the trends found for the smaller final compartment size hold for the larger compartment size as well. For these repertoires, the ratios of the mean final lineage size to the total compartment size for each lineage are nearly identical and the compartment becomes similarly less biodiverse as the second lineage's weight decreases. This suggests that the same qualitative and quantitative behaviors should hold for larger, more biological lineage sizes. When the memory compartment has more than two lineages, an "us versus them" approach produces the final-size probability distributions for each lineage while respecting the weighted proliferation model's computational constraints. As an illustrative example, we consider a memory repertoire composed of an 800-cell lineage with proliferative weight 1 and a 200-cell lineage with weight 1 that undergoes 80 % active attrition, after which an 8-cell and a 2-cell naive lineage with weights 0.8 and 0.2, respectively, compete with the memory lineages to refill the memory compartment. Using the "us versus them" approach, we first pit the memory lineages against the naive lineages using the additive means of the weights and obtain the mean final number of memory cells and of newly differentiated naive cells (971 cells and 29 cells, respectively, in Fig. 4a ). The two memory lineages then compete with their original weights to fill a 971-cell compartment (Fig. 4b) while the two naive lineages compete to fill a 29-cell compartment (Fig. 4c) . In this way, we obtain the final-size probability distributions for each lineage. Thus, a more realistic number of lineages can be examined with these mathematical models by grouping lineages or by sequentially identifying lineage sizes. We now turn to more classical infections and examine the impact of viruses that induce new memory CD8 + T-cell generation followed by passive attrition that restores the homeostatic memory compartment size. Acute viral infections trigger cognate or cross-reactive naive and memory CD8 + T-cells to differentiate into effector cells, which proliferate and eliminate the virus; upon removal of the pathogen, most effector cells die and leave behind a population of newly generated virus-specific memory CD8 + T-cells. The addition of new memory cells to an already brimming memory T-cell compartment causes a lack of sufficient survival signals, which can lead to passive attrition until only a sustainable memory population remains (Chapdelaine et al. 2003; Kennedy et al. 2000; Ku et al. 2000; Welsh et al. 2004b) . We first use the weighted proliferation model with relevant notation) to capture new memory cell generation and then apply the attrition model (Eq. (3)) to mimic passive attrition. To do this, we model memory cell generation as the direct creation of new memory from proliferating memory and recently activated naive cells; that is, we ignore effector cell intermediaries. Skipping the effector stage is a simplifying assumption, yet it is partially justified by the facts that newly created memory cells are descendants of the original naive or memory cells and, when proliferation rates are similar between lineages, the number of new memory cells generated during an infection may be correlated with the number of activated precursor cells (De Boer et al. 2003; Kaech and Ahmed 2001) . We consider scenarios in which all lineages proliferate, one lineage proliferates to become the majority of the memory compartment, or one lineage proliferates but remains a minority. We set the memory cell peak, κ c , by assuming that, if equally weighted, precursor cells generate 50 memory cells each (including themselves) following antigenic stimulation. In mice with on order of 10 7 naive CD8 + T-cells and 100 precursor cells, experimental measurements suggest a 1,000-fold increase of each activated precursor cell if 5 % of peak cells survive as memory cells (Blattman et al. 2002) , which corresponds to a 1 % increase in the preattrition memory compartment size. Since a 1,000-fold increase in a 1,000-cell compartment leads to significantly larger percent growth, we use a more moderate 50-fold expansion estimate to examine proliferation effects. When lineages possess differing proliferation weights, the peak number of cells is fixed assuming this degree of expansion, but individual cells may vary in the actual number of daughter cells they produce. This allows immunodominant behavior to occur in lineages with high weights. After reaching the proliferative peak, the memory compartment returns to the homeostatic size, m c , via passive attrition. Altering this assumption to allow for the increasing compartment size demonstrated by Vezys et al. (2009) requires changing one parameter in the model: the final compartment size. We explain how this would affect the results in the Discussion. With both memory lineages proliferating, a 100-cell memory population peaks at 5,000 memory cells. We assign one lineage a proliferative weight of 1, while the other lineage's weight varies (Fig. 5a) ; we then reverse these assignments to change which lineage is immunodominant (Fig. 5b) . As the initial effective size-the combination of lineage size and weight-of the larger lineage increases, it takes over more of the memory compartment, as reflected by an increasing mean and Simpson's index (Table 3) . If an initially rare lineage has the higher weight, the memory compartment will become more equally divided until the smaller lineage surpasses the larger in size; the initially more common lineage can even be pushed to extinction. Extinction during passive attrition is most likely when the difference in weights between the small and large lineage is greatest (Table 4) . In the absence of bystander effects, only a few T-cell lineages typically recognize and respond to a viral infection. We group all responding cells into one lineage and all nonproliferating cells into the second lineage. (More precise lineage dynamics can be found with an "us versus them" approach.) We again consider a memory compartment with 100 total cells; one 20-cell memory lineage proliferates to a peak of 1,000 cells while the rest of the compartment remains stagnant. Following proliferation, every lineage is subject to passive attrition, which reduces the compartment size back to 100 cells. Thus, the initially larger, 80-cell lineage must compete with a 1,000-cell lineage for space in the final compartment. It does so unsuccessfully; the initially smaller lineage takes over the vast majority of the compartment (Fig. 5c) , and the larger lineage has a nonzero extinction probability (Table 4 ). The initial Simpson's index of 0.6768 reflects a repertoire largely dominated by the 80-cell lineage; at the end, the average Simpson's index is 0.8647 for a repertoire mostly composed of the proliferative lineage. Since most infections do not generate 2-to 10-fold more memory cells than the homeostatic compartment size, we now consider one proliferating lineage that, even at its peak, is much smaller than the number of nonproliferating cells in the memory compartment. We group all nonproliferating cells into a single 4,000-cell lineage. A second lineage contains 20 memory cells that respond to antigen by generating 49 new memory cells each for a peak of 1,000 memory cells. Passive attrition reduces the compartment from 5,000 cells back to the homeostatic 4,020 cells. The average final size for the nonproliferating lineage is 3,216.0 ± 11.1 cells, while the proliferating lineage ends with a mean of 804.2 ± 11.3 cells (not shown). Simpson's index initially was 0.9901, demonstrating the large dominance of the 4,000-cell lineage in the memory compartment. Following antigen-induced proliferation and passive attrition, the average Simpson's index becomes 0.6799, with the smaller lineage comprising a greater proportion of the memory compartment. However, proliferative ability here does not allow the smaller lineage to seize most the memory compartment, and the rarer lineage remains relatively rare. We have not yet taken into account that an active-attrition-inducing virus could trigger an antigen-specific T-cell response. Immediately following active attrition (which occurs in the first few days of infection before T-cells become awakened by antigen (Bahl et al. 2006; Peacock et al. 2003; Janeway et al. 2005) ), some lineages that survived attrition may become activated by viral antigens and proliferate in response. This adds new virus-specific memory cells to the memory compartment. To return to its homeostatic size, the compartment must then undergo either passive attrition (if overly full) or lymphopenic proliferation (if underfilled). Modeling this shows how active-attrition-inducing viruses that also elicit new immune protection alter immunity to past infections. The attrition model (Eq. (2)) is applied first to capture active attrition and, if needed, is employed at the end for passive attrition to restore homeostasis. The weighted proliferation model ) is used after the completion of active attrition to mimic new memory cell generation and then again, if the compartment is underfilled, to simulate the lymphopenic proliferation that finishes refilling the compartment. We assume that during antigen-induced proliferation every precursor cell generates 50 memory cells. With small compartment sizes, the total number of memory cells following active attrition and antigen-induced proliferation is larger than the homeostatic compartment size. Therefore, passive attrition follows in the situations that we consider. However, in scenarios that involve larger compartment sizes relative to the peak of the immune response, lymphopenic proliferation might instead occur. In a 100-cell memory compartment that contains one 20-cell lineage specific for the invading virus, all cells not proliferatively reactive to the virus are grouped into a second 80-cell lineage that undergoes active attrition but does not participate in antigen-induced proliferation. Both lineages are subject to the final, passive attrition. We find that proliferation gives the initially smaller lineage a huge advantage during passive attrition, and it ultimately takes over the majority of the memory compartment (Fig. 6a) . The diversity of the compartment decreases to reflect this shift (Table 3) . With one 200-cell proliferating memory lineage and an 800-cell nonproliferating memory lineage, we see the same trends ( Fig. 6b and Table 3 ). Thus, final-size lineage means scale proportionally with compartment size. With small compartment sizes relative to the number of cells at the immune response peak, proliferating lineages take over the majority of the compartment. This is true regardless of the degree of active attrition, which notably has little effect on the final distributions-seen both by comparing 80 % to 20 % attrition in Figs. 6a-b and by comparing Figs. 6a and 5c . That is, a substantial early drop in lineage sizes followed by proliferation and passive attrition creates a nearly identical compartment to that which results from proportionally equal proliferation and passive attrition only. Attrition does not change the ratio of mean cells in lineage 1 versus lineage 2; only proliferation does this. Thus, the final mean cell ratio is impacted only by proliferation events and not by early or late attrition events. As a result, while active attrition temporarily devastates the memory compartment, its effect on the lasting compartment composition is nil on average. Furthermore, our stochastic approach allows us to note that the degree of attrition also has little impact on the deviation of the lineage sizes from the mean sizes. Lastly, we look at four memory lineages undergoing active attrition, antigeninduced proliferation, and passive attrition. Two lineages with 20 and 80 cells, respectively, do not recognize the virus and, therefore, undergo attrition but do not proliferate. The other two lineages, also with 20 and 80 cells, proliferate following active attrition and then undergo passive attrition. We show results for the equally weighted case (Figs. 6c-d) . Proliferating lineages again have a significant advantage over nonproliferating lineages; they take over the majority of the memory compartment and nearly eliminate the lineages not specific for the infection. The degree of attrition alters the variances of the final distributions but has little effect on the mean final sizes of each lineage. Thus, active attrition has little impact, if any, on the memory repertoire if an antigen-induced proliferative response leading to new memory cell generation occurs. Due to homeostatic regulation of the memory CD8 + T-cell compartment size, immunity to past diseases can diminish as immune responses against new pathogens are mounted (Freitas and Rocha 1993; Tanchot and Rocha 1995; Selin et al. 1996 Selin et al. , 1999 . We develop mathematical models of cellular attrition and proliferation that give insight into how the memory CD8 + T-cell repertoire changes as a result of viral infections. The models solve Markov death and birth processes for multiple coupled lineages. We employ them in sequence to explore how viruses that cull memory CD8 + T-cells in the first few days of infection alter the memory repertoire; for such infections, active attrition is followed by lymphopenic proliferation that restores the homeostatic memory compartment size but not necessarily the original lineage composition. We use the same models to investigate the impact on the memory repertoire of more typical antiviral immune responses characterized by antigenic stimulation of memory CD8 + T-cells, which leads to the generation of new memory cells; this creates a dearth of cytokine survival signals and can precipitate the passive attrition of memory cells to restore the homeostatic compartment size. Finally, we combine the models of active attrition and antigenically stimulated immune responses to gain a more comprehensive understanding of how active-attrition-inducing viruses alter the memory CD8 + T-cell repertoire. These results additionally allow us to compare the relative impacts of viruses that cause active attrition followed by proliferative recovery versus viruses that stimulate new memory cell generation followed by less drastic, but permanent, passive attrition. Our probabilistic, rate-independent models of attrition and proliferation require few biological parameters and provide both qualitative and quantitative predictions about how viral infections affect lineage size and diversity. For each model, we specify only the initial memory repertoire, the degree of attrition or peak number of newly generated memory cells, the final memory compartment size (which we set to the initial size), and proliferative weights describing each lineage's propensity for utilizing proliferation signals. Our stochastic approach enables us to determine probability distributions for the final size of every lineage, which indicates the likelihood and degree to which an infection alters the memory CD8 + T-cell repertoire. The means of our stochastic results match the behavior of a deterministic model while obtaining information about how lineage sizes deviate from those means. Crucially, a stochastic approach allows us to examine the probability of lineage extinctions and a corresponding loss of immunity during attrition events and to determine the impact of nonzero extinction probabilities on lineage diversity. To identify general trends in how active-attrition-inducing viruses impact the memory repertoire, we run the active attrition model using a variety of initial memory repertoires for a range of degrees of attrition and initialize lymphopenic proliferation with the resulting repertoires. If bona fide memory cells refill a lymphopenic memory compartment, the lineages likely have the same proliferative propensity since the cells respond to the same lineage-independent antigen signals (McNally et al. 2001; Bahl et al. 2006; Chapdelaine et al. 2003) . With equal lineage weights, the memory repertoire on average returns to the initial repertoire following the infection. However, the final-size probability distributions are skewed such that common lineages are more likely to grow in repertoires that contain rare lineages. As lineage sizes increase, the probability of a lineage extinction diminishes and the skews become more subtle. Larger degrees of attrition are associated with increased stochastic effects and higher extinction probabilities and thus require bigger lineage sizes to avoid distribution skewing. Correspondingly, the diversity of the memory repertoire decreases most substantially with high amounts of attrition and small compartment sizes. Larger compartments generally maintain lineage diversity despite attrition and proliferation events. Thus, in humans and other organisms, active attrition and lymphopenic proliferation of memory cells should have little lasting impact on the composition of the memory CD8 + T-cell repertoire, even in the presence of stochastic effects. However, if one lineage utilizes cytokine signals more efficiently than others, that lineage gains a proliferative advantage and dominates more of the compartment with every active-attrition-inducing infection. Hence, it is in the host's best interest to have tight restraints on cytokine signaling cascades and receptors such that a cell is prevented from gaining any proliferative advantage. Failure of these regulators could lead to narrowing of the immune repertoire and lymphoproliferative disorders (Lucas et al. 2000; Ku et al. 2000; Willerford et al. 1995) . We determine how quickly immunity is lost by calculating the average number of infections until the first lineage extinction occurs. For a 1,000-cell memory compartment with 200 cells in the smallest lineage, it takes on average 125 sequential viral infections, each causing 80 % active attrition, for a lineage to be lost. Furthermore, for a given lineage size, the mean number of infections until extinction increases with compartment size. In a mouse memory compartment containing on order of 10 7 cells or a human memory compartment with 10 10 cells (Blattman et al. 2002; Tanchot and Rocha 1995; Callard et al. 2003) , total loss of immunity to any antigen should be exceedingly rare if cells act independently. Even loss of protective immunity, which occurs when too few antigen-specific T-cells exist to prevent disease, should happen only when initial lineage sizes are quite small. In a lymphopenic environment, naive CD8 + T-cells can differentiate directly into memory CD8 + T-cells that help to replenish the memory compartment. Naive cells require different signals than memory cells, namely IL-7 and T-cell receptor triggering, and proliferate less than memory cells. There is evidence that naive cell contributions are small (Tanchot and Rocha 1995; Freitas et al. 2005) , so unweighted bona fide memory cell proliferation should provide a good approximation to the full effects. If bona fide memory lineages and naive lineages compete to proliferate, then the bona fide memory population is reduced, and the spurious memories of newly differentiated naive cells successfully gain a foothold in the memory compartment. The degree to which this occurs depends on the degree of attrition and the relative lineage weights. Naive cells immigration increases the diversity of the compartment, yet immunity against recurring infections may simultaneously decrease due to the lessened presence of bona fide memory cells. If the memory CD8 + T-cell compartment is empty, such as immediately following birth or in a transgenic or irradiated mouse, naive CD8 + T-cells can differentiate into memory cells and begin to fill the memory compartment. With the weighted proliferation model, we determine that expected lineage sizes following naive cell differentiation and division heavily depend on the lineage weights. When lineages are initially small, the final-size distributions are skewed due to stochastic effects that amplify early proliferation events. In consequence, relative naive cell precursor sizes and weights are important, and lineages with the largest effective number of newly differentiated cells disproportionately grow the most. Viral infections that spark immune responses and generate new virus-specific memory T-cells can be categorized as those that also elicit active attrition of memory cells or those that do not. In classic viral infections, which do not cause active attrition, new memory cell generation is followed by passive attrition to restore the homeostatic compartment size. If every lineage in the memory compartment recognizes and reacts to viral antigens, relative proliferation weights are vital. With similar weights, we find that lineages return to their initial sizes on average. With disparate weights, the lineage size ordering within the memory compartment can be drastically altered, and a single infection could cause the extinction of a previously common lineage. More often, only a few lineages react to the virus, which for computational feasibility we explore by grouping all cells that proliferatively respond to the infection in one lineage and placing nonreactive cells into a second lineage. The generation of 50 memory cells per proliferative precursor cell creates a vast memory pool with which the initially large, nonproliferating lineage must compete during passive attrition for space in the final compartment. Consequently, this bystander population diminishes substantially in size. The degree to which this occurs depends heavily on the ratio of the proliferative peak to the overall compartment size. The models predict that small acute infections tend to increase the number of disease-specific cells while avoiding the complete elimination of bystander immunity against other contagions. Conversely, acute viruses that stimulate large proliferative responses could eliminate the majority of the heterologous memory cells through natural homeostatic processes and significantly narrow the memory CD8 + T-cell repertoire. Notably, the results are similar regardless of whether or not the virus induces active attrition prior to the antigenically stimulated immune response. The models show very similar results to the classical infections just described when active attrition precedes antigenically stimulated memory cell generation followed by passive attrition (compare Figs. 5c and 6a) . We find that the degree to which a proliferating lineage comes to dominate the compartment is largely insensitive to the presence of active attrition. There is debate over whether viruses that cause late, passive attrition of memory CD8 + T-cells or those that incite early, active attrition cause a greater decay in heterologous memory CD8 + T-cell populations Selin et al. 2006; Welsh et al. 2004b) . We have quantified how both active-attrition-inducing and passive-attrition-inducing viruses affect the memory repertoire composition, and thus we compare these results to see if active attrition or passive attrition permanently alters preexisting immunity to other infections more. When comparing the impacts of classical viruses with viruses that cause both active attrition and antigen-induced proliferation, the results are nearly identical if the proliferative peak is much larger than the homeostatic compartment size. With small peaks relative to compartment size, classical viruses narrow the memory repertoire slightly. Although numerical constraints limit our ability to quantify this, we suspect that the same is true for viruses that induce active attrition based on our results that consider active attrition and lymphopenic proliferation only. These indicate that, with only surviving memory cells contributing to lymphopenic proliferation, the initial repertoire is restored on average. An additional proliferative response should therefore cause proliferative lineages to increase their presence in the memory compartment, and subsequently reduce the number of nonproliferating cells during passive attrition. Ironically, this means that T-cell repertoires that are less able to recognize and respond to an active-attrition-inducing virus are more likely to rebound to their initial configuration if the host survives. We also compare extinction probabilities for memory lineages that antigenically proliferate and then undergo passive attrition to memory lineages that go through active attrition followed by lymphopenic proliferation with no antigen-induced proliferation stage. For one 20-cell and one 80-cell memory lineage, the likelihood of a lineage extinction during passive attrition is on the order of 10 −7 for a single infection. Meanwhile, 80 % active attrition has an extinction probability of 10 −3 while 20 % active attrition causes a lineage extinction with probability 10 −21 . Thus, while protective immunity against heterologous viruses is most likely to be lost under high degrees of active attrition, low amounts of active attrition incite extinctions less frequently than passive attrition. Sequential infections will exacerbate these effects. The probability that active-attrition-inducing viruses cause extinctions should be higher when they also antigenically stimulate new memory generation due to the added decay from passive attrition. Nevertheless, the final repertoires are nearly identical for active-attrition-causing infections and for viruses that do not induce active attrition, and therefore their extinction likelihoods should roughly match as well. That is, viruses that antigenically stimulate a CD8 + T-cell response should cause the loss of existing immunity with the same probability regardless of whether or not active attrition occurs. Overall, our stochastic approach combined with mathematical tools such as Simpson's index, waiting-time calculations, and probabilistic urn models enables us to conclude that antigen-induced memory cell generation can substantially alter the memory repertoire by causing large, asymmetric growth of some lineages followed by a permanent decrease across all lineages from which there is no opportunity to rebound. Therefore, regardless of whether active attrition precedes new memory cell generation, the initial lineage configuration cannot be restored, and some immunity will be lost. In contrast, active attrition followed by lymphopenic proliferation does not often reach low enough lineage sizes for stochastic extinctions to occur, and the compartment rebounds to the initial repertoire on average. Thus, active attrition has little lasting impact on the memory repertoire, and new memory cell generation with subsequent passive attrition has the dominant influence on the composition of the final repertoire. Some error may be introduced by the assumption that memory cells are created directly through a proliferative process. Memory cells may actually be created following proliferation of effector cells, which either die or differentiate into memory cells. By arranging the attrition and weighted proliferation models appropriately, we could directly model effector cell intermediaries. However, finding the final-size probability distributions would be more computationally intensive. Hence, we streamline the process by using the simplifying assumption that new memory cell generation is the direct result of precursor cell division. This assumption is reasonable when proliferation weights are roughly equal so that the number of new memory cells an infection generates may correlate with the number of activated precursor cells (De Boer et al. 2003; Kaech and Ahmed 2001) . This method is also consistent with the fact that newly created memory cells are descendants of the original naive or memory cells, and it is precise under the hypothesis that naive cells asymmetrically differentiate into one effector cell and one memory cell if these memory cells also proliferate (Chang et al. 2007; Littman and Singh 2007) . Recent experiments suggest that the memory CD8 + T-cell compartment size does not remain constant but grows with each memory-generating infection (Vezys et al. 2009 ); passive attrition may occur, but it does not return the memory compartment to its original size. Accounting for this in our models requires changing one parameter: the final compartment size. Qualitatively, this will reduce the degree to which an infection alters precursor, non-cross-reactive lineage sizes. For instance, the likelihood of a lineage extinction due to passive attrition could drop to zero if the memory compartment expands so much that little passive attrition occurs. The limited effects of active attrition remain true whether or not passive attrition occurs. While we include naive cell dynamics during infections that induce active attrition, we do not incorporate new memory generation by antigenically stimulated naive cells during classical infections into our results. We can do so by tweaking the multiplyby-50 rule for fixing the proliferation peak so that memory and naive cells create differing numbers of new cells per precursor cell in accordance with the fact that memory T-cells react faster and in larger numbers to antigenic stimulation (Blattman et al. 2002; Janeway et al. 2005) . Due to computational constraints, we consider small compartment sizes throughout our analysis. Yet, by comparing the results of different repertoire sizes, we have shown that the trends we identified also hold for larger compartments and larger numbers of lineages. Therefore, these characteristics should scale to biologically relevant cases in which lineages with 10 3 to 10 6 cells reside in a memory CD8 + T-cell compartment with 10 7 to 10 10 cells. For larger compartments, the 50-fold expansion we assume during antigen-induced proliferation substantially underestimates the >1,000-fold expansion seen experimentally (Blattman et al. 2002) . Thus, the final distribution changes we observe with small numbers may underestimate true shifts, and greater expansion will likely exacerbate the differences between immunity loss due to antigen-induced proliferation and passive attrition versus active attrition. We also assume that only two lineages (or two lineage groups) compete for proliferation signals at a given time to make computation times feasible. We discern the dynamics of multiple competing lineages by using an "us versus them" approach that pits each lineage against the rest of the memory compartment. This process can be cumbersome with a large number of lineages, but the attrition and proliferation models can nevertheless determine how multiple lineages interact to refill a lymphopenic compartment. Furthermore, the analytical models hold for any lineage and compartment size; thus, with faster numerical approaches or platforms, the final-size probability distributions can be calculated for more biologically realistic population numbers. To validate these models requires experimental data that measure absolute cell numbers in every lineage and the total number of memory CD8 + T-cells in the host. We need memory repertoire measurements before and after memory CD8 + T-cells undergo both attrition and proliferation events. These are difficult to acquire when using destructive assays from which only one repertoire measurement can be obtained. In addition, the measurements must come from the same host because even genetically identical individuals with the same disease history have unique private repertoire specificities (Kim et al. 2005; Welsh et al. 2006) . The attrition and proliferation models could be expanded to consider chronic or autoimmune diseases. Both may significantly narrow the memory repertoire through persistent or recurrent T-cell responses directed at a few antigens. Integrating the dampening effect of negative selection could be interesting. If antigens from a chronic virus become included in the antigen pool that defines self during selection, complete narrowing of the repertoire might be avoided. This could be modeled using dynamic proliferation weights that drop to zero when the peptides become recognized as self. Models like these might also apply to other immunological systems. Memory B-cells compete for limited niches (Freitas and Rocha 1993; Manz et al. 2005) , but examining memory B-cell repertoire shifts involves tracking not only antigenic specificity but also immunoglobulin type and other factors. As biological and mathematical exploration advances our knowledge of immune repertoire dynamics, we gain better insight into how immunity evolves in a lifetime. Homeostasis of T cell numbers: from thymus production to peripheral compartmentalization and the indexation of regulatory T cells Models of immune memory: on the role of cross-reactive stimulation, competition, and homeostasis in maintaining immune memory IFNinduced attrition of CD8 T cells in the presence or absence of cognate antigen during the early stages of viral infections The murine T-cell receptor uses a limited repertoire of expressed Vβ gene segments T-cell receptor beta-chain expression: dependence on relatively few variable region genes Estimating the precursor frequency of naive antigen-specific CD8 T cells CD8 T cell responses to viral infections in sequence Fratricide: a mechanism for T memory-cell homeostasis Asymmetric T lymphocyte division in the initiation of adaptive immune responses Increased CD8+ T cell memory to concurrent infection at the expense of increased erosion of pre-existing memory: the paradoxical role of IL-15 Homeostasis-stimulated proliferation drives naive T cells to differentiate directly into memory T cells Mice lacking MHC class II molecules Different dynamics of CD4+ and CD8+ T cell responses during and after acute lymphocytic choriomeningitis virus infection Lymphocyte lifespans: homeostasis, selection and competition Population biology of lymphocytes: the flight for survival Cellular competition modulates survival and selection of CD8+ T cells How does cross-reactive stimulation affect the longevity of CD8+ T cell memory? Maintaining the status quo: T-cell homeostasis An intersection between the selfreactive regulatory and nonregulatory T cell receptor repertoires Urn models and their application: an approach to modern discrete probability theory Memory CD8+ T cell differentiation: initial antigen encounter triggers a developmental program in naive cells A first course in stochastic processes The thymus gland Reversible defects in natural killer and memory CD8 T cell lineages in interleukin 15-deficient mice Comprehensive early and lasting loss of memory CD8 T cells and functional memory during acute and persistent viral infections Private specificities of CD8 T cell responses control patterns of heterologous immunity A B-cell deficient mouse by targeted disruption of the membrane exon of the immunoglobulin mu chain gene Control of homeostasis of CD8+ memory T cells by opposing cytokines Asymmetry and immune memory Disruption of T cell homeostasis in mice expressing a T cell-specific dominant negative transforming growth factor β II receptor Maintenance of serum antibody levels Attrition of bystander CD8 T cells during virus-induced T-cell and interferon responses Mutations in T-cell antigen receptor genes alpha and beta block thymocyte development at different stages Origin and T cell receptor diversity of Foxp3+ CD4+ CD25+ T cells Attrition of virus-specific memory CD8+ T cells during reconstitution of lymphopenic environments Normal development and function of CD8+ cells but markedly decreased helper cell activity in mice lacking CD4 Reduction of otherwise remarkably stable virusspecific cytotoxic T lymphocyte memory by heterologous viral infections Attrition of T cell memory: selective loss of LCMV epitope-specific memory CD8 T cells following infections with heterologous viruses CD8 memory T cells: cross-reactivity and heterologous immunity Memory of mice and men: CD8+ T-cell cross-reactivity and heterologous immunity Estimation of T-cell repertoire diversity and clonal size distribution by Poisson abundance models Measurement of diversity Generation and maintenance of memory T cells The concept of space and competition in immune regulation Regulation of mature T cell homeostasis The peripheral T cell repertoire: independent homeostatic regulation of virgin and activated CD8+ T cell pools The organization of mature T-cell pools Methods for comparing the diversity of samples of the T cell receptor repertoire Memory CD8 T-cell compartment grows in size with immunological experience Immunological memory to viral infections Apoptosis and loss of virus-specific CD8+ T-cell memory The privacy of T cell memory to viruses Interleukin-2 receptor α chain regulates the size and content of the peripheral lymphoid compartment Beta 2-microglobulin deficient mice lack CD4-CD8+ cytolytic T cells Acknowledgements This work was supported by NSF DMS-0354259. The authors are grateful to J.P. Keener, R. Antia, R.S. Fujinami, and A.L. Fogelson for helpful discussions.