Chapter 1 - Introduction to Data Graded: 1.8, 1.10, 1.28, 1.36, 1.48, 1.50, 1.56, 1.70

library(openintro)
## Please visit openintro.org for free statistics materials
## 
## Attaching package: 'openintro'
## The following objects are masked from 'package:datasets':
## 
##     cars, trees
library(ggplot2)
## 
## Attaching package: 'ggplot2'
## The following object is masked from 'package:openintro':
## 
##     diamonds

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.

No. sex age marital grossIncome smoke amtWeekends amtWeekdays 1 Female 42 Single Under£2,600 Yes 12 cig/day 12 cig/day 2 Male 44 Single £10,400 to £15,600 No N/A N/A 3 Male 53 Married Above£36,400 Yes 6 cig/day 6 cig/day . . . . . . . . 1691 Male 40 Single £2,600 to £5,200 Yes 8 cig/day 8 cig/day

  1. What does each row of the data matrix represent? Answer: Each row is a sample data for particular participant.

  2. How many participants were included in the survey? Answer: 1961 participants

  3. 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. Answer: sex - categorical age - discrete numeric marital - categorical grossIncome - categorical - ordinal smoke - categorical amtWeekends - Discrete numeric amtWeekdays - Discrete numeric

1.10 Cheaters, scope of inference. Exercise 1.5 introduces a study where researchers studying the relationship between honesty, age, and self-control conducted an experiment on 160 children between the ages of 5 and 15. The researchers asked each child to toss a fair coin in private and to record the outcome (white or black) on a paper sheet, and said they would only reward children who report white. Half the students were explicitly told not to cheat and the others were not given any explicit instructions. Di???erences were observed in the cheating rates in the instruction and no instruction groups, as well as some differences across children’s characteristics within each group.

  1. Identify the population of interest and the sample in this study. Answer: Population of interest: children age between 5 and 15 Sample size: 160

  2. 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. Answer: This looks like an experiment and not observational study so the study can be generalized to the population, and the findings of the study can be used to establish causal relationships.

1.28 Reading the paper. Below are excerpts from two articles published in the NY Times: (a) An article titled Risks: Smokers Found More Prone to Dementia states the following:61 “Researchers analyzed data from 23,123 health plan members who participated in a voluntary exam and health behavior survey from 1978 to 1985, when they were 50-60 years old. 23 years later, about 25% of the group had dementia, including 1,136 with Alzheimer’s disease and 416 with vascular dementia. After adjusting for other factors, the researchers concluded that pack-aday smokers were 37% more likely than nonsmokers to develop dementia, and the risks went up with increased smoking; 44% for one to two packs a day; and twice the risk for more than two packs.”

Based on this study, can we conclude that smoking causes dementia later in life? Explain your reasoning.

Answer: Based on the study we can conclude that smoking may causes dementia later in life. Reason: We can see that smoking and dementia are corelatted.

  1. Another article titled The School Bully Is Sleepy states the following:62 “The University of Michigan study, collected survey data from parents on each child’s sleep habits and asked both parents and teachers to assess behavioral concerns. About a third of the students studied were identified by parents or teachers as having problems with disruptive behavior or bullying. The researchers found that children who had behavioral issues and those who were identified as bullies were twice as likely to have shown symptoms of sleep disorders.” A friend of yours who read the article says, “The study shows that sleep disorders lead to bullying in school children.” Is this statement justified? If not, how best can you describe the conclusion that can be drawn from this study?

Answer: The statement is not justified. Reason: We do not have enough information about the other factors.

1.36 Exercise and mental health. A researcher is interested in the e???ects of exercise on mental health and he proposes the following study: Use stratified random sampling to ensure representative proportions of 18-30, 31-40 and 41- 55 year olds from the population. Next, randomly assign half the subjects from each age group to exercise twice a week, and instruct the rest not to exercise. Conduct a mental health exam at the beginning and at the end of the study, and compare the results.

  1. What type of study is this? Answer: Experiment study

  2. What are the treatment and control groups in this study? Answer: Treatment groups: 50% Subject from each age group to exercise twice a week Control groups:Rest not to exercise

  3. Does this study make use of blocking? If so, what is the blocking variable? Answer: Yes, blocking is used on age as 18-30, 31-40 and 41- 55 year olds

  4. Does this study make use of blinding? Answer: No blinding is not used.

  5. 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. Answer: Yes, causal relationship between exercise and mental health.Yes,sampling is representative of all age groups.

  6. Suppose you are given the task of determining if this proposed study should get funding.Would you have any reservations about the study proposal? Answer: No reservations, this looks like a good study. Suggestion: Bais can be romoved if we use blinding.

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. The five number summary provided below may be useful. Min Q1 Q2 (Median) Q3 Max 57 72.5 78.5 82.5 94

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)

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

