I need to understand the Survival Analysis concept of "mean residual life (MRL)" and calculating probabilities for reaching it.

From another discussion:

The MRL at time t is the mean additional time after time t that you expect an entity to survive, given that it has survived until time t. It does not include the time from time 0 to time t that the entity has already lived through, so it is possible for it to be less than the mean lifetime if t>0. It must equal the mean lifetime if t=0.

I've worked up a Manipulate model to illustrate some of this:

 MRL[variable_, distribution_] := 
  NExpectation[X \[Conditioned] X > variable, 
    X \[Distributed] distribution] - variable;

mrlPlot = Plot[
   MRL[x, LogNormalDistribution[1.75, 0.65]], {x, 0, 40},
   ImageSize -> 400,
   PlotRange -> All,
   AxesLabel -> {"Time", None}, ImagePadding -> {{20, 40}, {10, 0}}];

 Module[{mrl, dist, mean, cdf, cdfMean, cdfMRL, pdf, pdfMRL, 
  dist = LogNormalDistribution[1.75, 0.65];
  mrl = MRL[t , dist] + t;
  mean = Mean[dist];
  cdf = N[CDF[dist, t], 3];
  cdfMRL = N[CDF[dist, mrl], 3];
  cdfMean = N[CDF[dist, mean], 3];
  pdf = N[PDF[dist, t ], 3];
  pdfMRL = N[PDF[dist, mrl], 3];
  pdfMean = N[PDF[dist, mean], 3];

      Plot[PDF[dist, x], {x, 0, 40},
       ImageSize -> 400,
       PlotRange -> All,
       AxesLabel -> {"Time", None}, 
       ImagePadding -> {{20, 40}, {10, 0}},
       Prolog -> {Text["Expectation", {mean + 3.5, .01}], 
         Text["t", {t + 1, pdf - .003}], 
         Text["MRL+t", {mrl + 3, pdfMRL - .003}]}],
      Plot[PDF[dist, x], {x, t, mean}, PlotRange -> All, 
       AxesOrigin -> {Automatic, 0}, Filling -> Axis],
      ListPlot[{{t, pdf}, {mean, pdfMRL}}, PlotRange -> All, 
       PlotStyle -> PointSize[0.015]],
      ListPlot[{{mrl, pdfMRL}}, PlotRange -> All, 
       PlotStyle -> {Red, PointSize[0.015]}]
     GridLines -> {{{t, {Dashed}}, {mean, {Dashed, 
          LightGray}}, {mrl, {Dashed, Red}}}, {{pdfMean, LightGray}, 
        pdf, pdfMRL}}],
    "", "CDF",
      Plot[CDF[dist, x], {x, 0, 40},
       ImageSize -> 400,
       PlotRange -> All,
       AxesLabel -> {"Times", None}, 
       ImagePadding -> {{20, 40}, {10, 0}},
       Prolog -> {Text["Expectation", {mean + 3.5, .075}], 
         Text["t", {t + 1, cdf - .03}], 
         Text["MRL+t", {mrl + 3, cdfMRL - .03}]}],
      ListPlot[{{t, cdf}, {mean, cdfMean}}, PlotRange -> All, 
       PlotStyle -> PointSize[0.015]],
      ListPlot[{{mrl, cdfMRL}}, PlotRange -> All, 
       PlotStyle -> {Red, PointSize[0.015]}]},
     GridLines -> {{{t, {Dashed}}, {mean, {Dashed, 
          LightGray}}, {mrl, {Dashed, Red}}}, {{cdfMean, LightGray}, 
        cdf, cdfMRL}}],
 {{t, 0, "t"}, 0, 40, .01, Appearance -> "Labeled"},
 TrackedSymbols :> {t},
 FrameLabel -> {None, None, 
 LabelStyle -> Medium]

Snapshot of the Manipulate follows:


The last of the plots in the Manipulate[] shows a static plot of mean residual life. You can see how at time, t = 0 its value is just over 7 which equals the mean lifetime (expectation). It shows how MRL drops then rises as t varies from 0 to 40.

