As part of an infrastructure proposal you wish to investigat
As part of an infrastructure proposal, you wish to investigate the mean time between failure (MTBF) for PVC pipes in water distribution systems. You have prior evidence that the MTBF is exponentially distributed. You want to test the alternative hypothesis that the mean time between failure is less than 20 years using a 1 sample wilcox.test. The sponsor requires a power analysis as part of the proposal, and you are concerned about the number of samples you might be able to obtain. Use a bootstrap type analysis to obtain the power for a given sample size if the true mean time between failure is 15 years. R can generate exponentially distributed random numbers, but note that the rate input is 1/MTBF. So for example, to generate 100 random values with a MTBF of 20 years, use rexp(100, 1/20). Also note that if you save a hypothesis test to a variable, you can directly access the p value:
x <- rnorm(10,1,3)
z <- wilcox.test(x, mu=2)
z$p.value
So inside each bootstrap loop, you can store each p value from the test. When the loop is over, you can count how many p values are less than α and calculate power. Note that the example above is merely illustrative. Your actual Wilcox test is a 1 one sample, one sided test. (And you should generate exponential random numbers, not normal.)
Hint: If you are comfortable with R coding, you can use a nested loop approach. Outer loop over a range of number of samples; inner loop of bootstrap simulations. Graph the result. If you are less comfortable with R coding, you’ll still need a bootstrap loop but you can try each of the multiple choice answers individually until you find the correct match instead of a nested loop.
If you can only obtain 25 samples, then using an alpha = 0.05, what is your expected power to detect a difference if the true MTBF is actually 15 years? (Select the closest answer.)
a. 0.95
b. 0.80
c. 0.22
d. 0.37
e. 0.70
Solution
my choose:
a. 0.95
