$35
1. Compute a Monte Carlo estimate of
Compare your estimate with the exact value of the integral.
2. We will estimate ω of
using two different approaches:
(a) Compute a Monte Carlo estimate (ˆω) of ω by sampling from Uniform(0, 0.5), and estimate the variance of ˆω.
(b) Compute a Monte Carlo estimate (ω∗) of ω by sampling from the exponential distribution, and estimate the variance of ω∗.
(c) Compare the two variances. Which one is smaller?
3. Write a function to compute a Monte Carlo estimate of the Beta(a,b) cdf, F(x)
(a) by sampling from Uniform(0,x) (name this function my.pbeta1)
(b) by sampling from U ∼ Gamma(a,1) and V ∼ Gamma(b,1) and using the result that Y = U/(U + V ) ∼ Beta(a,b) (name this function my.pbeta2)
(c) Use my.pbeta1 and my.pbeta2 to estimate F(x) of Beta(3,3) for x = 0.1,0.2,...,0.9. Compare the estimates with the values returned by the pbeta function in R.
4. (a) Generate X1,...,X20 from N(0,1). Consider testing H0 : µ = 0 vs Ha : µ 6= 0. Compute the p-value from (1) one sample t-test and (2) exact wilcoxon signed rank test. Repeat this process 1000 times. Estimate the empirical Type I error for both tests at α = 0.05. (Hint: Empirical Type I error is the proportion of wrongly rejected null hypothesis).
(b) Now generate X1,...,X20 from N(0.5,1). Consider testing H0 : µ = 0 vs Ha : µ 6= 0. Compute the p-value from (1) one sample t-test and (2) exact wilcoxon signed rank test. Repeat this process 1000 times. Estimate the empirical power for both tests at α = 0.05.
5. (a) Generate X1,...,Xn from N(0,1) and Y1,...,Yn from N(0.5,1.5). Consider testing H0 : µX − µY = 0 vs Ha : µX − µY 6= 0. Compute the p-value from two sample t-test. Repeat this process 1000 times. Estimate the empirical power for this test at α = 0.05 for n = 10,20,30,...,100. Based on your plot, what is the minimum sample size to achieve power 80%.
(b) Edit: You do not need to show how the formula is derived. An approximate sample size formula for comparing two population means using z-test for the hypothesis in (a) is
Compare your results in (a) to this sample size formula.