Tutorials › Stochastic Processes › Monte Carlo Estimation of Renewal Functions

Renewal Processes · Tutorial 572 of 994

Monte Carlo Estimation of Renewal Functions

Turn simulated interarrival sequences into an estimate of the expected renewal count, and measure the Monte Carlo uncertainty in that estimate.

Intermediate 10 min read

What You'll Learn

  • Define the renewal count using the endpoint convention that renewals at time t are included.
  • Simulate a renewal count by stopping at the first renewal epoch strictly greater than t.
  • Estimate the renewal function from independent simulated counts.
  • Calculate the sample variance and estimated standard error of a Monte Carlo estimate.
  • Check simulation output against an exact renewal-function value when one is available.

From Renewal Sequences to an Estimate

For a renewal model, the renewal function \(m(t)=\mathbb{E}N(t)\) is an expected count. In many models its exact value is not available in a convenient form, but one can simulate the interarrival times, count the renewals by time \(t\), and average the counts across independent repetitions. The simulation must implement the endpoint convention correctly: an epoch at exactly \(t\) is counted, while the first epoch after \(t\) is not.

Let \(X_1,X_2,\ldots\) be iid, strictly positive interarrival times on a probability space \((\Omega,\mathcal{F},\mathbb{P})\), with common distribution \(F\). Define the renewal epochs \(S_n=X_1+\cdots+X_n\) and the renewal count \(N(t)=\sum_{n\ge1}\mathbf{1}_{\{S_n\le t\}}\), for \(t\ge0\). The renewal function is \(m(t)=\mathbb{E}N(t)\). The sum uses \(\le t\), so an epoch at the endpoint is included. A simulation stops when it first observes an epoch strictly greater than \(t\); that overshooting interarrival is needed to know that the process has stopped, but its epoch does not contribute to \(N(t)\).

Definition: For \(M\) independent simulated renewal sequences, write \(Y_r=N_r(t)\) for the count in repetition \(r\). The Monte Carlo estimator of \(m(t)\) is \(\widehat m_M(t)=M^{-1}\sum_{r=1}^M Y_r\). Its sample variance is \(s_M^2=(M-1)^{-1}\sum_{r=1}^M(Y_r-\widehat m_M(t))^2\), and the estimated standard error of the average is \(s_M/\sqrt{M}\).

To simulate an interarrival time from \(F\), one may use an independent uniform random variable \(U\) on \((0,1)\) and the generalized inverse \(F^{-1}(u)=\inf\{x:F(x)\ge u\}\). In the examples below, the distribution is simple enough to state the transformation directly. A fixed list of uniform inputs makes the arithmetic reproducible; when inputs are instead generated randomly and independently, the sampling results below apply.

Why the Stopping Rule Gives the Renewal Count

Proposition: Suppose \(X_n>0\) almost surely for every \(n\), and the interarrival times are iid. For a fixed finite \(t\), the rule “draw interarrivals until the cumulative sum first exceeds \(t\), then report the number of epochs not exceeding \(t\)” terminates almost surely and returns \(N(t)\).

Proof. Since \(X_1>0\) almost surely, there is an \(\varepsilon>0\) such that \(p=\mathbb{P}(X_1\ge\varepsilon)>0\). Indeed, the union of the events \(\{X_1\ge1/k\}\), over positive integers \(k\), has probability one, so at least one such event has positive probability. Let \(I_j=\mathbf{1}_{\{X_j\ge\varepsilon\}}\). The \(I_j\) are iid Bernoulli variables with success probability \(p\). With probability one there are infinitely many successes: for any fixed integer \(r\), the probability of at most \(r\) successes among the first \(n\) trials is \(\sum_{k=0}^r {n\choose k}p^k(1-p)^{n-k}\), which tends to zero as \(n\) tends to infinity when \(0<p<1\); if \(p=1\), every trial is a success. Thus \(S_n\ge\varepsilon\sum_{j=1}^n I_j\) tends to infinity almost surely, and some finite \(S_n\) exceeds \(t\). Because every \(X_j\) is positive, the sequence \(S_n\) is strictly increasing. If \(S_q\) is its first epoch exceeding \(t\), then exactly \(S_1,\ldots,S_{q-1}\) are at most \(t\), so the algorithm reports \(q-1=\sum_{n\ge1}\mathbf{1}_{\{S_n\le t\}}=N(t)\). \(\square\)

The count is also suitable for estimating an expectation and a variance under these assumptions. In particular, its second moment is finite for each fixed \(t\). To see why, choose \(\varepsilon\) and \(p\) as in the proof, and put \(r=\lfloor t/\varepsilon\rfloor\). If \(N(t)\ge n\), then \(S_n\le t\), so at most \(r\) of the first \(n\) interarrivals can be at least \(\varepsilon\). For \(0<p<1\), this gives \(\mathbb{P}(N(t)\ge n)\le\sum_{k=0}^r{n\choose k}p^k(1-p)^{n-k}\). The right side is bounded by a polynomial in \(n\) times a geometrically decreasing factor, so its sum weighted by \(2n-1\) is finite. If \(p=1\), \(N(t)\le r\) almost surely. Finally, for any nonnegative integer-valued \(N\), \(N^2=\sum_{n=1}^N(2n-1)\), and hence \(\mathbb{E}[N(t)^2]=\sum_{n\ge1}(2n-1)\mathbb{P}(N(t)\ge n)<\infty\).

