Piotr Bialas  Introductory Statistics with R

  • Welcome
  • Histogram 1
    • Histogram 2
    • How to Create a Histogram in R?
    • Histogram 3
  • Chapter 0
    • Chapter 1
    • Chapter 2.1
    • Chapter 2.2
    • Chapter 2.3
    • Chapter 2.4
  • Assignments
    • Extra Credit 1
  • Binomial Distr.
  • StandardND
  • Welcome
  • Histogram 1
    • Histogram 2
    • How to Create a Histogram in R?
    • Histogram 3
  • Chapter 0
    • Chapter 1
    • Chapter 2.1
    • Chapter 2.2
    • Chapter 2.3
    • Chapter 2.4
  • Assignments
    • Extra Credit 1
  • Binomial Distr.
  • StandardND

Selected Discrete Probability Distributions

The Binomial Probability Distribution

\[f(x) = \binom{n}{x}p^{x}(1-p)^{n-x}\] n-number of independent trials, n = 0,1,2,…
x-number of successes in n trials, x = 0,1,2,…n
p-probability of success in single trial

In general, R-code for the binomial:

dbinom(x.successes, n.trials, p.probability)

Example 1

A fair coin was tossed three times and number of HEADS was observed. Determine the probability of “getting” two HEADS in three tosses.
n=3, x=2, p=0.5
\[f(2) = \binom{3}{2}0.5^{2}(1-0.5)^{3-2}\]

Here is corresponding R-code:

dbinom(2,3,0.5)
## [1] 0.375

Example 2

A fair coin was tossed three times and number of HEADS was observed. Determine the probability of “getting” two or fewer HEADS in three tosses.
n=3, x=0:2, p=0.5

\[f(0) + f(1) + f(2)\]

sum(dbinom(0:2,3,0.5))
## [1] 0.875

Here is simpler code for cumulative probability:

pbinom(x.orfewersuccesses, n.trials, p.probability)

pbinom(2,3,0.5)
## [1] 0.875
Powered by Create your own unique website with customizable templates.