(2.33, p. 78)
Below are the final exam scores of twenty introductory statistics students. 57, 66, 69, 71, 72, 73, 74, 77, 78, 78, 79, 79, 81, 81, 82, 83, 83, 88, 89, 94
Create a box plot of the distribution of these scores. The five number summary provided below may be useful.
p <- c(57,66,69,71,72,73,74,77,78,79,81,81,81,83,83,88,89,94)
summary(p)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 57.00 72.25 78.50 77.56 82.50 94.00
a = data.frame(group = "final exam scores", value = c(57,66,69,71,72,73,74,77,78,79,81,81,81,83,83,88,89,94))
boxplot(a$value)
(2.10, p. 57)
Describe the distribution in the histograms below and match them to the box plots.
Solutions:
a.The box plot that matches this histogram is [2], the data is distributed unimodal, symmetric, and appears it could be normally distributed.
b.The box plot that matches this histogram is [3], the data is distributed mayt be symmetric but it does not look normally distributed. It is possible it is uniform but a smaller bin width would have to be selected to see.
c.The box plot that matches this histogram is [1], the data is distributed unimodal and has a right skew.
(2.16, p. 59) For each of the following, state whetheryou expect the distribution to be symmetric, right skewed, or left skewed. Also specify whether the mean or median would best represent a typical observation in the data, and whether the variability of observations would be best represented using the standard deviation or IQR. Explain your reasoning.
Solution: The housing prices in a country where 25% of the houses cost below [$350,000], [50%] of the houses cost below [$450,000], [75%] of the houses cost below [$1,000,000] and there are a meaningful number of houses that cost more than [$6,000,000].
450000 - 350000
## [1] 1e+05
1000000−450000
## [1] 550000
The distribution is right skewed because it seems that there are more data in the right of the distribution as you can see in the intervals between quartiles.
The distribution is right skewed.
(2.26, p. 76)
The Stanford University Heart Transplant Study was conducted to determine whether an experimental heart transplant program increased lifespan. Each patient entering the program was designated an official heart transplant candidate, meaning that he was gravely ill and would most likely benefit from a new heart. Some patients got a transplant and some did not. The variable transplant indicates which group the patients were in; patients in the treatment group got a transplant and those in the control group did not. Of the 34 patients in the control group, 30 died. Of the 69 people in the treatment group, 45 died. Another variable called survived was used to indicate whether or not the patient was alive at the end of the study.
Solution : No, the data indicates survival is dependent on whether the patient recieved a transplant. The control group’s “dead” field seems to be significantly taller than the treatment group, converisely is true for the survival areas.
Solution : The heart transplant treatment significantly increases the survival time for patients. With an upward trend of all control variables
library(openintro)
## Please visit openintro.org for free statistics materials
##
## Attaching package: 'openintro'
## The following objects are masked from 'package:datasets':
##
## cars, trees
data("heartTr")
patient_control_dead <- nrow(subset(heartTr, heartTr$transplant ==
"control" & heartTr$survived == "dead"))
patient_control <- nrow(subset(heartTr, heartTr$transplant ==
"control"))
patient_treatement_dead <- nrow(subset(heartTr, heartTr$transplant ==
"treatment" & heartTr$survived == "dead"))
patient_treatment <- nrow(subset(heartTr, heartTr$transplant ==
"treatment"))
patient_control_dead_ratio <- patient_control_dead/patient_control
patient_treatment_dead_ratio <- patient_treatement_dead/patient_treatment
patient_control_dead_ratio
## [1] 0.8823529
patient_treatment_dead_ratio
## [1] 0.6521739
One approach for investigating whether or not the treatment is effective is to use a randomization technique.
What are the claims being tested?
Solution : The claim being test is whether or not a heart transplant will increase a patient’s expectancy.
patient_alive <- sum(heartTr$survived == "alive")
patient_alive
## [1] 28
patient_dead <- sum(heartTr$survived == "dead")
patient_dead
## [1] 75
patient_treatment
## [1] 69
patient_control
## [1] 34
patient_treatment_dead_ratio - patient_control_dead_ratio
## [1] -0.230179
We write alive on [28] cards representing patients who were alive at the end of the study, and dead on [75] cards representing patients who were not. Then, we shuffle these cards and split them into two groups: one group of size [69] representing treatment, and another group of size [34] representing control. We calculate the difference between the proportion of dead cards in the treatment and control groups (treatment - control) and record this value. We repeat this 100 times to build a distribution centered at [approximately zero]. Lastly, we calculate the fraction of simulations where the simulated differences in proportions are [more extreme than our determined result (-23.02%)]. If this fraction is low, we conclude that it is unlikely to have observed such an outcome by chance and that the null hypothesis should be rejected in favor of the alternative.
Solution : There is at least -23.02% of a difference due the 2% of the time according to the figure. Subsuquentley, a low probability indicates a rare event.