Theorem (Monte Carlo mean and sampling error): Let \(Y_1,\ldots,Y_M\) be independent copies of \(N(t)\), with \(\mathbb{E}[N(t)^2]<\infty\), and let \(\sigma^2=\operatorname{Var}(N(t))\). Then \(\mathbb{E}[\widehat m_M(t)]=m(t)\) and \(\operatorname{Var}(\widehat m_M(t))=\sigma^2/M\). For \(M\ge2\), \(s_M^2\) is an unbiased estimator of \(\sigma^2\), so \(s_M/\sqrt M\) estimates the standard deviation of the Monte Carlo average.

Proof. Linearity of expectation gives \(\mathbb{E}[\widehat m_M(t)]=M^{-1}\sum_{r=1}^M\mathbb{E}[Y_r]=m(t)\). Independence gives \(\operatorname{Var}(\widehat m_M(t))=M^{-2}\sum_{r=1}^M\operatorname{Var}(Y_r)=\sigma^2/M\), because the covariance between distinct \(Y_r\) is zero. To verify the sample-variance claim, use the identity \(\sum_{r=1}^M(Y_r-\widehat m_M)^2=\sum_{r=1}^M(Y_r-m(t))^2-M(\widehat m_M-m(t))^2\). Taking expectations, the first sum on the right has expectation \(M\sigma^2\), and the second term has expectation \(M(\sigma^2/M)=\sigma^2\). The expected left side is therefore \((M-1)\sigma^2\), which proves \(\mathbb{E}[s_M^2]=\sigma^2\). The estimated standard error follows by taking the square root of the estimated variance \({s_M^2}/{M}\). \(\square\)

The standard error describes the estimated spread of the average across repeated simulations; it is not the actual error \(\lvert\widehat m_M(t)-m(t)\rvert\), which is unknown unless the true value is known. A small estimated standard error is useful evidence of numerical precision, but it is not a guarantee that one particular run is close to the truth.

Worked Simulations

Worked Example: Counting One Stopped Sequence

Suppose \(X=1\) when \(U<\tfrac12\), and \(X=2\) when \(U\ge\tfrac12\), for independent uniform inputs \(U\). For \(t=4\), take the inputs \(\tfrac1{10},\tfrac7{10},\tfrac2{10},\tfrac8{10}\). Since the first and third inputs are below \(\tfrac12\), their interarrivals are \(1\); the other two are \(2\). The cumulative epochs are therefore \(1,3,4,6\). The first epoch strictly greater than \(4\) is \(6\), so the simulation stops after four draws and reports \(N(4)=3\). The epoch \(4\) is included, while the overshoot at \(6\) is not. As a direct check, the three epochs at most \(4\) are \(1,3,4\), giving a count of three.

Worked Example: Eight Replications at Time Five

Use the same two-point interarrival law and take \(t=5\). Each row below gives exactly the uniform draws used through the first epoch above \(5\). No inputs after stopping are included. Each draw below \(\tfrac12\) gives an interarrival of \(1\); each draw above \(\tfrac12\) gives an interarrival of \(2\).

Rep.Uniform draws usedInterarrivals usedEpochs through stopping\(N(5)\)
1\(\tfrac1{10},\tfrac7{10},\tfrac2{10},\tfrac8{10}\)1, 2, 1, 21, 3, 4, 63
2\(\tfrac6{10},\tfrac4{10},\tfrac9{10},\tfrac3{10}\)2, 1, 2, 12, 3, 5, 63
3\(\tfrac2{10},\tfrac1{10},\tfrac8{10},\tfrac7{10}\)1, 1, 2, 21, 2, 4, 63
4\(\tfrac9{10},\tfrac8{10},\tfrac3{10},\tfrac6{10}\)2, 2, 1, 22, 4, 5, 73
5\(\tfrac8{10},\tfrac9{10},\tfrac6{10}\)2, 2, 22, 4, 62
6\(\tfrac1{10},\tfrac2{10},\tfrac3{10},\tfrac4{10},\tfrac1{10},\tfrac2{10}\)1, 1, 1, 1, 1, 11, 2, 3, 4, 5, 65
7\(\tfrac2{10},\tfrac8{10},\tfrac9{10},\tfrac9{10}\)1, 2, 2, 21, 3, 5, 73
8\(\tfrac8{10},\tfrac3{10},\tfrac4{10},\tfrac9{10}\)2, 1, 1, 22, 3, 4, 63

For example, in replication 2, the cumulative sums are \(2,3,5,6\). The draw producing epoch \(6\) is the fourth and final draw used: it establishes that the process has passed \(5\). Thus the count is three, and there is no fifth draw in this stopped sequence.