The PDF and CDF plots show something else, t + MRL, or how much the person has lived until now (t) plus the mean of the lifetime remaining to it.

Given the timeframe shown (0 to 40) t + MRL will vary its distance as t increases, but will always remain beyond t. I think this makes sense, given that someone or something has survived to some point, t, and has no absolute limit of life, they have some additional time to live.

1st question: Does this make sense so far? Just working my way through these ideas, so I may not have them all right just yet.

2nd question: I now need to calculate the probability of someone reaching t + MRL given that they have already reached t.

This seems like it should be straight forward, but I don't have a good intuition for the answer. I've thought I could do one of these:

MRL[variable_, distribution_] := NExpectation[X \[Conditioned] X > variable, X \[Distributed] distribution] - variable;
t = 5;
expectedLife = MRL[t, LogNormalDistribution[1.75, 0.65]] + t

p1 = NProbability[x >= t && x <= expectedLife, x \[Distributed] LogNormalDistribution[1.75, 0.65]]
p2 = NProbability[x <= expectedLife, x \[Distributed] LogNormalDistribution[1.75, 0.65]]

Does either p1 or p2 makes sense? Have I missed something fundamental here? How should I go about this?

Any help and explanation much appreciated.


1 Answer 1


This topic is a bit unfamiliar to me but here's my take. I believe you can simplify your life a bit by looking at an alternative definition of mrl.

Using the definition for continuous distributions...

Expectation[x - t \[Conditioned] x > t, x \[Distributed] dist] ==
Expectation[x - t, x \[Distributed] TruncatedDistribution[{t, Infinity}, dist]] ==
Expectation[x, x \[Distributed] TruncatedDistribution[{t, Infinity}, dist]] - t

giving us...

 mrl[t_] = Mean[TruncatedDistribution[{t, Infinity}, dist]] - t

This gives an easy way to obtain another measure which, according to Klein and Moeschberger (a book I highly recommend), is preferable for skewed distributions. This is the median residual life:

mdrl[t_] =  Median[TruncatedDistribution[{t, Infinity}, dist]] - t

For fun, lets compare them for dist = LogNormalDistribution[1.75, .65].

Plot[{mrl[t], mdrl[t]}, {t, 0, 40}, PlotStyle -> {Red, Blue}]

plots of mean and median residual lives

Now the probability that someone survives mrl (or mdrl) units beyond time t given they have survived to time t is relatively easy to compute in that we can state it exactly as we say it.

pMRL[t_] := NProbability[x > t + mrl[t] \[Conditioned] x > t, x \[Distributed] dist]
pMDRL[t_] := NProbability[x > t + mdrl[t] \[Conditioned] x > t, x \[Distributed] dist]

Not surprisingly, the plot for pMDRL is not very exciting compared to pMRL.

Plot[{pMRL[t], pMDRL[t]}, {t, 0, 10}, PlotStyle -> {Red, Blue}]

plots of probability of mean and median residual lives

  • $\begingroup$ Really helpful. Still absorbing this. Thought a Timing[] of the 4 ways to do it that you show would prove interesting: t=5, dist as above. Timing[Expectation[x - t [Conditioned] x > t, x [Distributed] dist]] Timing[Expectation[x - t, x [Distributed] TruncatedDistribution[{t, Infinity}, dist]]] Timing[Expectation[x, x [Distributed] TruncatedDistribution[{t, Infinity}, dist]] - t] Timing[Mean[TruncatedDistribution[{t, Infinity}, dist]] - t] {8.08079, 4.79343} {0.764908, 4.79343} {0.362332, 4.79343} {0.443986, 4.79343}. Any idea of why the 3rd way runs so much faster? $\endgroup$
    – Jagra
    Apr 4, 2012 at 15:03
  • $\begingroup$ I suspect its because something very much like the third method is what is actually being done under the hood for the others so it circumvents some logic, simplification, and checking to call it directly. This is just a suspicion though. $\endgroup$
    – Andy Ross
    Apr 4, 2012 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.