## 1.8 Smoking habits of UK residents

1. what does each row of the data matrix represent?
• Each row of the data matrix represents one resident’s answer to the survey.
1. How many participants were included in the survey?
• There were 1691 participants included in the survey.
1. Indicate whether each variable included in the survey is numerical or categorical . If numerical , identify as continious or discrete. If categorical , Indicate if the variable is ordinal.
• sex - categorical (not ordinal)
• age - numerical (discrete)
• marital - categorical (not ordinal)
• grossIncome - categorical (ordinal)
• smoke - categorical (not ordinal)
• amtWeekends - numerical (discrete)
• amtWeekdays - numerical (discrete)

## 1.10 Cheaters, scope of inference

1. Identify The Population of interest and the sample in this study
• The population of interest is children between the ages of 5 and 15. The sample included 160 children.
1. 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
• I don’t think the results can be generalized to the population because it is within the sample of 160 cases (not a large sample, unknown randomness). We will need more information to determine whether if there are causal relationships (i.e. a particular independent variable has an effect on the dependent variable of interest).

1. Based on this study, can we conclude that smoking causes dementia later in life? Explain your reasoning.
• I don’t think we can conclude that smoking causes dementia because it is unknown if smoking and dementia are causal relationship. Without further information and study, we don’t know if smoking is an independent variable that has effect on dependent variable, dementia.
1. 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?
• This statement is not justified because the converse relationship of sleep disorders and bullying is not neccessary true. The best conclusion that I can draw from this study is that children who are bullies or having behavioral issues are twice as likely to have sleep disorders.

## 1.36 Exercise and mental health

1. What type of study is this?
• This type of study is a randomized experiment.
1. What are the treatment and Control Groups in this study?
• The treatment group consists of half the subjects from each group who exercise twice a week.
• The control groups is the other half who are instructed not to exercise.
1. Does this study make use of blocking? If so, what is the blocking variable?
• Yes, the blocking variable is Age Groups: 18-30, 31-40 and 41-55 years old.
1. Does this experiment use blinding?
• No, this experiment does not use blinding because the control group knows that they are not receiving any treatments.
1. 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 as a whole.
• Since this study is based on stratified random sampling, and then randomly divided into treatment and control group, I would say the conclusions can be generalized to the population as a whole. However, I am not sure if a causal relationship has been established without further information showing that exercise is an independent variable that has effect on mental health.
1. Suppose you are given the task of determining if this proposed study should get funding. Would you have any reservations about the study proposal?
• Yes, I would first want to know if there are proofs to show causal relationship between exercise and mental health.

## 1.48 Stats scores

scores <- c(57, 66, 69, 71, 72, 73, 74, 77, 78, 78, 79, 79, 81, 81, 82, 83, 83, 88, 89, 94)
summary(scores)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
##   57.00   72.75   78.50   77.70   82.25   94.00
boxplot(scores)

## 1.50 Mix-and-match

1. Symmetric, unimodal
1. Symmetric, multimodal
1. Right skewed, unimodal

## 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.
• Right skewed. The median would best represent a typical observaion in the data because the mean might be inflated by the meaningful number of houses that are more than 6 million. The variability of observations would be best represented by IQR here.
1. 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.
• Symmetric. The mean and standard deviation would best represent the data.
1. 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.
• Right skewed. Median and IQR would best represent the data.
1. 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.
• Left skewed. Median and IQR would best represent the data.

## 1.70 Heart transplants

library(openintro)
## Please visit openintro.org for free statistics materials
##
## Attaching package: 'openintro'
## The following objects are masked from 'package:datasets':
##
##     cars, trees
data(heartTr)
head(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
1. Based on the mosaic plot, is survival independent of whether or not the patient got a transplant? Explain your reasoning.
mosaicplot(table(heartTr$transplant, heartTr$survived))

• Based on the mosaic plot, survival is dependent on if patient received a transplant, because treated patients have a higher chance (percentage) of survival.
1. What do the box plots below suggest about the efficacy (effectiveness) of the heart transplant treatment.
boxplot(heartTr$survtime ~ heartTr$transplant)

• Treated patients have more survival time.
1. What proportion of patients in the treatment group and what proportion of patients in the control group died?
sum(heartTr$transplant == "treatment" & heartTr$survived == "dead") / sum(heartTr$transplant == "treatment") ## [1] 0.6521739 • 65.22% of patients in the treatment group died. sum(heartTr$transplant == "control" & heartTr$survived == "dead") / sum(heartTr$transplant == "control")
## [1] 0.8823529
• 88.24% of patients in the control group died.
1. One approach for investigating whether or not the treatment is effective is to use a randomization technique.

2. What are the claims being tested?
• Claims that treatment improves survival rate.
1. 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.
sum(heartTr$survived == "alive") ## [1] 28 sum(heartTr$survived == "dead")
## [1] 75
sum(heartTr$transplant == "treatment") ## [1] 69 sum(heartTr$transplant == "control")
## [1] 34
0.8823529 - 0.6521739
## [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 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 differences in proportions are 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 effectiveness of the transplant program?
• The simulation suggests that the transplant program is effective since the differences is within .10 most of the time.