The eight reported counts sum to \(3+3+3+3+2+5+3+3=25\), so \(\widehat m_8(5)=\tfrac{25}{8}\). Six counts equal \(3\), one equals \(2\), and one equals \(5\). Their squared deviations from the mean are \(6(\tfrac18)^2+(\tfrac98)^2+(\tfrac{15}{8})^2=\tfrac{39}{8}\). Therefore \(s_8^2=(\tfrac{39}{8})/7=\tfrac{39}{56}\), and the estimated standard error is \(\sqrt{(\tfrac{39}{56})/8}=\sqrt{\tfrac{39}{448}}\). These calculations can be checked by substituting the displayed mean into each deviation; in particular, \(\tfrac{25}{8}\) is exactly the sum of the eight table counts divided by eight.

Worked Example: Checking an Estimate Against an Exact Value

Keep the same interarrival distribution, but set \(t=2\). Consider eight fixed uniform input sequences. A sequence needs a third draw only when its first two interarrivals are both \(1\), because then the second epoch is exactly \(2\) and another draw is needed to establish that the sequence has passed the endpoint.

Take the inputs for the eight replications to be, in order: \((\tfrac2{10},\tfrac3{10},\tfrac8{10})\), \((\tfrac7{10},\tfrac1{10})\), \((\tfrac4{10},\tfrac9{10})\), \((\tfrac8{10},\tfrac8{10})\), \((\tfrac1{10},\tfrac2{10},\tfrac2{10})\), \((\tfrac9{10},\tfrac3{10})\), \((\tfrac3{10},\tfrac7{10})\), and \((\tfrac6{10},\tfrac4{10})\). Applying the threshold rule, the counts are respectively \(2,1,1,1,2,1,1,1\). For instance, the first sequence has interarrivals \(1,1,2\), epochs \(1,2,4\), and count \(2\); the third has interarrivals \(1,2\), epochs \(1,3\), and count \(1\).

The sample mean is \((2+1+1+1+2+1+1+1)/8=10/8=\tfrac54\). To check against the exact renewal function, the first renewal is always by time \(2\), since \(X_1\) is either \(1\) or \(2\). A second renewal is by time \(2\) exactly when \(X_1=X_2=1\), an event with probability \(\tfrac12\cdot\tfrac12=\tfrac14\). No third renewal can occur by time \(2\), because three strictly positive interarrivals, each at least \(1\), sum to at least \(3\). Hence \(m(2)=1+\tfrac14=\tfrac54\), matching this particular simulation average. Agreement in one run is not guaranteed in general; here it is a check on the counting rule and arithmetic.

For this sample, the deviations from \(\tfrac54\) are \(\tfrac34\) for two counts and \(-\tfrac14\) for six counts. Thus the sum of squared deviations is \(2(\tfrac34)^2+6(\tfrac14)^2=\tfrac32\), the sample variance is \((\tfrac32)/7=\tfrac3{14}\), and the estimated standard error is \(\sqrt{(\tfrac3{14})/8}=\sqrt{\tfrac3{112}}\). Although the observed estimate happens to equal the exact value, its estimated standard error is positive: other independent simulations can produce a different average.

Common Pitfalls and Practical Use

Common mistake: count only epochs strictly before \(t\). In replication 2 at \(t=5\), the epochs are \(2,3,5,6\). Counting only those with \(S_n<5\) gives \(2\), but the renewal-count convention is \(S_n\le5\), so the correct count is \(3\). The equality case matters for distributions with atoms, such as the two-point law used here.

Common mistake: keep drawing after the stopping epoch. If the first epoch above \(5\) is the fourth epoch, the simulation has already stopped after the fourth interarrival. Any later values are not used and must not appear in a column labelled “draws used.” The overshooting draw is included because it identifies the stopping point; it is not counted as a renewal by time \(t\).

In practice, keep the tasks distinct: generate one independent sequence per replication, stop each sequence at its first epoch strictly greater than \(t\), and record the number of preceding epochs. Then average those counts and report the sample standard deviation divided by \(\sqrt M\) as the estimated standard error. Increasing \(M\) generally reduces the standard deviation of the average at the rate \(1/\sqrt M\), as the variance formula shows, though it does not change the variance of an individual renewal count.

Check Your Understanding

Use the endpoint convention and stopping rule stated above in each question.

  1. If the epochs through stopping are \(1,3,5,7\) and \(t=5\), what count should be reported, and which epoch ends the simulation?
  2. For independent simulated counts \(Y_1,\ldots,Y_M\), why is the variance of their average \(\operatorname{Var}(N(t))/M\)?
  3. For the two-point interarrival law \(X\in\{1,2\}\) with equal probabilities, find \(m(1)\) and explain why a renewal at time \(1\) is included.
  4. What is the difference between the actual Monte Carlo error and the estimated standard error?
  5. In a stopped simulation, should the draw that produces the first epoch greater than \(t\) be counted as a renewal by time \(t\)? Explain.