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.
Mix-and-match. (2.10, p. 57) Describe the distribution in the histograms below and match them to the box plots.
Histogram 1. The box plot that matches this histogram is 2. The distribution of this data is symetrical and appears to be normally distributed.
Histogram 2. The box plot that matches this histogram is 3. The distribution of this data appears symmetrical but it is not normally distributed.
Histogram 3. The box plot that matches this histogram is 1. The distribution of this data is unimodal and is skewed to the right.
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.
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.
This distribution would be right skewed. The median would be the best to represent a typical observation and the IQR would best represent the variability since there are a number of very expensive houses compared to most of the data set which would shift the mean and standard deviation signfiicantly more.
Housing prices in a country where 25% of the houses cost below $300,000, 50% of the houses cost below $600,000, 75% of the houses cost below $900,000 and very few houses that cost more than $1,200,000.
This distribution would be symmetric since the few expensive houses wouldnt skew the data much, and they are not extraordinarly more expensive than the main data set. The mean and standard deviation would be acceptable to predicte the typical observation and variability since the most expensive houses are not large in number and not extraordinarily more expensive. It appears median and IQR would produce similar results.
Number of alcoholic drinks consumed by college students in a given week. Assume that most of these students dont drink since they are under 21 years old, and only a few drink excessively.
This distribution is right skewed. Since there isnt a significant number of excessive drinkers, median and standard deviation would be good selections. Again, median and IQR would be acceptable in this example as well.
Annual salaries of the employees at a Fortune 500 company where only a few high level executives earn much higher salaries than the all other employees.
As with the housing example (a), there appear to be a few highly outling salaries so the median and IQR should be used.
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.
No, survival appears to depend on whether the patient recieved a transplant or not. The area of those dead seems to be higher significantly from that of the control group and vice versa although the number of patients in the treatment group is higher than that of the control group. This could inturn affect the interpretation of the surival rates for the two groups.
What do the box plots below suggest about the efficacy (effectiveness) of the heart transplant treatment.
The heart transplant treatment seems to increease the survival times in days for the patients.
What proportion of patients in the treatment group and what proportion of patients in the control group died?
Treatment group = 65.22%
Control group = 88.25%
library('openintro')
data('heartTr')
summary('heartTr')
## Length Class Mode
## 1 character character
control_all <- nrow(subset(heartTr, heartTr$transplant == 'control'))
control_dead <- nrow(subset(heartTr, heartTr$transplant == 'control' & heartTr$survived == 'dead'))
proportion_control_dead <- control_dead/control_all
proportion_control_dead
## [1] 0.8823529
treatment_all <- nrow(subset(heartTr, heartTr$transplant == 'treatment'))
treatment_dead <- nrow(subset(heartTr, heartTr$transplant == 'treatment' & heartTr$survived == 'dead'))
proportion_treatment_dead <- treatment_dead/treatment_all
proportion_treatment_dead
## [1] 0.6521739
What are the claims being tested?
We are testing whether or not heart transplants increase the chances of survival.
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.
library('openintro')
data('heartTr')
summary('heartTr')
## Length Class Mode
## 1 character character
all_alive <- nrow(subset(heartTr, heartTr$survived == 'alive'))
all_alive
## [1] 28
all_dead <- nrow(subset(heartTr, heartTr$survived == 'dead'))
all_dead
## [1] 75
treatment_all <- nrow(subset(heartTr, heartTr$transplant == 'treatment'))
treatment_all
## [1] 69
control_all <- nrow(subset(heartTr, heartTr$transplant == 'control'))
control_all
## [1] 34
proportion_treatment_dead - proportion_control_dead
## [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 highly divergent from our calculated/expected value of -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.
# randomization -----------------------------------------------------
diffs <- DATA606::inference(heartTr$survived, heartTr$transplant,
success = "dead", order = c("treatment","control"),
est = "proportion", type = "ht", method = "simulation",
nsim = 100, null = 0, alternative = "twosided", simdist = TRUE,
seed = 95632)
## Response variable: categorical, Explanatory variable: categorical
## Two categorical variables
## Difference between two proportions -- success: dead
## Summary statistics:
## x
## y treatment control Sum
## alive 24 4 28
## dead 45 30 75
## Sum 69 34 103
## Observed difference between proportions (treatment-control) = -0.2302
##
## H0: p_treatment - p_control = 0
## HA: p_treatment - p_control != 0
## p-value = 0.04