# Simple example wanted: $X_n$ converges to $X$ in probability but not almost surely

I'm looking for a simple example sequence $$\{X_n\}$$ that converges in probability but not almost surely.

The example I have right now is Exercise 47 (1.116) from Shao:

$$X_n(w) = \begin{cases}1 &k/2^m \leq w \leq (k+ 1)/2^m \\ 0 &o.w. \end{cases}$$

for $$w \in [0,1]$$ and integer $$m$$. In this case, since $$m$$ is arbitrary, you can find an infinite sequence $$\{n_m\}$$ where $$X_{n_m} (w) = 1$$.

Can you provide a simpler example? Thanks!

Define a sequence of independent rv's $$X_n$$ where: $$P(X_n=1)=\frac{1}{n}, \;P(X_n = 0) = 1-\frac{1}{n}$$

Let $$X= 0, \text{a.s.}$$

Define the event $$E_n:= \{X_n=1\}$$, then we get:

$$\sum_{n=1}^\infty P(E_n) = \sum_{n=1}^\infty \frac1n = \infty$$

By the "converse" Borel-Cantelli Lemma: if we have a sequence of independent events and their probabilities sum to $$\infty$$, then the event happens infinitely often.

So, in this case, $$X_n=1$$ happens infinitely often, and so $$X_n$$ does not converge almost surely to $$X$$.

However,

$$\lim_{n\to\infty} P(|X_n-X|>\epsilon) =\lim_{n\to\infty} P(X_n>0) = 0 \;\;\forall \epsilon>0$$

So $$X_n \xrightarrow{p} X$$

• Thank you Bey, this is definitely simpler! I am also interested in a "statistically meaningful" example, a case where this property comes up while making (asymptotic) inference. Commented Apr 26, 2016 at 14:02
• @nooreen well, the model I provided is applicable to a wide array of actual phenomena. Basically, any process that decays as $\frac{1}{n}$. Whether something is "meaningful" is quite application specific.
– user75138
Commented Apr 26, 2016 at 14:28
• @nooreen also, the definition of a "consistent" estimator only requires convergence in probability. Are there cases where you've seen an estimator require convergence almost surely?
– user75138
Commented Apr 26, 2016 at 14:29
• @nooreen see this post as well. It specifically discusses when, if ever, strong consistency is relevant to inference: stats.stackexchange.com/questions/2230/…
– user75138
Commented Apr 26, 2016 at 14:33

Let $$U$$ be a real number uniformly distributed between $$0$$ and $$1.$$

For $$n=0,1,2,3,4,4,5,6,7,8,9,$$ let $$Y_n= \begin{cases} 1 & \text{if the tenth's digit of U is n} \\ 0 & \text{otherwise}. \end{cases}$$

Then for $$n=(0,0), (0,1), (0,2), \ldots, (0,9), (1,0),(1,1),\ldots,(9,9)$$ let $$Y_n = \begin{cases} 1 & \text{if the 10th's and 100th's digits of U} \\ & \text{are the components of the pair }n, \\[5pt] 0 & \text{otherwise.} \end{cases}$$

Then for $$n=(0,0,0), (0,0,1), (0,0,1),\ldots , (9,9,9),$$ let $$Y_n = \begin{cases} 1 & \text{if the first three digits of U after the decimal} \\ & \text{point are the three components of n,} \\[5pt] 0 & \text{otherwise.} \end{cases}$$ And so on.

Look at this sequence in the order introduced above. It converges in probability to $$0,$$ but it does not converge almost surely to $$0,$$ since the probability that the digits of $$U$$ are all $$0$$ after some point is $$0.$$

• This looks interesting - using that (a subset of) rationals has zero mass in the interval [0,1] ? But how do you index that sequence in integers? and how do you continue from the 10th, then the 10th and the 100th, then the first three and then and so on?
– Ute
Commented Sep 5, 2023 at 17:01
• The answer itself tells you how to index it with integers, but it doesn't give a closed form for the $n$th term. That didn't seem important for my purpose. But I don't understand your comment that a set of rationals has zero mass. Certainly the set of numbers between $0$ and $1$ that have a certain sequence as their first $k$ digits, is not a set of rationals; it is an interval in the reals. Commented Sep 6, 2023 at 0:16