**AMS597**

- Compute a Monte Carlo estimate of

Compare your estimate with the exact value of the integral.

- We will estimate
*ω*of

using two different approaches:

- Compute a Monte Carlo estimate (ˆ
*ω*) of*ω*by sampling from Uniform(0, 0.5), and estimate the variance of ˆ*ω*. - Compute a Monte Carlo estimate (
*ω*^{∗}) of*ω*by sampling from the exponential distribution, and estimate the variance of*ω*^{∗}. - Compare the two variances. Which one is smaller?

- Write a function to compute a Monte Carlo estimate of the
*Beta*(*a,b*) cdf,*F*(*x*)- by sampling from Uniform(0
*,x*) (name this function pbeta1) - 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 pbeta2) - Use 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.

- by sampling from Uniform(0
- (a) Generate
*X*_{1}*,…,X*_{20 }from*N*(0*,*1). Consider testing*H*_{0 }:*µ*= 0 vs*H*:_{a }*µ*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*.*(Hint: Empirical Type I error is the proportion of wrongly rejected null hypothesis).

(b) Now generate *X*_{1}*,…,X*_{20 }from *N*(0*.*5*,*1). Consider testing *H*_{0 }: *µ *= 0 vs *H _{a }*:

*µ*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.

- (a) Generate
*X*_{1}*,…,X*from_{n }*N*(0*,*1) and*Y*_{1}*,…,Y*from_{n }*N*(0*.*5*,*1*.*5). Consider testing*H*_{0 }:*µ*−_{X }*µ*= 0 vs_{Y }*H*:_{a }*µ*−_{X }*µ*6= 0. Compute the p-value from two sample t-test. Repeat this process 1000 times. Estimate the empirical power for this test at_{Y }*α*= 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.

## Reviews

There are no reviews yet.