LoslegenKostenlos loslegen

Comparing the cumulative density of the binomial

If you flip 1000 coins that each have a 20% chance of being heads, what is the probability you would get 190 heads or fewer?

You'll get similar answers if you solve this with the binomial or its normal approximation. In this exercise, you'll solve it both ways, using both simulation and exact calculation.

Diese Übung ist Teil des Kurses

Foundations of Probability in R

Kurs anzeigen

Anleitung zur Übung

  • Use the simulated binom_sample (provided) from the last exercise to estimate the probability of getting 190 or fewer heads.
  • Use the simulated normal_sample to estimate the probability of getting 190 or fewer heads.
  • Calculate the exact probability of the binomial being <= 190 with pbinom().
  • Calculate the exact probability of the normal being <= 190 with pnorm().

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Simulations from the normal and binomial distributions
binom_sample <- rbinom(100000, 1000, .2)
normal_sample <- rnorm(100000, 200, sqrt(160))

# Use binom_sample to estimate the probability of <= 190 heads


# Use normal_sample to estimate the probability of <= 190 heads


# Calculate the probability of <= 190 heads with pbinom


# Calculate the probability of <= 190 heads with pnorm

Code bearbeiten und ausführen