Stats scores. (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.
Answer:
scores <- c(57, 66, 69, 71, 72, 73, 74, 77, 78, 78, 79, 79, 81, 81, 82, 83, 83, 88, 89, 94)
boxplot(scores, main="Boxplot: Final Exam Scores of Twenty Introductory Statistics Students", horizontal = TRUE)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 57.00 72.75 78.50 77.70 82.25 94.00
Mix-and-match. (2.10, p. 57) Describe the distribution in the histograms below and match them to the box plots.
Answer:
1) Histogram (a) and box plot (2) are matched. The histogram is bell shaped. The distribution is symmetrical with a peak at center and similar length of tails on both sides. The center is at around 60.
2) Histogram (b) and box plot (3) are matched. The histogram is rectangle shaped. The distribution is symmetrical with center value at around 50.
3) Histogram (c) and box plot (1) are matched. The histogram is with a long tail at the right side. The distribution is right skewed with center balue at around 1.
Distributions and appropriate statistics, Part II. (2.16, p. 59) For each of the following, state whether you 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.
Answer:
(a) The distribution of this scenario is expected to be right skewed because Q2-Q1 significantly less than Q3-Q2. The median would best represent a typical ovservation in the data because there are a meaningful number of outliners of which the amounts are significantly greater than mean and the mean is more likely to be affected by outliners than medium. IQR is the better than standard deviation to represented the variability of observations becuase it is less affected by outliners as well.
(b) The distribution of this scenario is expected to be symmetrical because Q2-Q1 = Q3-Q2, and few outliners exist. As the distribution is expected to be symmertrical, the mean is expected to be better than medium to represent a typical observation in the data because mean is better representing central tendency when distribution is symmerical. The standard deviation is better than IQR to represent the variability of observations for the same reason.
(c) The distribution of this scenario is expected to be right skewed because the left tail is truncated due to context limitation (numbers of drinks consumed sharply dropped for students under 21). The median would be better and mean to represent a typical ovservation in the data and IQR is the better than standard deviation to represented the variability of observations becuase they are less affected by skewed distribution.
(d) The distribution of this scenario is expected to be symmetrical with a few outliners are with values significantly higher than mean. In this case median would be better than mean to represent a typical observation in the data as mean can be significantly affected by the outliners. The IQR is better than standard deviation to represent the variability of observations as well for the same reason.
Heart transplants. (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.
Based on the mosaic plot, is survival independent of whether or not the patient got a transplant? Explain your reasoning.
Answer:
Based on the mosaic plot, survival is not independent of whetther or not the patiend got a transplant. The plot shows that paients who got a transplants tend to survive longer than those who didn’t.
What proportion of patients in the treatment group and what proportion of patients in the control group died?
answer:
65.32% of patiens in the treatment group and 88.24% of patients in the control group died.
died_treatment <- subset(heartTr, heartTr$survived == "dead" & heartTr$transplant == "treatment")
died_control <-subset(heartTr, heartTr$survived == "dead" & heartTr$transplant == "control")
treatment<- subset(heartTr, heartTr$transplant == "treatment")
control <-subset(heartTr, heartTr$transplant == "control")
nrow(died_treatment)/nrow(treatment)
## [1] 0.6521739
## [1] 0.8823529
What are the claims being tested?
Answer:
The goal is to test whether heart transplant treatment increases lifespan.
The null hypothesis is: the heart transplant treatment has no effect on increasing lifespan.
The alternative hypothesis is: the heart transplant treatment has effect on increasing lifespan.
The paragraph below describes the set up for such approach, if we were to do it without using statistical software. Fill in the blanks with a number or phrase, whichever is appropriate.
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 0. Lastly, we calculate the fraction of simulations where the simulated differences in proportions are 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.
## id acceptyear age survived
## Min. : 1.0 Min. :67.00 Min. : 8.00 alive:28
## 1st Qu.: 26.5 1st Qu.:69.00 1st Qu.:41.00 dead :75
## Median : 49.0 Median :71.00 Median :47.00
## Mean : 51.4 Mean :70.62 Mean :44.64
## 3rd Qu.: 77.5 3rd Qu.:72.00 3rd Qu.:52.00
## Max. :103.0 Max. :74.00 Max. :64.00
##
## survtime prior transplant wait
## Min. : 1.0 no :91 control :34 Min. : 1.00
## 1st Qu.: 33.5 yes:12 treatment:69 1st Qu.: 10.00
## Median : 90.0 Median : 26.00
## Mean : 310.2 Mean : 38.42
## 3rd Qu.: 412.0 3rd Qu.: 46.00
## Max. :1799.0 Max. :310.00
## NA's :34
## [1] -0.230179
\begin{center} \end{center}