# Continuity of the location

Consider $$f(x,\theta),$$ a density function for the random variable $$X$$ with a parameter $$\theta$$. Suppose $$f(x, \theta)$$ is continuous in $$\theta$$.

Is the location

$$\int_\mathbb{R} x f(x, \theta) dx$$

continuous in $$\theta$$?

The expectation does not have to be a continuous function of the parameter. The following example illustrates what can go wrong.

For any number $$0 \le p \le 1,$$ let $$g(x,p)=0$$ when $$x \le 1$$ and otherwise

$$g(x,p) = (p+1)x^{-(p+2)} = \frac{\mathrm{d}}{\mathrm{d}x}\left(1 - x^{-(p+1)} \right) = \frac{\mathrm{d}}{\mathrm{d}x}G(x,p).$$

This describes a family of positive distributions with distribution functions $$x\to G(x,p)$$ (Pareto distributions). Moreover, for any fixed real number $$x$$, the function $$p\to g(x,p)$$ is continuous (it's actually differentiable).

Using these, construct a family by mixing two such distributions,

$$f(x,\theta) = \frac{1 - \theta}{2} g(-x,\theta^2) + \frac{1+\theta}{2} g(x,\theta^2),$$

where $$-1 \le \theta \le 1.$$ Because $$g$$ is continuous in its second variable, the functions $$\theta\to f(x,\theta)$$ are all continuous (actually, differentiable).

The parameter $$\theta$$ plays two roles in this family: as it grows closer to $$0,$$ it increases the heaviness of the tails, causing the absolute value of the expectation to increase; and it also determines the amounts of negative and positive parts in the mixture, causing the expectation to move from negative to positive as $$\theta$$ crosses $$0.$$

Their expectations are

\begin{aligned} e(\theta) &= \int_{\mathbb R} x f(x,\theta)\,\mathrm{d}x\\ &= \frac{1 - \theta}{2}\int_{-\infty}^0 x g(-x,\theta^2)\,\mathrm{d}x + \frac{1 + \theta}{2}\int_0^\infty x g(x,\theta^2)\,\mathrm{d}x\\ &= -\frac{1 - \theta}{2}\int_0^\infty x g(x,\theta^2)\,\mathrm{d}x + \frac{1 + \theta}{2}\int_0^\infty x g(x,\theta^2)\,\mathrm{d}x\\ &=\theta \int_0^\infty x g(x,\theta^2)\,\mathrm{d}x\\ &= \theta \int_1^\infty x (\theta^2+1)x^{-(\theta^2 + 2)}\,\mathrm{d}x\\ &= \theta\left(1 + \frac{1}{\theta^2}\right) = \theta + \frac{1}{\theta}, \end{aligned}

provided $$\theta\ne 0.$$ When $$\theta = 0,$$ the expectation is undefined.

Clearly, as $$\theta$$ increases from just below $$0$$ to just above $$0,$$ there is no way to define $$e(0)$$ to make this a continuous function.

If you would like an example where all the density functions are continuous in $$x$$ everywhere (which these are not: they are discontinuous at $$\pm 1$$), then convolve these with (say) a standard Normal distribution. (These will be the densities of $$X+Z$$ where $$Z$$ is an independent standard Normal variable.) That adds $$0$$ to all the expectations while guaranteeing all the densities are infinitely differentiable. This is what some of them look like:

• +1 interesting, I would have expected the opposite. I am bit rusty with my math, could you comment on what goes wrong in the following "proof"? Start by the usual definition of pointwise continutiy, use linearity of the integral to come to $$\lim_{h \to 0} \left(\int_\mathbb{R} x \cdot \frac{f(x, \theta + h) - f(x, \theta)}{h} dx \right)$$ So the question boils down to whether we can exchange the limit with the integral. I thought initially yes, we can use e.g. dominated convergence to prove that in a neighborhood of 0, $$\frac{f(x, \theta + h) - f(x, \theta)}{h}$$ ...
– Ant
Oct 2, 2022 at 21:56
• ... (which must be close to $f(x, \theta)$) is less or equal to $k \cdot f(x, \theta)$ for some $k > 1$, and that would show that the function is dominated by a function in $L_1$, hence we apply lebesgue and we swap integral and limit and we're done. I guess this is incorrect and we cannot apply lebesgue's theorem here. Why not? :)
– Ant
Oct 2, 2022 at 21:59
• Since the expectation is not defined at $\theta=0$, isn't the function $e(\theta)$ technically continuous on its domain? Definitely an interesting example though. Oct 3, 2022 at 2:24
• @Jacob It is more constructive either (a) to recognize the domain of $\theta$ is indeed $(-1,1)$ and address the question of nonexistence by asking whether this is a "removable singularity:" that is, whether one can redefine $e(0)$ to make the function continuous; or (b) to broaden the definition of the integral to permit computing $e(0)$ (which will be $0$); or (c) truncating the tails of these distributions so that $e(\theta)$ is always finite and defined: it will still have a discontinuity at $0.$ In short, you can't rescue the situation by restricting the domain.
– whuber
Oct 3, 2022 at 14:47