$\$

In the following homework, you will gain practice with hypothesis tests for a single proportion. Please submit a compiled pdf with your answers to the exercises to Gradescope by 11pm on Sunday February 25th. Five points will be taken off if you do not mark the pages for each problem on Gradescope.

A list of functions we have used in class can be found on Canvas. You might also find the following symbols useful: $\mu$, $\bar{x}$, $\pi$, $\hat{p}$, $\rho$, $\hat{y}$, $\pm$, and $\approx$, $H_0$ and $H_A$. For full credit on problems involving R, be sure to label all your figures and to "show your work" by making sure all values that are answers to questions are printed/visible in your R Markdown pdf.

As always, if you need help with any of the homework assignments, please attend the TA office hours which are listed on Canvas and/or ask questions on Ed Discussions forum. Also, if you have completed the homework, please help others out by answering questions on Ed Discussions. Finally, reviewing the class slides and videos will be helpful if you run into difficulties.

SDS100::download_image("Lock5_4_19.png")
SDS100::download_image("Lock5_4_15.png")  
SDS100::download_image("Paul_The_Octopus.jpg")  
  options(scipen=999)
  set.seed(100)
  library(SDS100)

$\$

Part 1: Hypothesis test concepts

To gain a better understanding of hypothesis tests, please answer the following questions. For more practice, please see the practice problems in the Lock5 textbook.

$\$

Exercise 1.1 (9 points): Guilty Verdicts in Court Cases A reporter on cnn.com stated in July 2010 that 95% of all court cases that go to trial result in a guilty verdict. To test the accuracy of this claim, we collected a random sample of 2000 court cases that went to trial and recorded the proportion that resulted in a guilty verdict.

a. What is/are the relevant parameters(s)? What sample statistic(s) is/are used to conduct the test?

b. State the null and alternative hypotheses in words and using symbols.

c. We can assess the evidence by considering how likely our sample results would be if $H_0$ was true. What does that mean in this case?

Answers:

a.

b.

c.

$\$

Exercise 1.2 (9 points): Suppose we wanted to test whether the average body temperature of beavers was greater than 37.6 degrees Celsius. In ~2-6 sentences, please state what the population parameter of interest is, and state the null and alternative hypotheses using both words and symbols.

Answers:

$\$

Exercise 1.3 (8 points): Figure 1 shows a null distribution for testing $H_0: \pi = 0.3$ vs $H_A: \pi < 0.3$. In each case, use the distribution to decide which value is closer to the p-value for the observed sample proportion.

a. The p-value for $\hat{p}$ = 0.15 is closest to: 0.04 or 0.40? b. The p-value for $\hat{p}$ = 0.25 is closest to: 0.001 or 0.30? c. The p-value for $\hat{p}$ = 0.35 is closest to: 0.30 or 0.70?

Null distribution for testing $H_0: \pi = 0.3$

Answers:

a. b. c.

$\pagebreak$

Exercise 1.4 (10 points): Dogs and Owners To investigate whether dogs resemble their owners, Roy and Christenfeld conducted a study testing people's ability to pair a dog with its owner. Pictures were taken of 25 owners and their purebred dogs, selected at random from dog parks. Study participants were shown a picture of an owner together with pictures of two dogs (the owner’s dog and another random dog from the study) and asked to choose which dog most resembled the owner. Of the 25 owners, 16 were paired with the correct dog.

To examine whether it is likely that one would get 16 out of 25 owner-dog pairs matched correctly by chance, a null distribution was created by simulating 10,000 times the number of correct dog-owner matches that would occur by chance out of 25 guesses. The results are shown in the table below.

| correct matches | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|-----------------|----|----|----|-----|-----|-----|-----|------|------|
| frequency | 1 | 17 | 54 | 148 | 341 | 599 | 972 | 1302 | 1549 |

| correct matches | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
|-----------------|------|------|-----|-----|-----|-----|----|----|----|
| frequency | 1551 | 1334 | 997 | 612 | 322 | 142 | 51 | 14 | 4 |

We are testing $H_0: \pi = 0.5$ vs. $H_a: \pi > 0.5$ (evidence of dog-owner resemblance). Please answer the following questions:

a. Use the data in the table to verify that the p-value for the observed statistic of 16 correct matches is 0.1145

b. Use the data to calculate a p-value for an observed statistic of 20 correct matches.

