7
$\begingroup$

By definition of median, i.e.

$P(X\leq m)\geq 1/2 \text{ and } P(X\geq m)\geq 1/2.$

What is the median of Bernoulli distribution with a probability parameter of $p=0.2$ ($P(X=1)=0.2$)?

Suppose $m$ is the median. Then $P(X\leq m)\geq 1/2$ implies $m\geq0$. $P(X\geq m)\geq 1/2$ implies $m<0$. One says m is greater or equal to 0 and the other says it is strictly less than 0. I don't understand where I did wrong.

Here are the CDF plotenter image description here.

$\endgroup$
7
  • 1
    $\begingroup$ Your second deduction is incorrect: $P(X\ge m)\ge 1/2$ implies $m\le 1.$ $\endgroup$
    – whuber
    Oct 21, 2020 at 15:48
  • $\begingroup$ Is it $m\leq 1$ or $m < 1$? The CDF is right continuous and so is 1-CDF? $\endgroup$
    – Tan
    Oct 21, 2020 at 15:59
  • 2
    $\begingroup$ There are only three intervals to consider. For $m\le0,$ $\Pr(X\ge m)=1;$ for $0\lt m\le1,$ $\Pr(X\ge m)=0.8;$ and otherwise for $m\gt 1,$ $\Pr(X\ge m)=0.$ (I took the parameter to be $p=\Pr(X=0).$) $\endgroup$
    – whuber
    Oct 21, 2020 at 15:59
  • $\begingroup$ I updated my question accordingly. $\endgroup$
    – Tan
    Oct 21, 2020 at 16:15
  • 2
    $\begingroup$ Your plot of $S$ is incorrect: check its values at $0$ and $1.$ $\endgroup$
    – whuber
    Oct 21, 2020 at 16:31

2 Answers 2

8
$\begingroup$

Let $X \sim \mathsf{Bern}(p=.2)\equiv\mathsf{Binom}(n=1, p=.2).$ In R, where qbinom is the inverse CDF (quantile function) of a binomial distribution a median $\eta = 0.$

qbinom(.5, 1, .2)
[1] 0

$P(X \le 0) = P(X = 0) = 0.8 \ge 1/2.$

dbinom(0, 1, .2)
[1] 0.8

And obviously, $P(X \ge 0) = 1 \ge 1/2.$

The CDF of $X$ is plotted below. The median of $X$ is taken to be the value at which the CDF 'curve' is (or 'crosses') $1/2.$

curve(pbinom(x, 1, .2), -.5, 1.5, n=10001, xaxs="i", ylab="CDF")
 k = 0:1; cdf = pbinom(k, 1, .2)
 points(k,cdf,pch=19)
 abline(h = .5, col="blue", lwd=2, lty="dotted")

enter image description here

Also, for context, if we simulate $1000$ observations from this distribution, we get $805$ Failures (0) and $195$ Successes. According to R, the sample median is also $0.$

set.seed(2020)
x = rbinom(1000, 1, .2)
table(x)
x
  0   1 
805 195 
summary(x)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  0.000   0.000   0.000   0.195   0.000   1.000 
$\endgroup$
5
  • 1
    $\begingroup$ Re "various versions:" what version would give any different value in this case?? $\endgroup$
    – whuber
    Oct 21, 2020 at 16:03
  • 1
    $\begingroup$ While making CDF curve, I realized the median is unique in this case. Deleted first line. In this example, there might be various versions of the 80th percentile. $\endgroup$
    – BruceET
    Oct 21, 2020 at 16:24
  • 1
    $\begingroup$ +1 The plot of the CDF is helpful. $\endgroup$
    – whuber
    Oct 21, 2020 at 16:29
  • $\begingroup$ thank you. But I was asking the theoretical median of the Bernoulli but not based on simulation. Am I missing anything here? $\endgroup$
    – Tan
    Oct 21, 2020 at 16:30
  • 3
    $\begingroup$ The simulation is just to show how sample medians may emulate population medians. You need not take it as part of the formal answer to your question. $\endgroup$
    – BruceET
    Oct 21, 2020 at 16:32
5
$\begingroup$

$X \sim Bern(0.2)$

By the definition of median

$P(X \leq m) \geq 1/2$ and $P(X \geq m) \geq 1/2$

It has

$m = \begin{cases} 0, \quad p < 1/2\\ [0,1], \quad p = 1/2\\ 1, \quad p > 1/2 \end{cases}$

It then follows that $m = 0$.

$\endgroup$
1
  • 1
    $\begingroup$ Good. (+1). If $p=1/2,$ the median is ambiguous in $[0,1].$ R chooses $0:$ qbinom(.5,1,.5) returns $0.$. That's because the CDF has $F(0) = 1/2.$ That is: pbinom(0, 1, .5) returns $0.5.$ $\endgroup$
    – BruceET
    Oct 21, 2020 at 19:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.