The built-in ldeaths data set contains measurements giving the
monthly deaths from bronchitis, emphysema and asthma in the UK,
19741979, both sexes. We can easily access this data with the
assignment x <- as.vector(ldeaths). We can also get the data by
entering the values 1 by 1. (You would be wise to not do the 1 by 1
entry.) The following is a screen print of the data values:s:
[1] 3035 2552 2704 2554 2014 1655 1721 1524 1596 2074 2199 2512
2933 2889
[15] 2938 2497 1870 1726 1607 1545 1396 1787 2076 2837 2787 3891
3179 2011
[29] 1636 1580 1489 1300 1356 1653 2013 2823 3102 2294 2385 2444
1748 1554
[43] 1498 1361 1346 1564 1640 2293 2815 3137 2679 1969 1870 1633
1529 1366
[57] 1357 1570 1535 2491 3084 2605 2573 2143 1693 1504 1461 1354
1333 1492
[71] 1781 1915
Assume these values are a random sample from a normal population
with unknown mean μ and unknown standard deviation
σ.
Call the vector of observations x,using the assignment above, x
<- as.vector(deaths)
l) Using this data, create a 92% prediction interval for
μ, noting that the sample size is large enough so we can
use a normal distribution critical value zstar. (
,
)
m) Using this data, we create a 5% level test
ofH0: μ=2000
versus the
alternative
Ha: μ >
2000. We will
reject
H0if
z =
x − 2000 | ||||
|
> zstar where s is the sample standard
deviation. What is the value of zstar? (Calculate from normal
distribution)
n) Continuing from part m, what is the value of z?
o) Continuing from parts m and n, what is the p value of the
test.
(l) The 92% prediction interval for μ is between 1928.974 and 2184.276.
(m) zstar = 1.645
(n) z = -0.79
(i) p-value = 0.7846136
The R code is:
x <- c(3035, 2552, 2704, 2554, 2014, 1655, 1721, 1524, 1596,
2074, 2199, 2512, 2933, 2889,
2938, 2497, 1870, 1726, 1607, 1545, 1396, 1787, 2076, 2837, 2787,
3891, 3179, 2011,
1636, 1580, 1489, 1300, 1356, 1653, 2013, 2823, 3102, 2294, 2385,
2444, 1748, 1554,
1498, 1361, 1346, 1564, 1640, 2293, 2815, 3137, 2679, 1969, 1870,
1633, 1529, 1366,
1357, 1570, 1535, 2491, 3084, 2605, 2573, 2143, 1693, 1504, 1461,
1354, 1333, 1492,
1781, 1915)
t.test(x, mu = 0, conf.level = 0.92, interval = "prediction")
zstar = qnorm(0.95)
mean(x)
sd(x)
length(x)
se = 609.8457/sqrt(72)
z <- (2000-2056.625)/se
pnorm(z, lower.tail = FALSE)
Get Answers For Free
Most questions answered within 1 hours.