6
$\begingroup$

If I understand correctly, a Bernoulli pmf just needs to assign a probability $p$ if there is a success $(x=1)$, and $1-p$ otherwise $(x = 0)$. Rather than the usual formula, can't the following function also satisfy this condition and represent a the pmf of a Bernoulli RV?

$ f(x) = xp + (1-x)(1-p). $

So if $f(x=1) = p, f(x=0) = 1-p.$

What would be wrong in formulating it this way?

$\endgroup$
8
  • 2
    $\begingroup$ Steve, could you tell why you think it is wrong? $\endgroup$ Sep 22 at 15:36
  • 4
    $\begingroup$ There's nothing wrong with this. In fact, you'll often see the log-likelihood of logistic regression (with binary outcomes) written as the log of what you describe. $\endgroup$ Sep 22 at 15:38
  • 5
    $\begingroup$ In fact you can go with $p^x(1-p) ^{1-x}.$ There is nothing wrong in writing like that. $\endgroup$ Sep 22 at 15:40
  • 2
    $\begingroup$ The formulation in the comment by @User1865345 is far more useful for working with likelihoods. $\endgroup$
    – whuber
    Sep 22 at 17:55
  • 3
    $\begingroup$ It is also important to state along with the formula that $x \in {0,1}$. The formula is a simplification of $$f(x)=\begin{cases} p & \text{if $x=1$} \\ 1-p & \text{if $x=0$} \end{cases}$$ and for that case the support is less ambiguous (actually, it can still be ambiguous, but it is conventional to leave out the 'else f(x) = 0 cases'). $\endgroup$ Sep 23 at 7:37

3 Answers 3

7
$\begingroup$

Your alternative form is often written braced form as $$ f(x)=\begin{cases} p & \text{if $x=1$} \\ 1-p & \text{if $x=0$} \end{cases} $$ and there is nothing wrong with that. It might be useful, for instance, for programming and for elementary exposition.

But if you want to do any form of algebra or calculus, it is inconvenient, so the other form is preferred. But both forms are equally valid, it is only a pragmatic question of what works best for whatever you are doing with it.

$\endgroup$
1
  • 6
    $\begingroup$ And $f(x)=0$ otherwise. $\endgroup$
    – bluemaster
    Sep 22 at 17:35
9
$\begingroup$

There's nothing wrong with it as it evaluates the values, it should evaluate. The usual formulation however uses powers so it becomes a case of binomial distribution with $n=1$ sample size. Recall that the probability mass function of binomial distribution is

$$ {n \choose x} \,p^x (1-p)^{n-x} $$

Where we have $n$ independent Bernoulli distributed with $x$ successes observed, hence $p^x$, and $n-x$ failures. The ${n \choose x}$ corrects for the fact that we want to account for the successes and failures appearing in any possible combination. With $n=1$ and $x \in \{0,1\}$ it reduces to Bernoulli distribution formulated with the powers

$$ \,p^x (1-p)^{1-x} $$

$\endgroup$
2
$\begingroup$

This is fine, assuming that the domain of $f$ is $\{0,1\}$. This is also true of the formulations in the other answers. A different formulation involving the Iverson bracket is \begin{align*} f(x) = (1-p)[x=0]+p[x=1].\tag{1} \end{align*} One defines \begin{align*} [P] &= \begin{cases} 1, & \textrm{if $P$ is true}, \\ 0, & \textrm{else.} \end{cases} \end{align*} The Iverson bracket has many interesting algebraic properties that capture the logic of the statement $P$. One interesting difference with formulation (1) is that the domain of $f$ can be thought of as all of $\mathbb{Z}$ (or indeed all of $\mathbb{R}$). This allows one to be loose with notation in a way that is totally rigorous. For example, the expected value of $g(x)$ is $$\sum_x g(x)f(x),$$ where the sum is typically understood to be over all of $\mathbb{Z}$, with the result $$g(0)(1-p) + g(1)p.$$

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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