permutation tests
play

Permutation tests Fabian Pedregosa October 3, 2017 Data Science - PowerPoint PPT Presentation

Permutation tests Fabian Pedregosa October 3, 2017 Data Science Learn2Launch, UC Berkeley Announcements Next week is the first presentation! 1. 10 min presentation (by teams) + 5 min questions 2. At least: objective of the project,


  1. Permutation tests Fabian Pedregosa October 3, 2017 Data Science Learn2Launch, UC Berkeley

  2. Announcements • Next week is the first presentation! 1. 10 min presentation (by teams) + 5 min questions 2. At least: objective of the project, dataset, exploratory analysis. • Server, more CPUs, GPUs, etc = ⇒ register at AWSEducate: https://www.awseducate.com/Registration . If this is not enough, come and see me. • Office hours: me 3pm-5pm SDH 421, Bowen Mondays on demand. 1/21

  3. Structure of this lecture • Me: explain the method of permutation tests. • You: solve problem based on this method. • You: volunteer presents his solution, gets +0.5 point bonus (out of 10) on final grade. • Me: Introduction to supervised learning. Logistic regression. 2/21

  4. Permutation tests

  5. Motivation We will answer the burning question Does drinking beer make you more attractive to mosquitos? 3/21

  6. 4/21

  7. Experiment 5/21

  8. Data Beer Water 27 19 20 21 19 13 20 23 17 22 15 22 21 24 31 15 22 20 26 28 20 12 24 24 27 19 25 21 19 18 31 24 28 16 23 20 24 29 21 21 18 27 20 mean beer = 23 . 6 mean water = 19 . 2 mean beer − mean water = 4 . 4 6/21

  9. Statistical problem Is the difference of 4.4 sufficient to claim that drinking beer makes you more attractive to mosquitos? What is the probability of this happening by chance? = ⇒ Statistical problem. Null hypothesis ( H 0 ), both means are equal and the difference is due to chance. Instances of this problem are pervasive in data science: does an upgrade increase user engagement?, is the new algorithm generating more revenue? is the new treatment effective? etc. Two approaches: i ) Statistics 101 and ii ) computational method. 7/21

  10. Statistics 101

  11. Stats 101 • t -test 8/21

  12. Stats 101 • t -test � s 2 X 1 + s 2 X 1 − ¯ ¯ X 2 X 2 • Test statistic: t = s p √ 2 / n , where s p = 2 8/21

  13. Stats 101 • t -test � s 2 X 1 + s 2 X 1 − ¯ ¯ X 2 X 2 • Test statistic: t = s p √ 2 / n , where s p = 2 • Which under the null hypothesis follows a Student t distribution − ν +1 Γ( ν +1 2 ) 1 + t 2 � � 2 f ( t ) = √ νπ Γ( ν 2 ) ν 8/21

  14. Stats 101 • t -test � s 2 X 1 + s 2 X 1 − ¯ ¯ X 2 X 2 • Test statistic: t = s p √ 2 / n , where s p = 2 • Which under the null hypothesis follows a Student t distribution − ν +1 Γ( ν +1 2 ) 1 + t 2 � � 2 f ( t ) = √ νπ Γ( ν 2 ) ν • ν = degrees of freedom 8/21

  15. Stats 101 • t -test � s 2 X 1 + s 2 X 1 − ¯ ¯ X 2 X 2 • Test statistic: t = s p √ 2 / n , where s p = 2 • Which under the null hypothesis follows a Student t distribution − ν +1 Γ( ν +1 2 ) 1 + t 2 � � 2 f ( t ) = √ νπ Γ( ν 2 ) ν • ν = degrees of freedom The degrees of freedom ν is approximated using the Welch–Satterthwaite equation � 2 � s 2 s 2 N 1 + 1 2 N 2 ≈ ν s 4 s 4 1 ν 1 + 1 2 N 2 N 2 2 ν 2 8/21

  16. Stats 101 • t -test � s 2 X 1 + s 2 X 1 − ¯ ¯ X 2 X 2 • Test statistic: t = s p √ 2 / n , where s p = 2 • Which under the null hypothesis follows a Student t distribution − ν +1 Γ( ν +1 2 ) 1 + t 2 � � 2 f ( t ) = √ νπ Γ( ν 2 ) ν • ν = degrees of freedom The degrees of freedom ν is approximated using the Welch–Satterthwaite equation � 2 � s 2 s 2 N 1 + 1 2 N 2 ≈ ν s 4 s 4 1 ν 1 + 1 2 N 2 N 2 2 ν 2 8/21

  17. Stats 101 • t -test � s 2 X 1 + s 2 X 1 − ¯ ¯ X 2 X 2 • Test statistic: t = s p √ 2 / n , where s p = 2 • Which under the null hypothesis follows a Student t distribution − ν +1 Γ( ν +1 2 ) 1 + t 2 � � 2 f ( t ) = √ νπ Γ( ν 2 ) ν Skeptic: I don’t believe this! • ν = degrees of freedom The degrees of freedom ν is approximated using the Welch–Satterthwaite equation � 2 � s 2 s 2 N 1 + 1 2 N 2 ≈ ν s 4 s 4 1 ν 1 + 1 2 N 2 N 2 2 ν 2 8/21

  18. Computational method

  19. Data Beer Water 27 19 20 21 19 13 20 23 17 22 15 22 21 24 31 15 22 20 26 28 20 12 24 24 27 19 25 21 19 18 31 24 28 16 23 20 24 29 21 21 18 27 20 mean beer = 23 . 6 mean water = 19 . 2 mean beer − mean water = 4 . 4 9/21

  20. Data Beer Water 21 19 20 27 19 27 15 23 17 22 20 22 21 24 31 15 22 20 26 28 20 12 24 24 27 19 25 23 19 27 31 24 28 16 21 20 24 29 21 17 18 27 20 mean beer = X mean water = Y mean beer − mean water = − 0 . 9 10/21

  21. Data 1 permutation 1.0 0.8 0.6 0.4 0.2 0.0 2 1 0 1 2 3 4 5 11/21

  22. Data 10 permutation 2.0 1.5 1.0 0.5 0.0 3 2 1 0 1 2 3 4 5 12/21

  23. Data 100 permutation 18 16 14 12 10 8 6 4 2 0 4 3 2 1 0 1 2 3 4 5 13/21

  24. Data 1000 permutation 120 100 80 60 40 20 0 4 2 0 2 4 14/21

  25. Data 10000 permutation 1600 1400 1200 1000 800 600 400 200 0 6 4 2 0 2 4 6 15/21

  26. Data 100000 permutation 18000 16000 14000 12000 10000 8000 6000 4000 2000 0 8 6 4 2 0 2 4 6 16/21

  27. Data We have constructed the empirical distribution of the test statistic mean beer − mean water 17/21

  28. Data We have constructed the empirical distribution of the test statistic mean beer − mean water How likely is it that we arrived to a value of 4 . 4 by chance? 17/21

  29. Data We have constructed the empirical distribution of the test statistic mean beer − mean water How likely is it that we arrived to a value of 4 . 4 by chance? Easy, p = number of times that the statistic ≥ 4.4 total number of permutations This is the exact definition of p -value! 17/21

  30. In this experiment, p -value = 0.0004 and so the null hypothesis can be rejected. 18/21

  31. Now its your turn! Go to the github repository for lecture 2 https://github.com/dsl2l2017/lecture_2 Do the third and last exercise. 19/21

  32. References i Marti Anderson and Cajo Ter Braak. Permutation tests for multi-factorial analysis of variance. Journal of Statistical Computation and Simulation , 2003. Marti J Anderson. Permutation tests for univariate or multivariate analysis of variance and regression. Canadian journal of fisheries and aquatic sciences , 2001. Phillip Good. Permutation, Parametric, and Bootstrap Tests of Hypotheses. Springer Science & Business Media, 2013. 20/21

  33. References ii Thierry Lef` evre, Louis-Cl´ ement Gouagna, Kounbobr Roch Dabir´ e, Eric Elguero, Didier Fontenille, Fran¸ cois Renaud, Carlo Costantini, and Fr´ ed´ eric Thomas. Beer consumption increases human attractiveness to malaria mosquitoes. PloS one , 2010. 21/21

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend