the normal distrib u tion
play

The normal distrib u tion FOU N DATION S OF P R OBABIL ITY IN R Da - PowerPoint PPT Presentation

The normal distrib u tion FOU N DATION S OF P R OBABIL ITY IN R Da v id Robinson Chief Data Scientist , DataCamp Flipping 10 coins flips <- rbinom(100000, 10, .5) FOUNDATIONS OF PROBABILITY IN R Flipping 1000 coins flips <- rbinom(100000,


  1. The normal distrib u tion FOU N DATION S OF P R OBABIL ITY IN R Da v id Robinson Chief Data Scientist , DataCamp

  2. Flipping 10 coins flips <- rbinom(100000, 10, .5) FOUNDATIONS OF PROBABILITY IN R

  3. Flipping 1000 coins flips <- rbinom(100000, 1000, .5) FOUNDATIONS OF PROBABILITY IN R

  4. Flipping 1000 coins FOUNDATIONS OF PROBABILITY IN R

  5. Normal distrib u tion has mean and standard de v iation X ∼ Normal( μ , σ ) σ = √ Var( X ) FOUNDATIONS OF PROBABILITY IN R

  6. Normal appro x imation to the binomial binomial <- rbinom(100000, 1000, .5) μ = size ⋅ p √ σ = size ⋅ p ⋅ (1 − p ) expected_value <- 1000 * .5 variance <- 1000 * .5 * (1 - .5) stdev <- sqrt(variance) normal <- rnorm(100000, expected_value, stdev) FOUNDATIONS OF PROBABILITY IN R

  7. Comparing histograms compare_histograms(binomial, normal) FOUNDATIONS OF PROBABILITY IN R

  8. Let ' s practice ! FOU N DATION S OF P R OBABIL ITY IN R

  9. The Poisson distrib u tion FOU N DATION S OF P R OBABIL ITY IN R Da v id Robinson Chief Data Scientist , DataCamp

  10. Flipping man y coins , each w ith lo w probabilit y binomial <- rbinom(100000, 1000, 1 / 1000) FOUNDATIONS OF PROBABILITY IN R

  11. Properties of the Poisson distrib u tion binomial <- rbinom(100000, 1000, 1 / 1000) poisson <- rpois(100000, 1) compare_histograms(binomial, poisson) X ∼ Poisson( λ ) E [ X ] = λ Var( X ) = λ FOUNDATIONS OF PROBABILITY IN R

  12. Poisson distrib u tion FOUNDATIONS OF PROBABILITY IN R

  13. Let ' s practice ! FOU N DATION S OF P R OBABIL ITY IN R

  14. The geometric distrib u tion FOU N DATION S OF P R OBABIL ITY IN R Da v id Robinson Chief Data Scientist , DataCamp

  15. Sim u lating w aiting for heads flips <- rbinom(100, 1, .1) flips # [1] 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 # [16] 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 which(flips == 1) # [1] 8 27 44 55 82 89 which(flips == 1)[1] # [1] 8 FOUNDATIONS OF PROBABILITY IN R

  16. Replicating sim u lations which(rbinom(100, 1, .1) == 1)[1] # [1] 28 which(rbinom(100, 1, .1) == 1)[1] # [1] 4 which(rbinom(100, 1, .1) == 1)[1] # [1] 11 replicate(10, which(rbinom(100, 1, .1) == 1)[1]) # [1] 22 12 6 7 35 2 4 44 4 2 FOUNDATIONS OF PROBABILITY IN R

  17. Sim u lating w ith rgeom geom <- rgeom(100000, .1) mean(geom) # [1] 9.04376 X ∼ Geom( p ) 1 E [ X ] = − 1 p FOUNDATIONS OF PROBABILITY IN R

  18. Let ' s practice ! FOU N DATION S OF P R OBABIL ITY IN R

Recommend


More recommend