3

Suppose I have a random variable $X$ following a Bernoulli distribution with some known probability $p$. How do I calculate the mean number of trials $N$ needed such that you'd expect to observe an inconsistent outcome in $X$?

For example, say I sampled $X$ five times ($N=5$), a consistent outcome would be $[0,0,0,0,0]$ or $[1,1,1,1,1]$ and an inconsistent outcome could be $[0,0,0,1,0]$ or $[1,1,0,0,0]$.

kjetil b halvorsen
  • 63,378
  • 26
  • 142
  • 467
OParry
  • 43
  • 3
  • 1
    You need two samples, otherwise single sample cannot be inconsistent with itself. With two samples unless p=0 or p=1, there’s a chance for inconsistency. If you need more precise answer, you need to make it more formal: what exactly do you mean? – Tim Jan 09 '21 at 13:13
  • You are using $N$ in two places, but I guess they are not supposed to be the same. Does $N$ relate to the number of samples or the sample size? **1** The *mean number of trials $N$* needed such that you'd expect to observe an inconsistent outcome. (and what do you mean by 'expect'?). **2** Say I *sample $X$ five times* ($N=5$). – Sextus Empiricus Jan 09 '21 at 15:02

1 Answers1

2

This is an interesting variant of the geometric distribution. Let $\DeclareMathOperator{\P}{\mathbb{P}} \P(X_i=1)=p$ with $0<p<1$. Define $N$ as the first index $n$ when $X_n \not= X_1$, that is, $$ N=\min_{n\ge 2} \{X_n \not= X_1\} $$ where $X_1, X_2, \dotsc, X_n, \dotsc$ are iid Bernoulli distributed. Then $$ \P(N=n)= \\ \P(X_1=0)\P(X_2=0)\dotsm\P(X_{n-1}=0)\P(X_n=1) + \\ \P(X_1=1)\P(X_2=1)\dotsm\P(X_{n-1}=1)\P(X_n=0) = \\ (1-p)^{n-1} p + p^{n-1} (1-p) = p(1-p)\left\{ (1-p)^{n-2}+p^{n-2} \right\} $$ (and by using the geometric series you can check that this sums to 1.) (This questian is a very special case of Time taken to hit a pattern of heads and tails in a series of coin-tosses .)

kjetil b halvorsen
  • 63,378
  • 26
  • 142
  • 467