c. Use the data to calculate a p-value for an observed statistic of 14 correct matches.

d. Which of the three p-values in parts a) to c) gives the strongest evidence against $H_0$?

e. If any of the p-values in parts a) to c) indicate statistical significance, which ones would it be?

Answers:

a.

b.

c.

d.

e.

$\$

Exercise 1.5 (10 points): A colonoscopy is a screening test for colon cancer, recommended as a routine test for adults over age 50. A new study provides the best evidence yet that this test saves lives. The proportion of people with colon polyps expected to die from colon cancer is 0.01. A sample of 2602 people who had polyps removed during a colonoscopy were followed for 20 years, and 12 of them died from colon cancer. Does this provide evidence that the proportion of people who die from colon cancer after having polyps removed in a colonoscopy is significantly less than the expected proportion (without a colonoscopy) of 0.01?

a. What are the null and alternative hypotheses in words and symbols?

b. What is the sample proportion?

c. Below is a plot of a null distribution for this test. Use the fact that there are 1000 points in this distribution to find the p-value. Explain your reasoning.

Figure 2: A null distribution for testing whether a colonoscopy reduced cancer deaths

Answers:

a.

b.

c.

$\$

Part 2: Running your own hypothesis tests in R

Paul

For the final set of exercises we will examine the soccer prediction record of Paul the Octopus to try to determine if he is psychic. To test Paul's psychic abilities, before each soccer game, two containers of food (mussels) were lowered into the octopus’ tank. The containers were identical, except for country flags of the opposing teams, one on each container. Whichever container Paul opened was deemed his predicted winner. In the 2010 World Cup, Paul (in a German aquarium) became famous for correctly predicting 11 out of 13 soccer games. We will use hypothesis testing to determine the probability that Paul would get 11 out of 13 correct if he was merely guessing.

$\$

Exercise 2.1 (4 points): Please write down the 5 steps for running a hypothesis test. We will use these steps to run an actual hypothesis test in the rest of the problem, but let's just start by writing down what the steps are. You can look at the lecture slides if you need to, although you should memorize these steps soon.

Answer

$\$

Exercise 2.2 (5 points): Now state the null and alternative hypotheses both in words and in the appropriate symbols.

Answer

$\$

Exercise 2.3 (5 points): Compute the statistic of interest and save it in the variable paul_stat. Do you think this statistic is likely to be obtained if Paul was guessing?


Answer:

$\$

Exercise 2.4 (11 points): Now use the do_it() and rflip_count() function to generate a null distribution that would occur if Paul was guessing, and save the results in a variable called null_distribution. Then plot the null distribution, and add a red vertical line to the plot at the observed statistic value using the abline() function.


$\$

Exercise 2.5 (5 points): Next use the objects null_distribution and paul_stat along with the pnull() function to calculate the p-value, which is the proportion of our 10,000 simulations in which we got 11 or more "heads" (i.e., the proportion of simulations in which we got as many or more "heads" than the number of predictions Paul correctly made). Does this p-value provide evidence that Paul is psychic?


Answer:

$\$

Exercise 2.6 (5 points): Make a judgment call as to whether you believe Paul is psychic based on the p-value and any other information you think is relevant. Make sure to justify your answer to explain Paul's prediction abilities.

Answer:

$\$

Exercise 2.7 (9 points): Let's now run a 95% confidence interval for Paul's prediction abilities using the bootstrap method. To start, please write code below to create a bootstrap distribution and then visualize it using a histogram. In the answer section comment on whether this bootstrap distribution looks like a normal distribution.

  # a vector of Paul's answers whether they were correct or incorrect 
  #     (not necessarily in the order of his predictions)
  # 11 correct, 2 incorrect 
  pauls_answers <- c(rep('correct', 11), 'incorrect', 'incorrect')   



  # continue creating the bootstrap distribution from here 

Answer:

$\$

$\$

Exercise 2.8 (6 points): Now calculate the bootstrap standard error (SE*) from the bootstrap distribution you created in part 2.7. Then using this bootstrap standard error, calculate a 95% confidence interval. In the answer section write down what the confidence interval is and whether this seems like it would be a reliable confidence interval.


Answer:

$\$

Reflection (5 points)

Please reflect on how the homework went by going to Canvas, going to the Quizzes link, and clicking on Reflection on homework 5.



emeyers/SDS100 documentation built on April 28, 2024, 5:07 p.m.