Integral by part expected liftime, suvival analysis $\frac{1}{S(t_0)} \int_0^{\infty} t\,f(t_0+t)\,dt = \frac{1}{S(t_0)} \int_{t_0}^{\infty} S(t)\,dt$ I am currently doing some survival analysis and on the wikipedia page https://en.wikipedia.org/wiki/Survival_analysis
I don't understand how they got this formula for the expected future life time (when they have to compute an integral by part) what's the trick here?
$\frac{1}{S(t_0)} \int_0^{\infty} t\,f(t_0+t)\,dt = \frac{1}{S(t_0)} \int_{t_0}^{\infty} S(t)\,dt$
 A: Recall that if $X$ has density $f$ with $\mathbb P(X>0)=1$, then
$$\mathbb E[X] = \int_0^\infty tf(t)\ \mathsf dt = \int_0^\infty S(t)\ \mathsf dt, $$
where $S(t)=1-F(t)$ is the survivor function of $X$. This follows from Tonelli's theorem, as for any $t>0$,
$$1-F(t) = \int_t^\infty f(s)\ \mathsf ds, $$
and so
$$\int_0^\infty S(t)\ \mathsf dt =  \int_0^\infty\int_t^\infty f(s)\ \mathsf ds\ \mathsf dt = \int_0^\infty\int_0^sf(s)\ \mathsf dt\ \mathsf ds=\int_0^\infty sf(s)\ \mathsf ds.$$
This is the same as your problem, after a change of variables $s=t+t_0$:
$$\int_0^\infty tf(t+t_0)\ \mathsf dt = \int_{t_0}^\infty (s-t_0)f(s)\ \mathsf ds. $$
A: Do you know what is integration by part?
Given function $u(t)$ and $v(t)$,
$$\int_a^b u(t) d(v(t))=u(t)v(t)|_a^b-\int_a^b v(t)d(u(t))$$
This result comes from the product rule of derivatives.
In this case, we can let $F(t+t_0)=v(t)$, and since $F'(t+t_0)dt=f(t+t_0)dt=d(v(t))$
And $t=u(t)$ gives $du=dt$
We can compute the integral by
$$\frac 1{S(t_0)} \int_0^{\infty}t d(F(t+t_0))=\frac 1{S(t_0)} [tF(t+t_0)|_0^{\infty} -\int_0^{\infty}F(t+t_0)dt]$$
Since $F(t+t_0)=1-S(t+t_0)$
$$=\frac 1{S(t_0)} [tF(t+t_0)|_0^{\infty} -\int_0^{\infty}dt +\int_0^{\infty}S(t+t_0)dt]$$
We can let $r=t+t_0$, which is nothing more than shifting the time of reference $t_0$ unit forwards, $dt=du$
$$=\frac 1{S(t_0)} [t(F(t+t_0)-1)|_0^{\infty} +\int_{t_0}^{\infty}S(r)dr]$$
Here's come the annoying bit, if you evaluate $t(F(t+t_0)-1)$ at $t=\infty$, you will get an expression of $0\times \infty$. Usually it requires using L'Hopital's rule, but it doesn't work here. Now I will claim here without proof that the value of it will be simply $0$. The reasoning behind is that $\int_0^{\infty}f(t)dt=1$ by definition, and $f(t)$ is usually an exponential decay. And the rate of decrease is much greater than the rate of increase of $t$.
Anyway, the last step is to notice that $u$ is just a dummy variable, so we put it back as $t$, the expression reduces to:
$$\frac 1{S(t_0)}\int_{t_0}^{\infty}S(t)dt$$
