test statistics and randomization distributions
play

Test statistics and randomization distributions Applied Statistics - PowerPoint PPT Presentation

Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Test statistics and randomization distributions Applied Statistics and Experimental Design Chapter 2 Peter Hoff


  1. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Summaries of sample location P n • sample mean or average : ¯ y = 1 i =1 y i n • sample median : A/the value y . 5 such that #( y i ≤ y . 5 ) #( y i ≥ y . 5 ) ≥ 1 / 2 ≥ 1 / 2 n n To find the median, sort the data in increasing order, and call these values y (1) , . . . , y ( n ) . If there are no ties, then if n is odd, then y ( n +1 2 ) is the median; y (1) , y (2) , y (3) , y (4) , y (5) , y (6) , y (7) if n is even, then all numbers between y ( n 2 ) and y ( n 2 +1) are medians. y (1) , y (2) , y (3) , y (4) , y (5) , y (6) , y (7) , y (8)

  2. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Summaries of sample location P n • sample mean or average : ¯ y = 1 i =1 y i n • sample median : A/the value y . 5 such that #( y i ≤ y . 5 ) #( y i ≥ y . 5 ) ≥ 1 / 2 ≥ 1 / 2 n n To find the median, sort the data in increasing order, and call these values y (1) , . . . , y ( n ) . If there are no ties, then if n is odd, then y ( n +1 2 ) is the median; y (1) , y (2) , y (3) , y (4) , y (5) , y (6) , y (7) if n is even, then all numbers between y ( n 2 ) and y ( n 2 +1) are medians. y (1) , y (2) , y (3) , y (4) , y (5) , y (6) , y (7) , y (8)

  3. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Summaries of sample location P n • sample mean or average : ¯ y = 1 i =1 y i n • sample median : A/the value y . 5 such that #( y i ≤ y . 5 ) #( y i ≥ y . 5 ) ≥ 1 / 2 ≥ 1 / 2 n n To find the median, sort the data in increasing order, and call these values y (1) , . . . , y ( n ) . If there are no ties, then if n is odd, then y ( n +1 2 ) is the median; y (1) , y (2) , y (3) , y (4) , y (5) , y (6) , y (7) if n is even, then all numbers between y ( n 2 ) and y ( n 2 +1) are medians. y (1) , y (2) , y (3) , y (4) , y (5) , y (6) , y (7) , y (8)

  4. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Summaries of sample location P n • sample mean or average : ¯ y = 1 i =1 y i n • sample median : A/the value y . 5 such that #( y i ≤ y . 5 ) #( y i ≥ y . 5 ) ≥ 1 / 2 ≥ 1 / 2 n n To find the median, sort the data in increasing order, and call these values y (1) , . . . , y ( n ) . If there are no ties, then if n is odd, then y ( n +1 2 ) is the median; y (1) , y (2) , y (3) , y (4) , y (5) , y (6) , y (7) if n is even, then all numbers between y ( n 2 ) and y ( n 2 +1) are medians. y (1) , y (2) , y (3) , y (4) , y (5) , y (6) , y (7) , y (8)

  5. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Summaries of sample location P n • sample mean or average : ¯ y = 1 i =1 y i n • sample median : A/the value y . 5 such that #( y i ≤ y . 5 ) #( y i ≥ y . 5 ) ≥ 1 / 2 ≥ 1 / 2 n n To find the median, sort the data in increasing order, and call these values y (1) , . . . , y ( n ) . If there are no ties, then if n is odd, then y ( n +1 2 ) is the median; y (1) , y (2) , y (3) , y (4) , y (5) , y (6) , y (7) if n is even, then all numbers between y ( n 2 ) and y ( n 2 +1) are medians. y (1) , y (2) , y (3) , y (4) , y (5) , y (6) , y (7) , y (8)

  6. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Summaries of sample scale • sample variance and standard deviation: n √ 1 s 2 = X y ) 2 , ( y i − ¯ s = s 2 n − 1 i =1 • interquantile range: [ y . 25 , y . 75 ] (interquartile range) [ y . 025 , y . 975 ] (95% interval)

  7. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Summaries of sample scale • sample variance and standard deviation: n √ 1 s 2 = X y ) 2 , ( y i − ¯ s = s 2 n − 1 i =1 • interquantile range: [ y . 25 , y . 75 ] (interquartile range) [ y . 025 , y . 975 ] (95% interval)

  8. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Example: Wheat yield 1.0 0.06 0.04 0.8 0.04 0.6 Density Density F(y) 0.02 0.4 0.02 0.2 0.00 0.00 0.0 15 20 25 10 15 20 25 30 0 10 20 30 40 y y y 1.0 0.08 0.12 Density 0.8 0.00 0.08 0.6 Density 10 15 20 25 F(y) yA 0.4 0.04 0.10 Density 0.2 0.00 0.0 0.00 15 20 25 10 15 20 25 30 10 15 20 25 30 35 y yB

  9. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Summaries in R All of these sample summaries are easily obtained in R: > yA < − c ( 1 1 . 4 , 23.7 , 17.9 , 16.5 , 21.1 , 19.6) > yB < − c ( 2 6 . 9 , 26.6 , 25.3 , 28.5 , 14.2 , 24.3) > mean(yA) [ 1 ] 18.36667 > mean(yB) [ 1 ] 24.3 > median (yA) [ 1 ] 18.75 > median (yB) [ 1 ] 25.95 > sd (yA) [ 1 ] 4.234934 > sd (yB) [ 1 ] 5.151699 > q u a n t i l e (yA , prob=c ( . 2 5 , . 7 5 ) ) 25% 75% 16.850 20.725 > q u a n t i l e (yB , prob=c ( . 2 5 , . 7 5 ) ) 25% 75% 24.550 26.825

  10. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Induction and generalization So there is a difference in yield for these wheat fields. Would you recommend B over A for future plantings? Do you think these results generalize to a larger population ?

  11. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Induction and generalization So there is a difference in yield for these wheat fields. Would you recommend B over A for future plantings? Do you think these results generalize to a larger population ?

  12. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Induction and generalization So there is a difference in yield for these wheat fields. Would you recommend B over A for future plantings? Do you think these results generalize to a larger population ?

  13. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Hypotheses: competing explanations Questions: • Could the observed differences be due to fertilizer type? • Could the observed differences be due to plot-to-plot variation? Hypothesis tests: • H 0 (null hypothesis): Fertilizer type does not affect yield. • H 1 (alternative hypothesis): Fertilizer type does affect yield. A statistical hypothesis test evaluates the compatibility of H 0 with the data.

  14. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Hypotheses: competing explanations Questions: • Could the observed differences be due to fertilizer type? • Could the observed differences be due to plot-to-plot variation? Hypothesis tests: • H 0 (null hypothesis): Fertilizer type does not affect yield. • H 1 (alternative hypothesis): Fertilizer type does affect yield. A statistical hypothesis test evaluates the compatibility of H 0 with the data.

  15. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Test statistics and null distributions Suppose we are interested in mean wheat yields. We can evaluate H 0 by answering the following questions: • Is a mean difference of 5.93 plausible/probable if H 0 is true? • Is a mean difference of 5.93 large compared to experimental noise? To answer the above, we need to compare {| ¯ y B − ¯ y A | = 5 . 93 } , the observed difference in the experiment to values of | ¯ y B − ¯ y A | that could have been observed if H 0 were true . Hypothetical values of | ¯ y B − ¯ y A | that could have been observed under H 0 are referred to as samples from the null distribution .

  16. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Test statistics and null distributions Suppose we are interested in mean wheat yields. We can evaluate H 0 by answering the following questions: • Is a mean difference of 5.93 plausible/probable if H 0 is true? • Is a mean difference of 5.93 large compared to experimental noise? To answer the above, we need to compare {| ¯ y B − ¯ y A | = 5 . 93 } , the observed difference in the experiment to values of | ¯ y B − ¯ y A | that could have been observed if H 0 were true . Hypothetical values of | ¯ y B − ¯ y A | that could have been observed under H 0 are referred to as samples from the null distribution .

  17. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Test statistics and null distributions Suppose we are interested in mean wheat yields. We can evaluate H 0 by answering the following questions: • Is a mean difference of 5.93 plausible/probable if H 0 is true? • Is a mean difference of 5.93 large compared to experimental noise? To answer the above, we need to compare {| ¯ y B − ¯ y A | = 5 . 93 } , the observed difference in the experiment to values of | ¯ y B − ¯ y A | that could have been observed if H 0 were true . Hypothetical values of | ¯ y B − ¯ y A | that could have been observed under H 0 are referred to as samples from the null distribution .

  18. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Test statistics and null distributions Suppose we are interested in mean wheat yields. We can evaluate H 0 by answering the following questions: • Is a mean difference of 5.93 plausible/probable if H 0 is true? • Is a mean difference of 5.93 large compared to experimental noise? To answer the above, we need to compare {| ¯ y B − ¯ y A | = 5 . 93 } , the observed difference in the experiment to values of | ¯ y B − ¯ y A | that could have been observed if H 0 were true . Hypothetical values of | ¯ y B − ¯ y A | that could have been observed under H 0 are referred to as samples from the null distribution .

  19. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Test statistics and null distributions g ( Y A , Y B ) = g ( { Y 1 , A , . . . , Y 6 , A } , { Y 1 , B , . . . , Y 6 , B } ) = | ¯ Y B − ¯ Y A | . This is a function of the outcome of the experiment. It is a statistic . Since we will use it to perform a hypothesis test, we will call it a test statistic . Observed test statistic: g (11 . 4 , 23 . 7 , . . . , 14 . 2 , 24 . 3) = 5 . 93 = g obs Hypothesis testing procedure: Compare g obs to g ( Y A , Y B ), where Y A and Y B are values that could have been observed, if H 0 were true.

  20. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Test statistics and null distributions g ( Y A , Y B ) = g ( { Y 1 , A , . . . , Y 6 , A } , { Y 1 , B , . . . , Y 6 , B } ) = | ¯ Y B − ¯ Y A | . This is a function of the outcome of the experiment. It is a statistic . Since we will use it to perform a hypothesis test, we will call it a test statistic . Observed test statistic: g (11 . 4 , 23 . 7 , . . . , 14 . 2 , 24 . 3) = 5 . 93 = g obs Hypothesis testing procedure: Compare g obs to g ( Y A , Y B ), where Y A and Y B are values that could have been observed, if H 0 were true.

  21. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Test statistics and null distributions g ( Y A , Y B ) = g ( { Y 1 , A , . . . , Y 6 , A } , { Y 1 , B , . . . , Y 6 , B } ) = | ¯ Y B − ¯ Y A | . This is a function of the outcome of the experiment. It is a statistic . Since we will use it to perform a hypothesis test, we will call it a test statistic . Observed test statistic: g (11 . 4 , 23 . 7 , . . . , 14 . 2 , 24 . 3) = 5 . 93 = g obs Hypothesis testing procedure: Compare g obs to g ( Y A , Y B ), where Y A and Y B are values that could have been observed, if H 0 were true.

  22. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Experimental procedure and observed outcome Recall the design of the experiment: 1. Shuffled cards were dealt B , R , B , R , . . . , fertilizers assigned to subplots: B A B A B B B A A A B A 2. Crops were grown and wheat yields obtained: B A B A B B 26.9 11.4 26.6 23.7 25.3 28.5 B A A A B A 14.2 17.9 16.5 21.1 24.3 19.6

  23. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Experimental procedure and observed outcome Recall the design of the experiment: 1. Shuffled cards were dealt B , R , B , R , . . . , fertilizers assigned to subplots: B A B A B B B A A A B A 2. Crops were grown and wheat yields obtained: B A B A B B 26.9 11.4 26.6 23.7 25.3 28.5 B A A A B A 14.2 17.9 16.5 21.1 24.3 19.6

  24. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Experimental procedure and observed outcome Recall the design of the experiment: 1. Shuffled cards were dealt B , R , B , R , . . . , fertilizers assigned to subplots: B A B A B B B A A A B A 2. Crops were grown and wheat yields obtained: B A B A B B 26.9 11.4 26.6 23.7 25.3 28.5 B A A A B A 14.2 17.9 16.5 21.1 24.3 19.6

  25. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Experimental procedure and observed outcome Recall the design of the experiment: 1. Shuffled cards were dealt B , R , B , R , . . . , fertilizers assigned to subplots: B A B A B B B A A A B A 2. Crops were grown and wheat yields obtained: B A B A B B 26.9 11.4 26.6 23.7 25.3 28.5 B A A A B A 14.2 17.9 16.5 21.1 24.3 19.6

  26. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Experimental procedure and potential outcome Imagine re-doing the experiment if “ H 0 : no treatment effect” were true: 1. Shuffled cards were dealt B , R , B , B , . . . , fertilizers assigned to subplots: B A B B A A A B B A A B 2. Crops are grown and wheat yields obtained: B A B B A A 26.9 11.4 26.6 23.7 25.3 28.5 A B B A A B 14.2 17.9 16.5 21.1 24.3 19.6 Under this hypothetical treatment assignment, ( Y A , Y B ) = { 11 . 4 , 25 . 3 , . . . , 21 . 1 , 19 . 6 } | ¯ Y B − ¯ Y A | = 1 . 07 This represents an outcome of the experiment in a universe where • The treatment assignment is B , A , B , B , A , A , A , B , B , A , A , B ; • H 0 is true.

  27. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Experimental procedure and potential outcome Imagine re-doing the experiment if “ H 0 : no treatment effect” were true: 1. Shuffled cards were dealt B , R , B , B , . . . , fertilizers assigned to subplots: B A B B A A A B B A A B 2. Crops are grown and wheat yields obtained: B A B B A A 26.9 11.4 26.6 23.7 25.3 28.5 A B B A A B 14.2 17.9 16.5 21.1 24.3 19.6 Under this hypothetical treatment assignment, ( Y A , Y B ) = { 11 . 4 , 25 . 3 , . . . , 21 . 1 , 19 . 6 } | ¯ Y B − ¯ Y A | = 1 . 07 This represents an outcome of the experiment in a universe where • The treatment assignment is B , A , B , B , A , A , A , B , B , A , A , B ; • H 0 is true.

  28. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Experimental procedure and potential outcome Imagine re-doing the experiment if “ H 0 : no treatment effect” were true: 1. Shuffled cards were dealt B , R , B , B , . . . , fertilizers assigned to subplots: B A B B A A A B B A A B 2. Crops are grown and wheat yields obtained: B A B B A A 26.9 11.4 26.6 23.7 25.3 28.5 A B B A A B 14.2 17.9 16.5 21.1 24.3 19.6 Under this hypothetical treatment assignment, ( Y A , Y B ) = { 11 . 4 , 25 . 3 , . . . , 21 . 1 , 19 . 6 } | ¯ Y B − ¯ Y A | = 1 . 07 This represents an outcome of the experiment in a universe where • The treatment assignment is B , A , B , B , A , A , A , B , B , A , A , B ; • H 0 is true.

  29. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Experimental procedure and potential outcome Imagine re-doing the experiment if “ H 0 : no treatment effect” were true: 1. Shuffled cards were dealt B , R , B , B , . . . , fertilizers assigned to subplots: B A B B A A A B B A A B 2. Crops are grown and wheat yields obtained: B A B B A A 26.9 11.4 26.6 23.7 25.3 28.5 A B B A A B 14.2 17.9 16.5 21.1 24.3 19.6 Under this hypothetical treatment assignment, ( Y A , Y B ) = { 11 . 4 , 25 . 3 , . . . , 21 . 1 , 19 . 6 } | ¯ Y B − ¯ Y A | = 1 . 07 This represents an outcome of the experiment in a universe where • The treatment assignment is B , A , B , B , A , A , A , B , B , A , A , B ; • H 0 is true.

  30. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Experimental procedure and potential outcome Imagine re-doing the experiment if “ H 0 : no treatment effect” were true: 1. Shuffled cards were dealt B , R , B , B , . . . , fertilizers assigned to subplots: B A B B A A A B B A A B 2. Crops are grown and wheat yields obtained: B A B B A A 26.9 11.4 26.6 23.7 25.3 28.5 A B B A A B 14.2 17.9 16.5 21.1 24.3 19.6 Under this hypothetical treatment assignment, ( Y A , Y B ) = { 11 . 4 , 25 . 3 , . . . , 21 . 1 , 19 . 6 } | ¯ Y B − ¯ Y A | = 1 . 07 This represents an outcome of the experiment in a universe where • The treatment assignment is B , A , B , B , A , A , A , B , B , A , A , B ; • H 0 is true.

  31. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory The null distribution IDEA: To consider what types of outcomes we would see in universes where H 0 is true, compute g ( Y A , Y B ) for each possible treatment assignment, assuming H 0 true. Under our randomization scheme, there were ! 12! 12 6!6! = = 924 6 equally likely ways the treatments could have been assigned. For each one of these, we can calculate the value of the test statistic that would’ve been observed under H 0 : { g 1 , g 2 , . . . , g 924 }

  32. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory The null distribution IDEA: To consider what types of outcomes we would see in universes where H 0 is true, compute g ( Y A , Y B ) for each possible treatment assignment, assuming H 0 true. Under our randomization scheme, there were ! 12! 12 6!6! = = 924 6 equally likely ways the treatments could have been assigned. For each one of these, we can calculate the value of the test statistic that would’ve been observed under H 0 : { g 1 , g 2 , . . . , g 924 }

  33. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory The null distribution IDEA: To consider what types of outcomes we would see in universes where H 0 is true, compute g ( Y A , Y B ) for each possible treatment assignment, assuming H 0 true. Under our randomization scheme, there were ! 12! 12 6!6! = = 924 6 equally likely ways the treatments could have been assigned. For each one of these, we can calculate the value of the test statistic that would’ve been observed under H 0 : { g 1 , g 2 , . . . , g 924 }

  34. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory The null distribution { g 1 , g 2 , . . . , g 924 } This enumerates all potential pre-randomization outcomes of our test statistic, assuming no treatment effect . Since each treatment assignment was equally likely, these values give a null distribution : a probability distribution of possible experimental results, if H 0 were true. F ( x | H 0 ) = Pr( g ( Y A , Y B ) ≤ x | H 0 ) = # { g k ≤ x } 924 This distribution is sometimes called the randomization distribution , because it is obtained by the randomization scheme of the experiment.

  35. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory The null distribution { g 1 , g 2 , . . . , g 924 } This enumerates all potential pre-randomization outcomes of our test statistic, assuming no treatment effect . Since each treatment assignment was equally likely, these values give a null distribution : a probability distribution of possible experimental results, if H 0 were true. F ( x | H 0 ) = Pr( g ( Y A , Y B ) ≤ x | H 0 ) = # { g k ≤ x } 924 This distribution is sometimes called the randomization distribution , because it is obtained by the randomization scheme of the experiment.

  36. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory The null distribution { g 1 , g 2 , . . . , g 924 } This enumerates all potential pre-randomization outcomes of our test statistic, assuming no treatment effect . Since each treatment assignment was equally likely, these values give a null distribution : a probability distribution of possible experimental results, if H 0 were true. F ( x | H 0 ) = Pr( g ( Y A , Y B ) ≤ x | H 0 ) = # { g k ≤ x } 924 This distribution is sometimes called the randomization distribution , because it is obtained by the randomization scheme of the experiment.

  37. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Null distribution, wheat example 0.12 0.20 0.08 Density Density 0.10 0.04 0.00 0.00 −10 −5 0 5 10 0 2 4 6 8 Y B − Y A |Y B − Y A | Figure: Approximate randomization distribution for the wheat example

  38. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Comparing data to the null distribution: Is there any contradiction between H 0 and our data? Pr( g ( Y A , Y B ) ≥ 5 . 93 | H 0 ) = 0 . 056 The probability of observing a difference of 5.93 or more is unlikely under H 0 . This probability calculation is called a p-value . Generically, a p -value is “The probability, under the null hypothesis, of obtaining a result as or more extreme than the observed result.” The basic idea: small p -value → evidence against H 0 large p -value → no evidence against H 0

  39. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Comparing data to the null distribution: Is there any contradiction between H 0 and our data? Pr( g ( Y A , Y B ) ≥ 5 . 93 | H 0 ) = 0 . 056 The probability of observing a difference of 5.93 or more is unlikely under H 0 . This probability calculation is called a p-value . Generically, a p -value is “The probability, under the null hypothesis, of obtaining a result as or more extreme than the observed result.” The basic idea: small p -value → evidence against H 0 large p -value → no evidence against H 0

  40. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Comparing data to the null distribution: Is there any contradiction between H 0 and our data? Pr( g ( Y A , Y B ) ≥ 5 . 93 | H 0 ) = 0 . 056 The probability of observing a difference of 5.93 or more is unlikely under H 0 . This probability calculation is called a p-value . Generically, a p -value is “The probability, under the null hypothesis, of obtaining a result as or more extreme than the observed result.” The basic idea: small p -value → evidence against H 0 large p -value → no evidence against H 0

  41. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Comparing data to the null distribution: Is there any contradiction between H 0 and our data? Pr( g ( Y A , Y B ) ≥ 5 . 93 | H 0 ) = 0 . 056 The probability of observing a difference of 5.93 or more is unlikely under H 0 . This probability calculation is called a p-value . Generically, a p -value is “The probability, under the null hypothesis, of obtaining a result as or more extreme than the observed result.” The basic idea: small p -value → evidence against H 0 large p -value → no evidence against H 0

  42. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Approximating a randomization distribution: ` n A + n B ´ We don’t want to have to enumerate all possible treatment n A assignments. Instead, repeat the following S times for some large number S : (a) randomly simulate a treatment assignment from the population of possible treatment assignments, under the randomization scheme. (b) compute the value of the test statistic, given the simulated treatment assignment and under H 0 . The empirical distribution of { g 1 , . . . , g S } approximates the null distribution: #( g s ≥ g obs ) ≈ Pr( g ( Y A , Y B ) ≥ g obs | H 0 ) S The approximation improves if S is increased. Here is some R-code: y < − c ( 2 6 . 9 , 1 1 . 4 , 2 6 . 6 , 2 3 . 7 , 2 5 . 3 , 2 8 . 5 , 1 4 . 2 , 1 7 . 9 , 1 6 . 5 , 2 1 . 1 , 2 4 . 3 , 1 9 . 6 ) x < − c (”B” , ”A” , ”B” , ”A” , ”B” , ”B” , ”B” , ”A” , ”A” , ”A” , ”B” , ”A”) g . n u l l < − r e a l ( ) f o r ( s i n 1:10000) { xsim < − sample ( x ) g . n u l l [ s] < − abs ( mean( y [ xsim==”B” ] ) − mean( y [ xsim==”A”] ) ) }

  43. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Approximating a randomization distribution: ` n A + n B ´ We don’t want to have to enumerate all possible treatment n A assignments. Instead, repeat the following S times for some large number S : (a) randomly simulate a treatment assignment from the population of possible treatment assignments, under the randomization scheme. (b) compute the value of the test statistic, given the simulated treatment assignment and under H 0 . The empirical distribution of { g 1 , . . . , g S } approximates the null distribution: #( g s ≥ g obs ) ≈ Pr( g ( Y A , Y B ) ≥ g obs | H 0 ) S The approximation improves if S is increased. Here is some R-code: y < − c ( 2 6 . 9 , 1 1 . 4 , 2 6 . 6 , 2 3 . 7 , 2 5 . 3 , 2 8 . 5 , 1 4 . 2 , 1 7 . 9 , 1 6 . 5 , 2 1 . 1 , 2 4 . 3 , 1 9 . 6 ) x < − c (”B” , ”A” , ”B” , ”A” , ”B” , ”B” , ”B” , ”A” , ”A” , ”A” , ”B” , ”A”) g . n u l l < − r e a l ( ) f o r ( s i n 1:10000) { xsim < − sample ( x ) g . n u l l [ s] < − abs ( mean( y [ xsim==”B” ] ) − mean( y [ xsim==”A”] ) ) }

  44. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Approximating a randomization distribution: ` n A + n B ´ We don’t want to have to enumerate all possible treatment n A assignments. Instead, repeat the following S times for some large number S : (a) randomly simulate a treatment assignment from the population of possible treatment assignments, under the randomization scheme. (b) compute the value of the test statistic, given the simulated treatment assignment and under H 0 . The empirical distribution of { g 1 , . . . , g S } approximates the null distribution: #( g s ≥ g obs ) ≈ Pr( g ( Y A , Y B ) ≥ g obs | H 0 ) S The approximation improves if S is increased. Here is some R-code: y < − c ( 2 6 . 9 , 1 1 . 4 , 2 6 . 6 , 2 3 . 7 , 2 5 . 3 , 2 8 . 5 , 1 4 . 2 , 1 7 . 9 , 1 6 . 5 , 2 1 . 1 , 2 4 . 3 , 1 9 . 6 ) x < − c (”B” , ”A” , ”B” , ”A” , ”B” , ”B” , ”B” , ”A” , ”A” , ”A” , ”B” , ”A”) g . n u l l < − r e a l ( ) f o r ( s i n 1:10000) { xsim < − sample ( x ) g . n u l l [ s] < − abs ( mean( y [ xsim==”B” ] ) − mean( y [ xsim==”A”] ) ) }

  45. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Approximating a randomization distribution: ` n A + n B ´ We don’t want to have to enumerate all possible treatment n A assignments. Instead, repeat the following S times for some large number S : (a) randomly simulate a treatment assignment from the population of possible treatment assignments, under the randomization scheme. (b) compute the value of the test statistic, given the simulated treatment assignment and under H 0 . The empirical distribution of { g 1 , . . . , g S } approximates the null distribution: #( g s ≥ g obs ) ≈ Pr( g ( Y A , Y B ) ≥ g obs | H 0 ) S The approximation improves if S is increased. Here is some R-code: y < − c ( 2 6 . 9 , 1 1 . 4 , 2 6 . 6 , 2 3 . 7 , 2 5 . 3 , 2 8 . 5 , 1 4 . 2 , 1 7 . 9 , 1 6 . 5 , 2 1 . 1 , 2 4 . 3 , 1 9 . 6 ) x < − c (”B” , ”A” , ”B” , ”A” , ”B” , ”B” , ”B” , ”A” , ”A” , ”A” , ”B” , ”A”) g . n u l l < − r e a l ( ) f o r ( s i n 1:10000) { xsim < − sample ( x ) g . n u l l [ s] < − abs ( mean( y [ xsim==”B” ] ) − mean( y [ xsim==”A”] ) ) }

  46. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Approximating a randomization distribution: ` n A + n B ´ We don’t want to have to enumerate all possible treatment n A assignments. Instead, repeat the following S times for some large number S : (a) randomly simulate a treatment assignment from the population of possible treatment assignments, under the randomization scheme. (b) compute the value of the test statistic, given the simulated treatment assignment and under H 0 . The empirical distribution of { g 1 , . . . , g S } approximates the null distribution: #( g s ≥ g obs ) ≈ Pr( g ( Y A , Y B ) ≥ g obs | H 0 ) S The approximation improves if S is increased. Here is some R-code: y < − c ( 2 6 . 9 , 1 1 . 4 , 2 6 . 6 , 2 3 . 7 , 2 5 . 3 , 2 8 . 5 , 1 4 . 2 , 1 7 . 9 , 1 6 . 5 , 2 1 . 1 , 2 4 . 3 , 1 9 . 6 ) x < − c (”B” , ”A” , ”B” , ”A” , ”B” , ”B” , ”B” , ”A” , ”A” , ”A” , ”B” , ”A”) g . n u l l < − r e a l ( ) f o r ( s i n 1:10000) { xsim < − sample ( x ) g . n u l l [ s] < − abs ( mean( y [ xsim==”B” ] ) − mean( y [ xsim==”A”] ) ) }

  47. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Essential nature of a hypothesis test Given H 0 , H 1 and data y = { y 1 , . . . , y n } : 1. From the data, compute a relevant test statistic g ( y ): The test statistic g ( y ) should be chosen so that it can differentiate between H 0 and H 1 in ways that are scientifically relevant. Typically, g ( y ) is chosen so that  small under H 0 g ( y ) is probably large under H 1 2. Obtain a null distribution : A probability distribution over the possible outcomes of g ( Y ) under H 0 . Here, Y = { Y 1 , . . . , Y n } are potential experimental results that could have happened under H 0 . 3. Compute the p-value : The probability under H 0 of observing a test statistic g ( Y ) as or more extreme than the observed statistic g ( y ). p -value = Pr( g ( Y ) ≥ g ( y ) | H 0 ) If the p -value is small ⇒ evidence against H 0 If the p -value is large ⇒ not evidence against H 0 Even if we follow these guidelines, we must be careful in our specification of H 0 , H 1 and g ( Y ) for the hypothesis testing procedure to be useful.

  48. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Essential nature of a hypothesis test Given H 0 , H 1 and data y = { y 1 , . . . , y n } : 1. From the data, compute a relevant test statistic g ( y ): The test statistic g ( y ) should be chosen so that it can differentiate between H 0 and H 1 in ways that are scientifically relevant. Typically, g ( y ) is chosen so that  small under H 0 g ( y ) is probably large under H 1 2. Obtain a null distribution : A probability distribution over the possible outcomes of g ( Y ) under H 0 . Here, Y = { Y 1 , . . . , Y n } are potential experimental results that could have happened under H 0 . 3. Compute the p-value : The probability under H 0 of observing a test statistic g ( Y ) as or more extreme than the observed statistic g ( y ). p -value = Pr( g ( Y ) ≥ g ( y ) | H 0 ) If the p -value is small ⇒ evidence against H 0 If the p -value is large ⇒ not evidence against H 0 Even if we follow these guidelines, we must be careful in our specification of H 0 , H 1 and g ( Y ) for the hypothesis testing procedure to be useful.

  49. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Essential nature of a hypothesis test Given H 0 , H 1 and data y = { y 1 , . . . , y n } : 1. From the data, compute a relevant test statistic g ( y ): The test statistic g ( y ) should be chosen so that it can differentiate between H 0 and H 1 in ways that are scientifically relevant. Typically, g ( y ) is chosen so that  small under H 0 g ( y ) is probably large under H 1 2. Obtain a null distribution : A probability distribution over the possible outcomes of g ( Y ) under H 0 . Here, Y = { Y 1 , . . . , Y n } are potential experimental results that could have happened under H 0 . 3. Compute the p-value : The probability under H 0 of observing a test statistic g ( Y ) as or more extreme than the observed statistic g ( y ). p -value = Pr( g ( Y ) ≥ g ( y ) | H 0 ) If the p -value is small ⇒ evidence against H 0 If the p -value is large ⇒ not evidence against H 0 Even if we follow these guidelines, we must be careful in our specification of H 0 , H 1 and g ( Y ) for the hypothesis testing procedure to be useful.

  50. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Essential nature of a hypothesis test Given H 0 , H 1 and data y = { y 1 , . . . , y n } : 1. From the data, compute a relevant test statistic g ( y ): The test statistic g ( y ) should be chosen so that it can differentiate between H 0 and H 1 in ways that are scientifically relevant. Typically, g ( y ) is chosen so that  small under H 0 g ( y ) is probably large under H 1 2. Obtain a null distribution : A probability distribution over the possible outcomes of g ( Y ) under H 0 . Here, Y = { Y 1 , . . . , Y n } are potential experimental results that could have happened under H 0 . 3. Compute the p-value : The probability under H 0 of observing a test statistic g ( Y ) as or more extreme than the observed statistic g ( y ). p -value = Pr( g ( Y ) ≥ g ( y ) | H 0 ) If the p -value is small ⇒ evidence against H 0 If the p -value is large ⇒ not evidence against H 0 Even if we follow these guidelines, we must be careful in our specification of H 0 , H 1 and g ( Y ) for the hypothesis testing procedure to be useful.

  51. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Essential nature of a hypothesis test Given H 0 , H 1 and data y = { y 1 , . . . , y n } : 1. From the data, compute a relevant test statistic g ( y ): The test statistic g ( y ) should be chosen so that it can differentiate between H 0 and H 1 in ways that are scientifically relevant. Typically, g ( y ) is chosen so that  small under H 0 g ( y ) is probably large under H 1 2. Obtain a null distribution : A probability distribution over the possible outcomes of g ( Y ) under H 0 . Here, Y = { Y 1 , . . . , Y n } are potential experimental results that could have happened under H 0 . 3. Compute the p-value : The probability under H 0 of observing a test statistic g ( Y ) as or more extreme than the observed statistic g ( y ). p -value = Pr( g ( Y ) ≥ g ( y ) | H 0 ) If the p -value is small ⇒ evidence against H 0 If the p -value is large ⇒ not evidence against H 0 Even if we follow these guidelines, we must be careful in our specification of H 0 , H 1 and g ( Y ) for the hypothesis testing procedure to be useful.

  52. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Essential nature of a hypothesis test Given H 0 , H 1 and data y = { y 1 , . . . , y n } : 1. From the data, compute a relevant test statistic g ( y ): The test statistic g ( y ) should be chosen so that it can differentiate between H 0 and H 1 in ways that are scientifically relevant. Typically, g ( y ) is chosen so that  small under H 0 g ( y ) is probably large under H 1 2. Obtain a null distribution : A probability distribution over the possible outcomes of g ( Y ) under H 0 . Here, Y = { Y 1 , . . . , Y n } are potential experimental results that could have happened under H 0 . 3. Compute the p-value : The probability under H 0 of observing a test statistic g ( Y ) as or more extreme than the observed statistic g ( y ). p -value = Pr( g ( Y ) ≥ g ( y ) | H 0 ) If the p -value is small ⇒ evidence against H 0 If the p -value is large ⇒ not evidence against H 0 Even if we follow these guidelines, we must be careful in our specification of H 0 , H 1 and g ( Y ) for the hypothesis testing procedure to be useful.

  53. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Questions • Is a small p -value evidence in favor of H 1 ? • Is a large p -value evidence in favor of H 0 ? • What does the p -value say about the probability that the null hypothesis is true? Try using Bayes’ rule to figure this out.

  54. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Questions • Is a small p -value evidence in favor of H 1 ? • Is a large p -value evidence in favor of H 0 ? • What does the p -value say about the probability that the null hypothesis is true? Try using Bayes’ rule to figure this out.

  55. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Questions • Is a small p -value evidence in favor of H 1 ? • Is a large p -value evidence in favor of H 0 ? • What does the p -value say about the probability that the null hypothesis is true? Try using Bayes’ rule to figure this out.

  56. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Choosing test statistics The test statistic g ( y ) should be able to “differentiate” between H 0 and H 1 in ways that are “scientifically relevant”. What does this mean? Suppose our data consist of samples y A and y B from two populations A and B . Previously we used g ( y A , y B ) = | ¯ y B − ¯ y A | . Let’s consider two different test statistics: • t -statistic: • Kolmogorov-Smirnov statistic

  57. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Choosing test statistics The test statistic g ( y ) should be able to “differentiate” between H 0 and H 1 in ways that are “scientifically relevant”. What does this mean? Suppose our data consist of samples y A and y B from two populations A and B . Previously we used g ( y A , y B ) = | ¯ y B − ¯ y A | . Let’s consider two different test statistics: • t -statistic: • Kolmogorov-Smirnov statistic

  58. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Choosing test statistics The test statistic g ( y ) should be able to “differentiate” between H 0 and H 1 in ways that are “scientifically relevant”. What does this mean? Suppose our data consist of samples y A and y B from two populations A and B . Previously we used g ( y A , y B ) = | ¯ y B − ¯ y A | . Let’s consider two different test statistics: • t -statistic: • Kolmogorov-Smirnov statistic

  59. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Choosing test statistics The test statistic g ( y ) should be able to “differentiate” between H 0 and H 1 in ways that are “scientifically relevant”. What does this mean? Suppose our data consist of samples y A and y B from two populations A and B . Previously we used g ( y A , y B ) = | ¯ y B − ¯ y A | . Let’s consider two different test statistics: • t -statistic: • Kolmogorov-Smirnov statistic

  60. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory The t statistic | ¯ y B − ¯ y A | g t ( y A , y B ) = , where p 1 / n A + 1 / n B s p This is a scaled version of our previous test statistic, comparing the difference in sample means to a pooled version of the sample standard deviation and the sample size. numerator: The effect size estimate (difference in means) denominator: The precision of the estimate (sample sd scaled by sample size) This statistic is • increasing in | ¯ y B − ¯ y A | ; • increasing in n A and n B ; • decreasing in s p . A more complete motivation for this statistic will be given in the next chapter.

  61. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory The t statistic | ¯ y B − ¯ y A | g t ( y A , y B ) = , where p 1 / n A + 1 / n B s p n A − 1 n B − 1 s 2 ( n A − 1) + ( n B − 1) s 2 ( n A − 1) + ( n B − 1) s 2 = A + p B This is a scaled version of our previous test statistic, comparing the difference in sample means to a pooled version of the sample standard deviation and the sample size. numerator: The effect size estimate (difference in means) denominator: The precision of the estimate (sample sd scaled by sample size) This statistic is • increasing in | ¯ y B − ¯ y A | ; • increasing in n A and n B ; • decreasing in s p . A more complete motivation for this statistic will be given in the next chapter.

  62. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory The t statistic | ¯ y B − ¯ y A | g t ( y A , y B ) = , where p 1 / n A + 1 / n B s p n A − 1 n B − 1 s 2 ( n A − 1) + ( n B − 1) s 2 ( n A − 1) + ( n B − 1) s 2 = A + p B This is a scaled version of our previous test statistic, comparing the difference in sample means to a pooled version of the sample standard deviation and the sample size. numerator: The effect size estimate (difference in means) denominator: The precision of the estimate (sample sd scaled by sample size) This statistic is • increasing in | ¯ y B − ¯ y A | ; • increasing in n A and n B ; • decreasing in s p . A more complete motivation for this statistic will be given in the next chapter.

  63. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory The t statistic | ¯ y B − ¯ y A | g t ( y A , y B ) = , where p 1 / n A + 1 / n B s p n A − 1 n B − 1 s 2 ( n A − 1) + ( n B − 1) s 2 ( n A − 1) + ( n B − 1) s 2 = A + p B This is a scaled version of our previous test statistic, comparing the difference in sample means to a pooled version of the sample standard deviation and the sample size. numerator: The effect size estimate (difference in means) denominator: The precision of the estimate (sample sd scaled by sample size) This statistic is • increasing in | ¯ y B − ¯ y A | ; • increasing in n A and n B ; • decreasing in s p . A more complete motivation for this statistic will be given in the next chapter.

  64. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory The t statistic | ¯ y B − ¯ y A | g t ( y A , y B ) = , where p 1 / n A + 1 / n B s p n A − 1 n B − 1 s 2 ( n A − 1) + ( n B − 1) s 2 ( n A − 1) + ( n B − 1) s 2 = A + p B This is a scaled version of our previous test statistic, comparing the difference in sample means to a pooled version of the sample standard deviation and the sample size. numerator: The effect size estimate (difference in means) denominator: The precision of the estimate (sample sd scaled by sample size) This statistic is • increasing in | ¯ y B − ¯ y A | ; • increasing in n A and n B ; • decreasing in s p . A more complete motivation for this statistic will be given in the next chapter.

  65. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory The t statistic | ¯ y B − ¯ y A | g t ( y A , y B ) = , where p 1 / n A + 1 / n B s p n A − 1 n B − 1 s 2 ( n A − 1) + ( n B − 1) s 2 ( n A − 1) + ( n B − 1) s 2 = A + p B This is a scaled version of our previous test statistic, comparing the difference in sample means to a pooled version of the sample standard deviation and the sample size. numerator: The effect size estimate (difference in means) denominator: The precision of the estimate (sample sd scaled by sample size) This statistic is • increasing in | ¯ y B − ¯ y A | ; • increasing in n A and n B ; • decreasing in s p . A more complete motivation for this statistic will be given in the next chapter.

  66. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory The t statistic | ¯ y B − ¯ y A | g t ( y A , y B ) = , where p 1 / n A + 1 / n B s p n A − 1 n B − 1 s 2 ( n A − 1) + ( n B − 1) s 2 ( n A − 1) + ( n B − 1) s 2 = A + p B This is a scaled version of our previous test statistic, comparing the difference in sample means to a pooled version of the sample standard deviation and the sample size. numerator: The effect size estimate (difference in means) denominator: The precision of the estimate (sample sd scaled by sample size) This statistic is • increasing in | ¯ y B − ¯ y A | ; • increasing in n A and n B ; • decreasing in s p . A more complete motivation for this statistic will be given in the next chapter.

  67. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory The Kolmogorov-Smirnov statistic y ∈ R | ˆ F B ( y ) − ˆ g KS ( y A , y B ) = max F A ( y ) | This is just the size of the largest gap between the two sample CDFs. 0.6 1.0 Density 0.3 0.8 0.0 0.6 6 8 10 12 14 F(y) y A 0.4 Density 0.10 0.2 0.0 0.00 6 8 10 12 14 6 8 10 12 14 y B y Figure: Histograms and empirical CDFs of the first two hypothetical samples.

  68. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Comparing the test statistics Suppose we perform the CRD and obtain samples y A and y B given in Figure 3. • n A = n B = 40 • ¯ y A = 10 . 05, ¯ y B = 9 . 70. • s A = 0 . 87, s B = 2 . 07 The main difference seems to be the variances and not the means. Hypothesis testing H 0 : treatment does not affect response We can approximate the null distributions of g t ( Y A , Y B ) and g KS ( Y A , Y B ) by randomly reassigning the treatments but leaving the responses fixed: Gsim < − NULL f o r ( s i n 1:5000) { xsim < − sample ( x ) yAsim < − y [ xsim==”A”] ; yBsim < − y [ xsim==”B”] g1 < − g . t s t a t ( yAsim , yBsim ) g2 < − g . ks ( yAsim , yBsim ) Gsim < − r b i n d ( Gsim , c ( g1 , g2 )) }

  69. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Comparing the test statistics Suppose we perform the CRD and obtain samples y A and y B given in Figure 3. • n A = n B = 40 • ¯ y A = 10 . 05, ¯ y B = 9 . 70. • s A = 0 . 87, s B = 2 . 07 The main difference seems to be the variances and not the means. Hypothesis testing H 0 : treatment does not affect response We can approximate the null distributions of g t ( Y A , Y B ) and g KS ( Y A , Y B ) by randomly reassigning the treatments but leaving the responses fixed: Gsim < − NULL f o r ( s i n 1:5000) { xsim < − sample ( x ) yAsim < − y [ xsim==”A”] ; yBsim < − y [ xsim==”B”] g1 < − g . t s t a t ( yAsim , yBsim ) g2 < − g . ks ( yAsim , yBsim ) Gsim < − r b i n d ( Gsim , c ( g1 , g2 )) }

  70. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Comparing the test statistics Suppose we perform the CRD and obtain samples y A and y B given in Figure 3. • n A = n B = 40 • ¯ y A = 10 . 05, ¯ y B = 9 . 70. • s A = 0 . 87, s B = 2 . 07 The main difference seems to be the variances and not the means. Hypothesis testing H 0 : treatment does not affect response We can approximate the null distributions of g t ( Y A , Y B ) and g KS ( Y A , Y B ) by randomly reassigning the treatments but leaving the responses fixed: Gsim < − NULL f o r ( s i n 1:5000) { xsim < − sample ( x ) yAsim < − y [ xsim==”A”] ; yBsim < − y [ xsim==”B”] g1 < − g . t s t a t ( yAsim , yBsim ) g2 < − g . ks ( yAsim , yBsim ) Gsim < − r b i n d ( Gsim , c ( g1 , g2 )) }

  71. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Comparing the test statistics 6 0.6 5 Density Density 4 0.4 3 2 0.2 1 0.0 0 0 1 2 3 4 0.1 0.2 0.3 0.4 t statistic KS statistic Figure: Randomization distributions for the t and KS statistics for the first example.

  72. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Comparing the test statistics p -values : t -statistic : g t ( y A , y B ) = 1 . 00 , Pr( g t ( Y A , Y B ) ≥ 1 . 00) = 0 . 321 KS-statistic: g KS ( y A , y B ) = 0 . 30 , Pr( g KS ( Y A , Y B ) ≥ 0 . 30) = 0 . 043 • test based on the t -statistic does not indicate strong evidence against H 0 • test based on the KS-statistic does. Reason: • The t -statistic is only sensitive to differences in means. In particular, if ¯ y A = ¯ y B then the t -statistic is zero, its minimum value. • In contrast, the KS-statistic is sensitive to any differences in the sample distributions.

  73. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Comparing the test statistics p -values : t -statistic : g t ( y A , y B ) = 1 . 00 , Pr( g t ( Y A , Y B ) ≥ 1 . 00) = 0 . 321 KS-statistic: g KS ( y A , y B ) = 0 . 30 , Pr( g KS ( Y A , Y B ) ≥ 0 . 30) = 0 . 043 • test based on the t -statistic does not indicate strong evidence against H 0 • test based on the KS-statistic does. Reason: • The t -statistic is only sensitive to differences in means. In particular, if ¯ y A = ¯ y B then the t -statistic is zero, its minimum value. • In contrast, the KS-statistic is sensitive to any differences in the sample distributions.

  74. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Comparing the test statistics p -values : t -statistic : g t ( y A , y B ) = 1 . 00 , Pr( g t ( Y A , Y B ) ≥ 1 . 00) = 0 . 321 KS-statistic: g KS ( y A , y B ) = 0 . 30 , Pr( g KS ( Y A , Y B ) ≥ 0 . 30) = 0 . 043 • test based on the t -statistic does not indicate strong evidence against H 0 • test based on the KS-statistic does. Reason: • The t -statistic is only sensitive to differences in means. In particular, if ¯ y A = ¯ y B then the t -statistic is zero, its minimum value. • In contrast, the KS-statistic is sensitive to any differences in the sample distributions.

  75. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Comparing the test statistics p -values : t -statistic : g t ( y A , y B ) = 1 . 00 , Pr( g t ( Y A , Y B ) ≥ 1 . 00) = 0 . 321 KS-statistic: g KS ( y A , y B ) = 0 . 30 , Pr( g KS ( Y A , Y B ) ≥ 0 . 30) = 0 . 043 • test based on the t -statistic does not indicate strong evidence against H 0 • test based on the KS-statistic does. Reason: • The t -statistic is only sensitive to differences in means. In particular, if ¯ y A = ¯ y B then the t -statistic is zero, its minimum value. • In contrast, the KS-statistic is sensitive to any differences in the sample distributions.

  76. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Comparing the test statistics p -values : t -statistic : g t ( y A , y B ) = 1 . 00 , Pr( g t ( Y A , Y B ) ≥ 1 . 00) = 0 . 321 KS-statistic: g KS ( y A , y B ) = 0 . 30 , Pr( g KS ( Y A , Y B ) ≥ 0 . 30) = 0 . 043 • test based on the t -statistic does not indicate strong evidence against H 0 • test based on the KS-statistic does. Reason: • The t -statistic is only sensitive to differences in means. In particular, if ¯ y A = ¯ y B then the t -statistic is zero, its minimum value. • In contrast, the KS-statistic is sensitive to any differences in the sample distributions.

  77. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Sensitivity to specific alternatives Now consider a second dataset for which • n A = n B = 40 • ¯ y A = 10 . 11, ¯ y B = 10 . 73. • s A = 1 . 75, s B = 1 . 85 0.30 1.0 Density 0.15 0.8 0.00 0.6 8 10 12 14 16 F(y) y A 0.4 Density 0.15 0.2 0.0 0.00 8 10 12 14 16 8 10 12 14 16 y B y The difference in sample means is about twice as large with the previous data. The sample standard deviations are pretty similar. Is there evidence that the mean difference is caused by treatment?

  78. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Sensitivity to specific alternatives 6 0.6 5 Density Density 4 0.4 3 0.2 2 1 0.0 0 0 1 2 3 4 0.1 0.2 0.3 0.4 0.5 t statistic KS statistic t -statistic : g t ( y A , y B ) = 1 . 54 , Pr( g t ( Y A , Y B ) ≥ 1 . 54) = 0 . 122 KS-statistic: g KS ( y A , y B ) = 0 . 25 , Pr( g KS ( Y A , Y B ) ≥ 0 . 25) = 0 . 106 This time the two test statistics indicate similar evidence against H 0 . This is because the difference in the two sample distributions could primarily be summarized as the difference between the sample means, which the t -statistic can identify.

  79. Summaries of sample populations Hypothesis testing via randomization Sensitivity to the alternative Basic decision theory Sensitivity to specific alternatives 6 0.6 5 Density Density 4 0.4 3 0.2 2 1 0.0 0 0 1 2 3 4 0.1 0.2 0.3 0.4 0.5 t statistic KS statistic t -statistic : g t ( y A , y B ) = 1 . 54 , Pr( g t ( Y A , Y B ) ≥ 1 . 54) = 0 . 122 KS-statistic: g KS ( y A , y B ) = 0 . 25 , Pr( g KS ( Y A , Y B ) ≥ 0 . 25) = 0 . 106 This time the two test statistics indicate similar evidence against H 0 . This is because the difference in the two sample distributions could primarily be summarized as the difference between the sample means, which the t -statistic can identify.

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