Chapter 1 - Introduction to Data
Practice: 1.7 (available in R using the data(iris) command), 1.9, 1.23, 1.33, 1.55, 1.69
Graded: 1.8, 1.10, 1.28, 1.36, 1.48, 1.50, 1.56, 1.70 (use the library(openintro); data(heartTr) to load the data)
1.8 Smoking habits of UK residents. A survey was conducted to study the smoking habits of UK residents. Below is a data matrix displaying a portion of the data collected in this survey. Note that “£” stands for British Pounds Sterling, “cig” stands for cigarettes, and “N/A” refers to a missing component of the data.
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 ???ve number summary provided below may be useful.
Min Q1 Q2 (Median) Q3 Max 57 72.5 78.5 82.5 94
Build the scores vector.
scores <- c(57, 66, 69, 71, 72, 73, 74, 77, 78, 78, 79, 79, 81, 81, 82, 83, 83, 88, 89, 94)
Summarize scores.
summary(scores)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 57.00 72.75 78.50 77.70 82.25 94.00
Box plot.
boxplot(scores)
1.50 Mix-and-match. Describe the distribution in the histograms below and match them to the box plots.
unimodal - matches 2 uniform - matches 3 right skewed - matches 1
1.56
1.56 Distributions and appropriate statistics, Part II . 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.
Due mostly to the meaningful number of house above $6m, the data is right skewed and therefore would best be represented by the median and IQR. The non-trivial number of extremely expensive houses would provide a misleading mean - and the IQR. However, it’s important not to neglect the meaningful number of expensive homes, as they might be indicative of other economic issues that should be examined.
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 seems like a great case for mean and standard deviation - this appears to be a symmetric, unimodally distributed housing market.
Number of alcoholic drinks consumed by college students in a given week. Assume that most of these students don’t drink since they are under 21 years old, and only a few drink excessively.
If only a few student under 21 drink execessively, this would likely be a right skewed distribution best represented by the median and IQR. Still, if, say 80% of the drinks are taken by 20% of the students, that asymmetric distribtuion could lead to a misleading depiction of your “average student,” but it’s also probably a big red flag for further study of that high-consuming population.
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.
Right skewed, median/IQR. See 1 and 3 above.
1.70 Heart transplants. 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 ocial heart transplant candidate, meaning that he was gravely ill and would most likely bene???t 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. 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, suvival is associated with treatment - a transplant in this case. A much higher proportion of the students who got transplants lived.
What do the box plots below suggest about the efficacy (e???ectiveness) of the heart transplant treatment.
While there are outliers in the control group with longer survival times, the patients who received transplants had longer survival times.
What proportion of patients in the treatment group and what proportion of patients in the control group died?
Treatment_deaths = 45/69
Treatment_deaths
## [1] 0.6521739
Control
Control_deaths = 30/34
Control_deaths
## [1] 0.8823529
One approach for investigating whether or not the treatment is effective is to use a randomization technique.
i. What are the claims being tested?
ii. 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 79 dead on 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 di???erence 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 di???erences in proportions are .230. 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.
iii. What do the simulation results shown below suggest about the e???ectiveness of the transplant program?
Only three occurrences showed a simulated difference of .20 or greater, which means such a difference is unlikely to have occurred by chance.