Median of Bernoulli Distribution

2.5k Views Asked by At

How would you find the median of a Bernoulli distribution with parameter $n=5$ and $p=0.3?$

I thought that the median for a Bernoulli distribution was $0$ if $q>p;$ $.5$ if $q=p;$ and $1$ if $q< p.$ How do you apply this given specific parameters?

1

There are 1 best solutions below

0
On BEST ANSWER

For a Bernoulli distribution, the main confusion occurs when $p = .5.$ Then $P(X=0) = P(X = 1) = 1/2.$

According to one definition a median would be any number between $0$ and $1$ and many would choose $1/2$ as the median. This definition is often used for data. But for data, there are several definitions of quantiles, including the median, are in common use.

Another definition, often used for discrete distributions, is to choose the smallest value $\eta$ for which $P(X \le \eta) \ge 1/2.$ Then $\eta = 0$ for $\mathsf{Bern}(p=1/2) \equiv \mathsf{Binom}(n=1,p=1/2).$

The latter definition is implemented in R statistical software (where Bernoulli is represented by binomial with $n=1)$ as illustrated below:

p = seq(0,1, by=.1)
eta = qbinom(.5, 1, p)   # <- quantile .5, 50th percentile, median
cbind(p, eta)
       p eta
  ## 0.0   0
  ## 0.1   0
  ## 0.2   0
  ## 0.3   0    # <- median for BERN(.3)
  ## 0.4   0
  ## 0.5   0    # <- median for BERN(.5)
  ## 0.6   1
  ## 0.7   1
  ## 0.8   1
  ## 0.9   1
  ## 1.0   1

I think the most-commonly accepted answer for $\mathsf{Bern}(p=.3)$ would be $\eta = 0$ as shown above.

There is no Bernoulli distribution with $n = 5$ and $p = .3.$ You might have the binomial distribution $\mathsf{Binom}(n=5, p=.3)$ in mind. In that case the median is $\eta = 1.$

qbinom(.5, 5, .3)
## 1

[Note: The mean of this binomial distribution is $np = 5(.3) = 1.5.$ As a general rule, the median of a binomial distribution can be at $np,$ or at the next smaller or larger integer to $np.$ See Wikipedia on 'binomial distribution'.]

The plot of the CDF of $\mathsf{Binom}(5, .3)$ below shows that its median is at $1.$ (Notice that $P(X = 5) = (.3)^5$ so that the 'jump' in the CDF at $x=5$ is almost beyond the resolution o the graph.)

enter image description here