辅导R 编程 Computational
- 首页 >> 其他Homework #7: Computational
All computations should be done in this notebook using the R kernel. Working in small groups is allowed, but it is
important that you make an effort to master the material and hand in your own work.
You will be required to submit this notebook, fully compiled with your solutions,
as an HTML or ipynb file to Canvas by 2pm on Friday, March 23.
Problem 1
Load into R. A description of the variables can be obtained from page 73 of
(a) Calculate the 85% confidence interval for the mean of a galaxy's distance
from Earth in Mega parsecs in R by doing the computation explicitly.
(b) Can you find a built in R function that does this computation automatically?
(c) Interpret the confidence interval.
Problem 2
Simulate confidence intervals for a population proportion
(using the confidence interval formula that we derived in class). Use this
simulation to justify the interpretation of this confidence interval.
1.03643338949379
Problem 3
We might be interested in computing confidence intervals for parameters other than a mean, , proportion,
, etc. For many of these parameters, standard statistical theory will not help. In this problem, we will
compute a 95% confidence interval for the rate parameter of an exponential distribution.
A theoretical model suggests that , the time to breakdown of an insulating fluid between electrodes at a
particular voltage, has an exponential distribution: . A random sample of breakdown
times (minutes) is given here:
(a) Construct a matrix of rows, where each row is a sample of size 10
(sampled with replacement) from the above 10 numbers. (HINT: use the sample
m = 1000
qnorm(0.85)
ci(m, confidence= 0.85,alpha = 1‐confidence)
function in R.)
(b) From each of the samples, compute a reasonable estimate of (HINT: How
is related to the mean of an exponential?). Call this estimator .
(c) You now have a sample from the distribution of the estimator . Construct a
histogram and comment on the distribution.
(d) Use the quantile function in R to find the 2.5 percentile and the 97.5
percentile. This is a bootstrap confidence interval for .