May 2019
Beginner to intermediate
266 pages
5h 57m
English
In this hypothesis testing, you can only specify a direction to the dataset mentioned previously. Here, we will use the same function with the alternative equal to (=) instruction to switch the emphasis from a two-sided test (the default) to a one-sided test. The choices that we can have are two.sided, less, or greater, and the choice can be abbreviated, as shown in the following command:
> t.test(longley$GNP, mu = 5, alternative = 'two.sided')One Sample t-testdata: longley$GNPt = 15.401, df = 15, p-value = 1.337e-10alternative hypothesis: true mean is not equal to 595 percent confidence interval:334.7346 440.6623sample estimates:mean of x387.6984> t.test(longley$Unemployed, mu = 5, alternative = 'two.sided')Read now
Unlock full access