10.07.2015 Views

Using R for Introductory Statistics : John Verzani

Using R for Introductory Statistics : John Verzani

Using R for Introductory Statistics : John Verzani

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Using</strong> R <strong>for</strong> introductory statistics 190If n is small, we can do simulations to see that the distribution of T is stillapproximately the t-distribution if the parent distribution of the X i is not too far fromnormal. That is, the tails can’t be too long, or the skew can’t be too great. When n islarge, the central limit theorem applies. A statistic whose sampling distribution doesn’tchange dramatically <strong>for</strong> moderate changes in the population distribution is called arobust statistic.7.3.1 One-sided confidence intervalsWhen finding a confidence interval <strong>for</strong> the mean <strong>for</strong> a given a, we found t* so thatP(−t*≤T n−1 ≤ t*)=1−α. This method returns symmetric confidence intervals. The basicidea is that the area under the density of the sampling distribution that lies outside theconfidence interval is evenly split on each side. This leaves α/2 area in each tail. This issimilar to Figure 7.3, in which the normal density is shown with equal allocation of thearea to the tails. This approach is not the only one. This extra area can be allocated in anyproportion to the left or right of the confidence interval. One-sided confidence intervalsput the area all on one side or the other. For confidence intervals <strong>for</strong> the mean, based onthe T statistic, these would be found <strong>for</strong> a given a by finding t* such that P(t*≤T n−1 )=1−αor P(T n−1 ≤t*)=1−α.In R, the prop.test(), binom.test(), and t.test() functions can return one-sidedconfidence intervals. When the argument alt="less" is used, an interval of the type (−∞,b] is printed. Similarly, when alt= " greater " is used, an interval of the type [b, ∞) is printed.■ Example 7.6: Serving coffee The barista at "t-test espresso" is told that the optimalserving temperature <strong>for</strong> coffee is 180°F. Five temperatures are taken of the served coffee:175, 185, 170, 184, and 175 degrees. Find a 90% confidence interval of the <strong>for</strong>m (−∞, b]<strong>for</strong> the mean temperature.<strong>Using</strong> t.test() with alt="less" will give this type of one-sided confidence interval:> x = c(175, 185, 170, 184, 175)> t.test(x.conf.level = 0.90, alt="less")One Sample t-testdata: xt = 61.57, df = 4, p-value = 1alternative hypothesis: true mean is less than a90 percent confidence interval:−Inf 182.2sample estimates:mean of x177.8The confidence interval contains the value of 180 degrees.7.3.2 Problems7.13 A hard-drive manufacturer would like to ensure that the mean time between failures(MTBF) <strong>for</strong> its new hard drive is 1 million hours. A stress test is designed that cansimulate the workload at a much faster pace. The testers assume that a test lasting 10 days

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!