welcome to the course
play

Welcome to the course! Statistical Thinking in Python II You will - PowerPoint PPT Presentation

STATISTICAL THINKING IN PYTHON II Welcome to the course! Statistical Thinking in Python II You will be able to Estimate parameters ! a t a Compute confidence intervals d l a Perform linear regressions e r h t


  1. STATISTICAL THINKING IN PYTHON II Welcome to the course!

  2. Statistical Thinking in Python II You will be able to… ● Estimate parameters ! a t a ● Compute confidence intervals d l a ● Perform linear regressions e r h t ● i Test hypotheses w

  3. Statistical Thinking in Python II

  4. Statistical Thinking in Python II We use hacker statistics ● Literally simulate probability ● Broadly applicable with a few principles

  5. Statistical Thinking in Python II Statistical analysis of the beak of the finch Geospiza fortis Geospiza scandens Source: John Gould, public domain

  6. STATISTICAL THINKING IN PYTHON II Let's start thinking statistically!

  7. STATISTICAL THINKING IN PYTHON II Optimal parameters

  8. Statistical Thinking in Python II Histogram of Michelson's measurements Data: Michelson, 1880

  9. Statistical Thinking in Python II CDF of Michelson's measurements Data: Michelson, 1880

  10. Statistical Thinking in Python II Checking Normality of Michelson data In [1]: import numpy as np In [2]: import matplotlib.pyplot as plt In [3]: mean = np.mean(michelson_speed_of_light) In [4]: std = np.std(michelson_speed_of_light) In [5]: samples = np.random.normal(mean, std, size=10000)

  11. Statistical Thinking in Python II CDF of Michelson's measurements Data: Michelson, 1880

  12. Statistical Thinking in Python II CDF with bad estimate of st. dev. Data: Michelson, 1880

  13. Statistical Thinking in Python II CDF with bad estimate of mean Data: Michelson, 1880

  14. Statistical Thinking in Python II Optimal parameters ● Parameter values that bring the model in closest agreement with the data

  15. Statistical Thinking in Python II Mass of MA large mouth bass CDF for "optimal" parameters of a bad model Source: Mass. Dept. of Environmental Protection

  16. Statistical Thinking in Python II Packages to do statistical inference scipy.stats statsmodels hacker stats with numpy Knife image: D-M Commons, CC BY-SA 3.0

  17. STATISTICAL THINKING IN PYTHON II Let’s practice!

  18. STATISTICAL THINKING IN PYTHON II Linear regression by least squares

  19. Statistical Thinking in Python II 2008 US swing state election results Data retrieved from Data.gov (h � ps://www.data.gov/)

  20. Statistical Thinking in Python II 2008 US swing state election results slope intercept Data retrieved from Data.gov (h � ps://www.data.gov/)

  21. Statistical Thinking in Python II 2008 US swing state election results Data retrieved from Data.gov (h � ps://www.data.gov/)

  22. Statistical Thinking in Python II Residuals residual Data retrieved from Data.gov (h � ps://www.data.gov/)

  23. Statistical Thinking in Python II Least squares ● The process of finding the parameters for which the sum of the squares of the residuals is minimal

  24. Statistical Thinking in Python II Least squares with np.polyfit() In [1]: slope, intercept = np.polyfit(total_votes, ...: dem_share, 1) In [2]: slope Out[2]: 4.0370717009465555e-05 In [3]: intercept Out[3]: 40.113911968641744

  25. STATISTICAL THINKING IN PYTHON II Let’s practice!

  26. STATISTICAL THINKING IN PYTHON II The importance of EDA: Anscombe's quartet

  27. Statistical Thinking in Python II Anscombe's quartet Data: Anscombe, The American Statistician , 1973

  28. Statistical Thinking in Python II Anscombe's quartet Data: Anscombe, The American Statistician , 1973

  29. Statistical Thinking in Python II Anscombe's quartet Data: Anscombe, The American Statistician , 1973

  30. Statistical Thinking in Python II Anscombe's quartet Data: Anscombe, The American Statistician , 1973

  31. Statistical Thinking in Python II Anscombe's quartet Data: Anscombe, The American Statistician , 1973

  32. Statistical Thinking in Python II Look before you leap! ● Do graphical EDA first

  33. Statistical Thinking in Python II Anscombe's quartet Data: Anscombe, The American Statistician , 1973

  34. Statistical Thinking in Python II Anscombe's quartet Data: Anscombe, The American Statistician , 1973

  35. Statistical Thinking in Python II Anscombe's quartet Data: Anscombe, The American Statistician , 1973

  36. Statistical Thinking in Python II Anscombe's quartet Data: Anscombe, The American Statistician , 1973

  37. STATISTICAL THINKING IN PYTHON II Let’s practice!

Recommend


More recommend