Math 338 Summer Lab Activity 6 Daniel Jordan Application 1

advertisement
Math 338 Summer
Lab Activity 6
Daniel Jordan
Application 1:
Average hours per week on the Internet. The Student Monitor surveys 1200 undergraduates from 100
colleges semiannually to understand trends among college students. Recently, the Student
Monitor reported that the average amount of time spent per week on the Internet was 15.1
hours. Assume that the standard deviation is 5 hours.
(a) Give a 95% confidence interval for the mean time spent per week on the Internet.
(14.8171, 15.3829)
(b) Is it true that 95% of the students surveyed reported weekly times that lie in the interval you found
in part (a)? Explain your answer.
Yes, this is true. 15.1 hours falls within our 95% confidence interval of (14.8171, 15.3829)
(c) Give a 98% confidence interval for the mean time spent per week on the Internet.
(14.77775, 15.42225)
(d) Compare parts a and c, comment and justify.
The 98% confidence interval says that 98% of the observed intervals will fall in the interval (14.77775,
15.42225). This is a wider interval than the 98% CI interval, because we have a higher level of
confidence in the margin of error.
Application 2:
6.26 Fuel efficiency. Computers in some vehicles calculate various quantities related to
performance. One of these is the fuel efficiency, or gas mileage, usually expressed as miles per
gallon (mpg). For one vehicle equipped in this way, the mpg were recorded each time the gas tank was
filled, and the computer was then reset. Here are the mpg values for a random sample of 20 of these
records:
Suppose that the standard deviation is known to be σ = 3.5 mpg. Use R to do the following.
(a) Store mpg in a vector called x. Hint: x=c(…,…,…,…)
(b)What is
, the standard deviation of
?
0.7826238
(c) Obtain the mean of x.
43.17
(d) Give a 95% confidence interval for μ, the mean mpg for this vehicle.
(41.8827,44.4573)
(e) Use R to obtain the margin confidence interval for μ, the mean mpg for this vehicle.
(f) Use R to obtain a 99% confidence interval for μ, the mean mpg for this vehicle. Compare with part d.
Comment and justify.
The 99% confidence interval is (41.34934, 44.99066). Since this is a higher confidence level than part d,
it is expected that this will be a larger interval. This result tells us that 99% of the observed intervals
will fall within 41.34934 and 44.99066.
Application 3:
Generate 50 random samples each of size 100 from normal distribution with mean
µ=5 and standard deviation σ =3. Compute (50) confidence intervals with confidence
level 95%.
(a) Report all confidence intervals in a matrix C( 50 ,2). Use R code mentioned in
the introduction. Print the confidence intervals in your report.
[1,] 4.096960 5.272960 [2,] 3.893269 5.069269 [3,] 4.225552 5.401552 [4,] 4.368498
5.544498 [5,] 4.445411 5.621411 [6,] 5.152368 6.328368 [7,] 4.674004 5.850004 [8,]
4.260126 5.436126 [9,] 4.443973 5.619973 [10,] 4.188535 5.364535 [11,] 3.994363
5.170363 [12,] 4.641000 5.817000 [13,] 4.596559 5.772559 [14,] 4.210447 5.386447 [15,]
4.224877 5.400877 [16,] 4.200377 5.376377 [17,] 4.290125 5.466125 [18,] 4.605017
5.781017 [19,] 4.383838 5.559838 [20,] 4.085183 5.261183 [21,] 4.240863 5.416863 [22,]
4.711290 5.887290 [23,] 4.111886 5.287886 [24,] 4.246308 5.422308 [25,] 4.672580
5.848580 [26,] 3.949762 5.125762 [27,] 4.832479 6.008479 [28,] 4.677258 5.853258 [29,]
4.462982 5.638982 [30,] 4.400334 5.576334 [31,] 4.252848 5.428848 [32,] 4.653882
5.829882 [33,] 4.063325 5.239325 [34,] 4.768258 5.944258 [35,] 3.871158 5.047158 [36,]
4.951824 6.127824 [37,] 4.351235 5.527235 [38,] 3.999896 5.175896 [39,] 3.976817
5.152817 [40,] 4.240779 5.416779 [41,] 4.513363 5.689363 [42,] 4.000940 5.176940 [43,]
4.524551 5.700551 [44,] 3.993335 5.169335 [45,] 4.798007 5.974007 [46,] 4.057078
5.233078 [47,] 4.897875 6.073875 [48,] 3.940842 5.116842 [49,] 3.842166 5.018166 [50,]
4.432417 5.608417
(b) Find manually the width of the first 5 intervals. Comment on your answers.
This tells us that the margin of error of a 95% confidence interval given
these parameters, will be 1.176.
(c) Find manually how many intervals include or capture the true mean µ=5.
Comment.
49 out of the 50 intervals contain the true mean µ=5. The interval which
does not contain the true mean, is (5.152368 6.328368).
(d) Use R code to obtain the percentage of the intervals that include the true mean
µ=5. Comment. Also compare with part c.
This matches the results from part C, as 49/50 is 98%.
Application 4:
Generate 100 random numbers S from the binomial with n=10 and p=0.3.
Hint: Use the code:
>n=10;p=0.3
>S=rbinom(100,n,p)
>z=(S-n*p)/sqrt(n*p*(1-p))
Answer the following and write comments on each part:
a. Investigate the histogram of z. Describe its features.
The histogram features a mean of 0.1173, median of 0, Q1 of -0.6901, Q3 of
0.6901 and a range of 5.5.
b. Obtain the mean and standard deviation of z.
c. Obtain the percentage of data of z that lie within 2 standard deviation from the
mean.
Hint: use the code: sum(z>-2&z<2)/100.
90% of the data lies within 2 standard deviations from the mean
d. Use the normal quartile plot to examine the normality of the random numbers
generated in the vector z. Comment.
This plot shows a nearly normal distribution.
Download