# Homework 4

Due 2020-09-30 by midnight.

Note that most problems have a ".ext" file extensions for the deliverable. This implies that you can use R or Python to solve the problem. For this assignment each problem that you submit code for, 3 points will be awarded for completing the project entirely on the server. This will give you practice dealing with coding and testing in that environment. For each of the problems, add a comment at the top stating if it was done entirely on the server or if Rstudio or any other IDE was used. There is no plotting or pdf's involved, so that should make it easier.
1. Study Chapters 16-18 of Shotts.
2. Study Chapters 9, 11, & 21 of Jones, Maillardet, & Robinson.
3. This part of the homework will give you experience implementing Monte Carlo power calculations. Download the urn.R or urn.py file for our recent lecture. Add code at the bottom to answer the following: 1. If the level of significance is 0.05, what is the rejection region for this problem? 2. If the true proportion of black balls is 0.6, what is the power of the test for the null hypothesis that the proportion of black balls is 0.5, versus the one-side alternative that the proportion is greater than 0.5? 3. What is the power if the true proportion is 0.7? In answering these questions, be sure to assess the Monte Carlo error.
4. Using the hit-and-miss method, find the area defined by the region {(x,y): x^2 + y^2 ≤ 0.5, x^2 ≤ y ≤ x }. As always, assess your Monte Carlo error. Submit your solution in a file named "area.ext"
5. Using Monte Carlo integration, find the integral of the function f(x) = 1-2/pi*(1-x)^2*exp(x)/x*asin(sqrt(x)) for x in [0,1]. Be more creative that simply sampling from the uniform distribution. As always, assess your Monte Carlo error. Submit your solution in a file named "integral.ext"
6. 42 statistics masters students go through a maze to conduct an experiment on growth and development. The researchers note that statistics undergraduates complete the maze 80% of the time. They hypothesize that college students will have a different failure rate, regardless of the direction of the difference. Suppose that 29 student complete the maze (the ones that didn't had too much homework). Determine the p-value for the observed data as well as the size and power of this test using Monte Carlo integration. For finding power, assume an alternative hypothesis of a completion rate of 60%. Submit your code to solve the problem as "maze.ext"
7. Submit this homework by committing the necessary files (including any data files) in the appropriate directory and pushing to your central Git repository. Remember to not commit files that are easily reproducible.