Chapter 1 - Introduction to Data 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) What does each row of the data matrix represent? (b) How many participants were included in the survey? (c) Indicate whether each variable in the study is numerical or categorical. If numerical, identify as continuous or discrete. If categorical, indicate if the variable is ordinal.

  1. One resident
  2. 1691
  3. Sex=Categorical Age=Numerical(D) Marital status=Categorical GrossIncome=Categorical(Ordinal) Smoke=Categorical amtweekday/weekend=Numerical(Discrete)

1.10 Cheaters, scope of inference. (a) Identify the population of interest and the sample in this study. (b) Comment on whether or not the results of the study can be generalized to the population, and if the findings of the study can be used to establish causal relationships.

  1. 160 Children, ages 5-15
  2. The size of the sample is far too small to generalize for the population. No casual relationship can be established.

1.28 Reading the paper. (a) Based on the reading I can conclude that there is a correlation between smoking and dimentia. There is a relationship betweent he amoubt of packs smoked and dimentia. (b) The statement would not be justified. A more substative finding can be that sleeping disorders are linked with behavioral issues.

1.36 Exercise and mental health. (a) What type of study is this? (b) What are the treatment and control groups in this study? (c) Does this study make use of blocking? If so, what is the blocking variable? (d) Does this study make use of blinding? (e) Comment on whether or not the results of the study can be used to establish a causal relationship between exercise and mental health, and indicate whether or not the conclusions can be generalized to the population at large. (f) Suppose you are given the task of determining if this proposed study should get funding. Would you have any reservations about the study proposal?

  1. Randomized experiment
  2. Controlled=no exercise,Treatment = Excercise
  3. Blocking is used is slection of the age of participants
  4. blinding is not used.
  5. A casual relationship does exist, similar results can be attributed to a larger population.
  6. I would be reserved about blinding not being used in the experimend, Placebo effect impacting findings would be high.

1.48 Stats scores.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.

#Vector
library(ggplot2)

data <- c(57, 66, 69, 71, 72, 73, 74, 77, 78, 78, 79, 79, 81, 81, 82, 83, 83, 88, 89, 94)

scores <- data.frame(scores=data,type=rep("score", length(data)))

#Theme

Themeplot <- theme(axis.ticks=element_blank(),  
                  panel.border = element_rect(color="blue", fill=NA), 
                  panel.background=element_rect(fill="White"), 
                  panel.grid.major.y=element_line(color="white", size=0.1), 
                  panel.grid.major.x=element_line(color="white", size=0.1))
#Boxplot
bp <- ggplot(data=scores, aes(x=type, y=scores)) + 
  Themeplot + 
  geom_boxplot(colour="Black") +
  labs(title="Boxplot of Stats Scores", x="Stats scores", y="Score")
  
bp

1.50 Mix-and-match. Describe the distribution in the histograms below and match them to the box plots.

A=2 (Mid) B=3 (uniform) C=1 (left skew)

1.56 Distributions and appropriate statistics, Part II

  1. 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.
  2. 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.
  3. 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.
  4. 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.

  5. Right Skew, Median would represent a typical observation
  6. No Skew, Data would mean and median would be close.
  7. Left Skew, median would be best representation.
  8. left skew, Higher numnber of employees earning less.

1.70 Heart transplants. (a) Based on the mosaic plot, is survival independent of whether or not the patient got a transplant? Explain your reasoning. (b) What do the box plots below suggest about the efficacy of the heart transplant treatment. (c) What proportion of patients in the treatment group and what proportion of patients in the control group died? (d) One approach for investigating whether or not the treatment is effective is to use a randomization technique.

  1. The mosaic plot shows a greater chance of survival for the treated. The individuals who did not get treatement have a greater chanve of beign dead.
  2. The boxplot shows that the people who receievd treament have a far higher survival time in comparison to the indivduals who did not.

  3. 65% of people in the treatment group died; 88% of people in the control group died.
  1. The claim being tested is the impact of a heart transplant of years gained. ii.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 center at 0. Lastly, we calculate the fraction of simulations where the simulated differences in proportions are at least the difference observed in the study outcome, 24/69 - 4/34 = 0.35 - 0.12 = 0.23. 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.It shows that the program itself is effective.