A work session on a server contains a random number of jobs, and each job adds a random delay. The total delay is then a sum whose number of terms is itself random. Can its mean and variance be found from the mean and variance of one delay and of the number of jobs? This lesson shows that they can when the delays are IID and the count is independent of them, by conditioning on the count and applying the law of total variance, and it settles what a sum with no terms means.
Key terms
Random count
Definition A random count is a random variable whose possible values are nonnegative integers . In a random sum it is the number of terms that are added. The results on this page assume that the count is independent of the whole sequence of terms , which means that is independent of the vector for every . Independence of from each term separately is weaker, and it is not enough for the variance formula below.
In plain words The number of terms carries no information about the values of the terms. Learning the value of tells you how many terms there are and changes nothing about the distribution of their values. A count that never looks at the terms can still fail this, for example when busy periods bring both more jobs and longer delays.
Example In a constructed service model, a coin toss independent of all delays decides whether a session has or jobs, each with probability . Then , and . The number of requests that reach a server in a minute, modeled as , is another common random count.
Random sum
Definition Let be IID random variables and let be a random count independent of the whole sequence. The random sum is
so on an outcome where the value of is , the partial sum of the first terms. For each with , independence makes the conditional distribution of given equal to its unconditional distribution. Given , the random sum is therefore an ordinary sum of IID terms.
In plain words Two sources of randomness feed the total, how many terms there are and how large each term is. The sequence of possible terms is part of the model whether or not a term is used, and only decides how many of them are counted. Conditioning on removes the first source and leaves a sum with a fixed number of terms.
Example Let each delay be or minutes with probability each, independently, and let be the count of the previous card. One delay has mean minutes, second moment square minutes and variance square minutes. On an outcome with and delays , the total is minutes, and the fourth delay is not counted. Given the total is one delay, or with probability each. Given the number of delays equal to minutes is , so the total is , , or with conditional probabilities , , and .
Empty sum
Definition A sum with no terms, such as , is defined to be . So on the event . This convention keeps the rule for the partial sums true at , and it makes the conditional formulas and of the next cards hold at as well.
In plain words A session with no jobs adds no delay, so its total is zero rather than undefined. The converse can fail. A nonempty sum can also be zero, for example when every included term is , so is at least and can be larger.
Example Let be , or with probabilities , and , independent of delays that are or minutes as before. The total is on the empty session, on a one-job session whose delay is , and on a two-job session whose delays are both , so
This is more than . Without the convention, would have no value on an event of probability .
Mean of a random sum
Definition Let be identically distributed with finite mean , and let be a random count with that is independent of the whole sequence. Then
For each with , independence and linearity give , and the empty sum gives the same at . So , and the tower rule gives . The same argument applied to the nonnegative terms shows that , so has a finite mean and the tower rule applies. This formula does not need the terms to be independent of each other, and the terms may take negative values.
In plain words The expected total is the expected number of terms times the mean of one term. The shortcut works because the count carries no information about the terms. If the count is chosen by looking at the terms, conditioning on can change their distribution, and the formula needs a separate argument and can fail, as the last question below shows.
Example In the service model, and minutes, so
minutes. The formula gives the same value, minutes.
Variance of a random sum
Definition Let be IID with mean and finite variance , and let be a random count with that is independent of the whole sequence. Then
For each with , the terms are still IID given , so their variances add and . Together with this gives . The law of total variance with as the group label then gives the within-group variation and the between-group variation . The step uses the independence of the terms from each other as well as from .
In plain words Two kinds of uncertainty add up. Even when the count is known, the terms vary, and that gives . The count itself varies, which moves the conditional mean up and down, and that gives . Replacing by its mean, when that mean is a whole number, keeps the mean of the total right but drops the second part. The second part uses , so a negative mean, such as an average loss, adds as much to it as a positive mean of the same size, and the second part vanishes when .
Example In the service model, and , so the within part is , the between part is , and square minutes. A fixed count of jobs would give only . To check the formula, multiply the conditional probabilities of each branch of the count by its weight and add the branches that give the same total. The total gets from the one-job branch and from the three-job branch, and the total gets and .
The four probabilities add to . From the table, and , so square minutes. If instead every job in a session shared the same delay, with for all and still independent of , the total would be . Its mean would still be , but its variance would be instead of , because the terms are no longer independent of each other.
Check yourself
- Let be or with probability each, independent of IID delays that are or minutes with probability each. Find , and .
Show the answer
The count has , and , and one delay has and . So minutes and square minutes.
The total is for certain on the empty session, which has probability . On a two-job session both delays are with probability , which contributes . So .
- The number of requests that reach a server in one minute is . Each request has size or units with probability each, the sizes are IID, and they are independent of . Find the mean and variance of the total size , and the probability that .
Show the answer
One request has , and . A Poisson count has . So units and square units. With a count the formula reduces to , and here gives the same answer.
Every request has size at least , so the total is only on the empty sum, and .
- Delays are IID, or minutes with probability each. A rule looks at the first delay and sets if and if . Find and , compare them with the formulas for random sums, and say which assumption fails.
Show the answer
If , the sum is . If , the sum is empty and equals . So in every case, with minutes and square minutes.
The count has and , so the formulas would give and . Both are wrong. The count is not independent of the delays, since it is computed from . Given the included delay is for certain, so instead of , and conditioning on has changed the distribution of the term.