Re-write the code from the organ donors example from class to
For reference, here is the organ donors example:
People providing an organ for donation sometimes seek the help of a special “medical consultant”. These consultants assist the patient in all aspects of the surgery, with the goal of reducing the possibility of complications during the medical procedure and recovery. Patients might choose a consultant based in part on the historical complication rate of the consultant’s clients.
One consultant tried to attract patients by noting that the average complication rate for liver donor surgeries in the US is about 10%, but her clients have only had 3 complications in the 62 liver donor surgeries she has facilitated. She claims this is strong evidence that her work meaningfully contributes to reducing complications (and therefore she should be hired!).
and here is the code we developed in class:
sim_dist <- data.frame(p_hat_sim = rep(NA, 100))
for (i in 1:100){
sim <- sample(outcomes, size = 62, prob = c(0.1, 0.9), replace = TRUE)
p_hat_sim <- sum(sim == "complication") / length(sim)
sim_dist$p_hat_sim[i] <- p_hat_sim
}
ggplot(sim_dist, aes(x = p_hat_sim)) +
geom_dotplot()A September 2015 Pew Research report states
The latest national poll by the Pew Research Center, conducted Sept. 22-27 among 1,502 adults, finds that 60% say that any budget deal must maintain funding for Planned Parenthood, while 32% say that any agreement must eliminate funding for the organization.
The title of this report is “Majority Says Any Budget Deal Must Include Planned Parenthood Funding”.
Do these data provide convincing (statistically significant) evidence for this title?
Answer this question using the code you developed in the previous exercises with as little modification as possible. As you are working on this exercise, you might find that you need to go back and improve your code to eliminate hardcoded objects.
As usual, report a p-value and state your conclusion in context of the data and the research question. Once again, use inline R code for incorporating the p-value in the text.
Your submission should be an R Markdown file in your (new) team App Ex repo, in a folder called AppEx_06.
Tuesday, Oct 20, begginning of class
… merge conflics on GitHub – you’re working in the same repo now!
Issues will arise, and that’s fine! Commit and push often, and ask questions when stuck.