Transcription of Using R: Chapter 8 Hypothesis Testing - One Sample
1 1 Using R: Chapter 8 Hypothesis Testing - One SampleHere we get critical values and P-values for Hypothesis tests about proportions and means. Tests about a Proportion Using the test Tests about a Proportion Tests about a mean ( unknown) Using the test statisticptandqt3 Tests about a mean ( unknown) - From Raw Tests about a mean ( known) Using the test statisticpnormandqnorm4 Tests about a Proportion Using the Test Statistic =z p= p p pqnSignificance Level = Critical Values =z or z /2 Finding critical valueswith theqnormfunctionUsage: Critical Value =qnorm(area to the left) Left-Tailed Tests:z =qnorm( ) Right-Tailed Tests:z =qnorm(1 ) Two-Tailed Tests:z /2= qnorm(1 /2) FindingP-valueswith :P-value =pnorm(z p, = ). Left-Tailed Tests:P-value =pnorm(z p, ) Right-Tailed Tests:P-value =pnorm(z p, ) Two-Tailed Tests:P-value =2 * pnorm( abs(z p), )2 Tests about a Proportion usingxandn FindingP-valueswith (x, n, p=, correct=, alternate = ).
2 X is the number of successes n is the number of trials p is the proportion in the null Hypothesis correct = TRUE (use a continuity correction factor) or FALSE (do not). alternate = (default), less , or greater .If you set correct=TRUE, your answers will vary from those given in the text but would generallybe considered more accurate. This function returns a lot of information that we don t need. For ourimmediate purposes we will be focusing on theP-value (highlighted in blue below) 1 from Chapter :A coin is flipped 100 times and comes up heads 43 times. Test theclaim that this is a fair coin. Use a significance level. Everything in red is typed by the in blue is output to the fail reject the null Hypothesis because theP-value (.)
3 1615) is greater than the significance we can not reject the claim that the coin is about a mean ( unknown) Using the test statisticTest Statistic =t x= x s nSignificance Level = Critical Values =t or t /2 Finding Critical Values:Here we use : Critical Value =qt(area to the left) Left-Tailed Tests:t =qt( ) Right-Tailed Tests:t =qt(1 ) Two-Tailed Tests:t /2= qt(1 /2) FindingP-ValuesHere we use :P-value =pt(t x, df = , = ). Left-Tailed Tests:P-value =pt(t x, df = n-1, ) Right-Tailed Tests:P-value =pt(t x, df = n-1, ) Two-Tailed Tests:P-value =2 * pt( abs(t x), df = n-1, ) Using Raw Data:Here we use Suppose you have raw data in a .CSV can use to get the test statistic, degrees of freedom, and the P-value of thetest statistic. Two-Tailed (data-list, mu = ,) Right-Tailed (data-list, mu= ,alternative= greater ) Left-Tailed (data-list, mu= ,alternative= less )For example if we have Sample data with a mean of we might test the claim that the populationmean is greater than about a mean ( known).
4 Test Statistic =z x= x nSignificance Level = Critical Values =z or z /2 Finding Critical Values:Here we use : Critical Value =qnorm(area to the left) Left-Tailed Tests:z =qnorm( ) Right-Tailed Tests:z =qnorm(1 ) Two-Tailed Tests:z /2= qnorm(1 /2) FindingP-ValuesHere we use :P-value =pnorm(z x, = ). Left-Tailed Tests:P-value =pnorm(z x, ) Right-Tailed Tests:P-value =pnorm(z x, ) Two-Tailed Tests:P-value =2 * pnorm( abs(z x), )