**AMS597**

- Compute a Monte Carlo estimate of

Compare your estimate with the exact value of the integral.

- We will estimate

using two different approaches:

- Compute a Monte Carlo estimate () of
- Compute a Monte Carlo estimate (
^{}) 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 }:*H*:_{a }*.*(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 }*.*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.