Answer:

a <- 2 b <- 3 c <- 1

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.

  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. Answer: Left skewed median:as distribution is not symmetric; IQR: because of outlier and IQR can handle the outlier effectively.

  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. Answer: symmetric Mean as data distribution is symmetric Standar deviation as there is no outlier effect

  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. Answer: Right skewed median:as distribution is not symmetric; IQR: because of outlier and IQR can handle the outlier effectively.

  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. Answer: Left skewed median:as distribution is not symmetric; IQR: because of outlier and IQR can handle the outlier effectively.

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 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. Another variable called survived was used to indicate whether or not the patient was alive at the end of the study.

  1. Based on the mosaic plot, is survival independent of whether or not the patient got a transplant? Explain your reasoning. Answer: Survival is NOT independent of whether or not the patient got a transplant.

  2. What do the box plots below suggest about the efficacy (e???ectiveness) of the heart transplant treatment. Answer: Patients receiving treatment have survived more than who were in control group.

  3. What proportion of patients in the treatment group and what proportion of patients in the control group died? Answer:

data(heartTr)
table(heartTr$survived)
## 
## alive  dead 
##    28    75
heartTr
##      id acceptyear age survived survtime prior transplant wait
## 1    15         68  53     dead        1    no    control   NA
## 2    43         70  43     dead        2    no    control   NA
## 3    61         71  52     dead        2    no    control   NA
## 4    75         72  52     dead        2    no    control   NA
## 5     6         68  54     dead        3    no    control   NA
## 6    42         70  36     dead        3    no    control   NA
## 7    54         71  47     dead        3    no    control   NA
## 8    38         70  41     dead        5    no  treatment    5
## 9    85         73  47     dead        5    no    control   NA
## 10    2         68  51     dead        6    no    control   NA
## 11  103         67  39     dead        6    no    control   NA
## 12   12         68  53     dead        8    no    control   NA
## 13   48         71  56     dead        9    no    control   NA
## 14  102         74  40    alive       11    no    control   NA
## 15   35         70  43     dead       12    no    control   NA
## 16   95         73  40     dead       16    no  treatment    2
## 17   31         69  54     dead       16    no    control   NA
## 18    3         68  54     dead       16    no  treatment    1
## 19   74         72  29     dead       17    no  treatment    5
## 20    5         68  20     dead       18    no    control   NA
## 21   77         72  41     dead       21    no    control   NA
## 22   99         73  49     dead       21    no    control   NA
## 23   20         69  55     dead       28    no  treatment    1
## 24   70         72  52     dead       30    no  treatment    5
## 25  101         74  49    alive       31    no    control   NA
## 26   66         72  53     dead       32    no    control   NA
## 27   29         69  50     dead       35    no    control   NA
## 28   17         68  20     dead       36    no    control   NA
## 29   19         68  59     dead       37    no    control   NA
## 30    4         68  40     dead       39    no  treatment   36
## 31  100         74  35    alive       39   yes  treatment   38
## 32    8         68  45     dead       40    no    control   NA
## 33   44         70  42     dead       40    no    control   NA
## 34   16         68  56     dead       43    no  treatment   20
## 35   45         71  36     dead       45    no  treatment    1
## 36    1         67  30     dead       50    no    control   NA
## 37   22         69  42     dead       51    no  treatment   12
## 38   39         70  50     dead       53    no  treatment    2
## 39   10         68  42     dead       58    no  treatment   12
## 40   35         71  52     dead       61    no  treatment   10
## 41   37         70  61     dead       66    no  treatment   19
## 42   68         72  45     dead       68    no  treatment    3
## 43   60         71  49     dead       68    no  treatment    3
## 44   62         71  39     dead       69    no    control   NA
## 45   28         69  53     dead       72    no  treatment   71
## 46   47         71  47     dead       72    no  treatment   21
## 47   32         69  64     dead       77    no  treatment   17
## 48   65         72  51     dead       78    no  treatment   12
## 49   83         73  53     dead       80    no  treatment   32
## 50   13         68  54     dead       81    no  treatment   17
## 51    9         68  47     dead       85    no    control   NA
## 52   73         72  56     dead       90    no  treatment   27
## 53   79         72  53     dead       96    no  treatment   67
## 54   36         70  48     dead      100    no  treatment   46
## 55   32         71  41     dead      102    no    control   NA
## 56   98         73  28    alive      109    no  treatment   96
## 57   87         73  46     dead      110    no  treatment   60
## 58   97         73  23    alive      131    no  treatment   21
## 59   37         71  41     dead      149    no    control   NA
## 60   11         68  47     dead      153    no  treatment   26
## 61   94         73  43     dead      165   yes  treatment    4
## 62   96         73  26    alive      180    no  treatment   13
## 63   90         73  52     dead      186   yes  treatment  160
## 64   53         71  47     dead      188    no  treatment   41
## 65   89         73  51     dead      207    no  treatment  139
## 66   24         69  51     dead      219    no  treatment   83
## 67   27         69   8     dead      263    no    control   NA
## 68   93         73  47    alive      265    no  treatment   28
## 69   51         71  48     dead      285    no  treatment   32
## 70   67         73  19     dead      285    no  treatment   57
## 71   16         68  49     dead      308    no  treatment   28
## 72   84         73  42     dead      334    no  treatment   37
## 73   91         73  47     dead      340    no    control   NA
## 74   92         73  44    alive      340    no  treatment  310
## 75   58         71  47     dead      342   yes  treatment   21
## 76   88         73  54    alive      370    no  treatment   31
## 77   86         73  48    alive      397    no  treatment    8
## 78   82         71  29    alive      427    no    control   NA
## 79   81         73  52    alive      445    no  treatment    6
## 80   80         72  46    alive      482   yes  treatment   26
## 81   78         72  48    alive      515    no  treatment  210
## 82   76         72  52    alive      545   yes  treatment   46
## 83   64         72  48     dead      583   yes  treatment   32
## 84   72         72  26    alive      596    no  treatment    4
## 85   71         72  47    alive      630    no  treatment   31
## 86   69         72  47    alive      670    no  treatment   10
## 87    7         68  50     dead      675    no  treatment   51
## 88   23         69  58     dead      733    no  treatment    3
## 89   63         71  32    alive      841    no  treatment   27
## 90   30         69  44     dead      852    no  treatment   16
## 91   59         71  41    alive      915    no  treatment   78
## 92   56         71  38    alive      941    no  treatment   67
## 93   50         71  45     dead      979   yes  treatment   83
## 94   46         71  48     dead      995   yes  treatment    2
## 95   21         69  43     dead     1032    no  treatment    8
## 96   49         71  36    alive     1141   yes  treatment   36
## 97   41         70  45    alive     1321   yes  treatment   58
## 98   14         68  53     dead     1386    no  treatment   37
## 99   26         69  30    alive     1400    no    control   NA
## 100  40         70  48    alive     1407   yes  treatment   41
## 101  34         69  40    alive     1571    no  treatment   23
## 102  33         69  48    alive     1586    no  treatment   51
## 103  25         69  33    alive     1799    no  treatment   25
table(heartTr$transplant)
## 
##   control treatment 
##        34        69
table(heartTr$survived, heartTr$transplant)
##        
##         control treatment
##   alive       4        24
##   dead       30        45
prop.table(table(heartTr$survived, heartTr$transplant))
##        
##            control  treatment
##   alive 0.03883495 0.23300971
##   dead  0.29126214 0.43689320

So, the proportion of patients died in the treatment group are less than in the control gorup.

  1. One approach for investigating whether or not the treatment is e???ective is to use a randomization technique.
  1. What are the claims being tested? Answer: If treatment is effective or control

  2. 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 less than or equal to -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.

  1. What do the simulation results shown below suggest about the efectiveness of the transplant program? Answer: The simulation results suggest that the transplant program is effective, and that the result is unlikely to have occured just due to chance.