# Example of computing the expectation of a discrete RV using Riemann-Stieltjes integral?

Riemann-Stieltjes integral notation is used in expectation expressions in some probability texts. Basically, dF(x) pops up in the integral rather than f(x)dx in the integral, since the CDF F(x) may not be differentiable for a discrete distribution.

The motivation I've heard for this is usually to provide a unified definition of expectation rather than treating it with a discrete case and a continuous case. It is also supposed to make it easier to think about mixtures of discrete and continuous. But I've never seen an example of computing an expectation with a Riemann-Stieltjes integral for a discrete distribution (or for a distribution that is a mixture of a point-mass and a continuous distribution).

Can someone please provide an example of both or either? Thanks!

• A search of our site for "Stieltjes" will turn up examples. For instance, I compute such an integral at stats.stackexchange.com/a/108220. (Although I refer to it as a Legesgue-Stieltjes integral there, that generalization is not required and the computation clearly works for Riemann-Stieltjes integrals.) That particular example concerns a distribution that is neither continuous nor discrete. – whuber Jan 19 '16 at 14:27

## 1 Answer

Since you don't sound like you've done much with the integral, I'm going to discuss this in very elementary (and slightly handwavy) fashion that should convey something of what happens. However, you may want to start with a reminder, by taking a look at the definition of a Stieltjes integral, see, for example Mathworld or Wikipedia. Doing the integrals properly involves considering the limit in the definition, and on the occasions where it's not otherwise obvious, that's really what you need to do.

If the distribution is purely discrete then $dF$ is 0 except at the jumps, where it's $p(x)$ -- so for discrete cases the integral is literally the usual sum.

Just as an example, consider a Bernoulli(0.4). So for this example, $E(X)=\int_{-\infty}^{\infty}\,x\,dF = \sum_x x\,p(x)$. (That's not just "they're equal in value" but "those things are different ways of expressing the same thing"; I should probably use a more appropriate symbol.)

So here $dF$ is $0$ everywhere but at $x=0$ (where $dF$ is $0.6$) and $x=1$ (where it's $0.4$). So that expression is just $0\cdot 0.6 + 1 \cdot 0.4$.

While unifying discrete and continuous formulas is neat, it's not really where the greater part of its value comes in to my mind. I see more value in the fact that it applies to cases where you have neither discrete nor continuous random variables -- and there are many instances where that's something you encounter with actual data, so it's not some esoteric theoretical issue. Having notation that can smoothly deal with those "neither discrete nor continuous" cases as well as with the discrete and continuous special cases all at the same time, that's where there's some real benefit.

Take a nice simple case that's neither, for example, a distribution of daily rainfall for a given month and location, perhaps modelled as a mixture of a probability of $0.6$ of zero rain, and non-zero rain amounts being lognormal$(\mu,\sigma^2)$ (where $\mu=1.384$,and $\sigma=1.823$) (which might be referred to as a "zero-inflated lognormal" model) Then in this case, an integral such as that for the expectation, $E(X)=\int_{-\infty}^{\infty} x \, dF$ can be dealt with quite easily, because it works like the discrete definition up to and at that jump (only adding $x.p(x)$ at the jump, which turns out to add $0$ to the integral, since all that $0.6$ probability was at $x=0$) and then in this case everywhere above $0$ (because the function is nice enough that Stieltjes is the same as ordinary Riemann) the rest works like a Riemann integral of $x\cdot f(x)$ above $0$, as long as we keep in mind that $dF$ is smaller than it would be for the lognormal (above $0$ you can see $F$ is "squished up" relative to a pure-lognormal cdf), exactly accounting for the probability ($0.4$) of exceeding $0$ here.

Of course, this works nicely for more than just $g(x)=x$; I'm just taking simple cases to show a little of what's going on. (whuber pointed to a nice example in comments, where he does an MGF calculation for a non-simple problem, where the distribution ends up as a mixed distribution)

Even just with these very nice functions (where you can treat them like Riemann where they're continuous, which is a subset of the cases covered by Stieltjes) there's infinities of cases in such mixtures (rather than just 'discrete' or 'continuous') that can be handled by this one notation.

A useful reference that uses this integral widely for showing or discussing a variety of results is Advanced Theory of Statistics (Kendall and Stuart -- or in more recent editions, Stuart and Ord). Don't let the title scare you, it's a very readable book.

So if you (for example) play around with integrals while looking at say a Chebyshev inequality, you're not just doing a discrete case and a continuous case at the same time ... you're covering any distribution the Stieltjes integral works for -- so if you wonder about what happens in Chebyshev if you have a distribution like say that rainfall one, lo, it's all taken care of by that same development. And if tomorrow, your friend turns up with a zero-one inflated beta, well, you already covered that as well. And so on ...

[If you get into a situation where you can't immediately see what the integral means, go back to the definition and follow it through.]

(This nice integral can be replaced by things that are capable of handling even broader situations - for statistical purposes, generally to the Lebesgue or Lesbesgue-Stieltjes integral)

• Thanks, that's very helpful. Any example of the "neither discrete nor continuous" case would be greatly appreciated, since this seems to be the bulk of the value of this (often off-putting) notation. – frelk Jan 19 '16 at 2:32