1.8 Smoking habits of UK residents.

Each of the row mean an observacion on the survey,we have a total of 1691 row which mean we had 1691 participans. sex(nominal), age(numerical-binary),marital(categorical),gross income(catgorical-ordinal),smoke(categorical),amtWeekends(numerical-discrete),amtweekdays(numerical-discrete)

1.10 Cheaters, scope of inference.

The children between 5-15 were the interst of the population and we a sample of 160. we need bigger example in order to generalize this study to the population and for stablish a casual relationship.

1.28 Reading the paper.

a-No.this is an observacion study they can be many other factor which can affect the person. also just selected people who smoke which is no a good sample where we can compare with people that doesnt smoke. b-no.This is an observation study.kinda confusing which cause what behaviour disoder or sleep disoder?

1.36 Exercise and mental health.

this is an experiemntal study which have half of treament group on 3 blocks age between 18 and 55 and the other half of control group on 3 blocks between 18 and 55. we can use this for casual realtionships.

1.48 Stats scores.

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

1.50 Mix-and-match.

A - 2 Bell shaped/symetric and unimodal B - 3 multimodal C - 1 right skewed and unimodal

1.56 Distributions and appropriate statistics, Part II .

a- right skewed,median,IQR
b- bell Shaped/Symetric,mean,SD
c- bell Shaped/Symetric,median,SD
d- right skewed,median,SD

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
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
summary(heartTr)
##        id          acceptyear         age         survived 
##  Min.   :  1.0   Min.   :67.00   Min.   : 8.00   alive:28  
##  1st Qu.: 26.5   1st Qu.:69.00   1st Qu.:41.00   dead :75  
##  Median : 49.0   Median :71.00   Median :47.00             
##  Mean   : 51.4   Mean   :70.62   Mean   :44.64             
##  3rd Qu.: 77.5   3rd Qu.:72.00   3rd Qu.:52.00             
##  Max.   :103.0   Max.   :74.00   Max.   :64.00             
##                                                            
##     survtime      prior        transplant      wait       
##  Min.   :   1.0   no :91   control  :34   Min.   :  1.00  
##  1st Qu.:  33.5   yes:12   treatment:69   1st Qu.: 10.00  
##  Median :  90.0                           Median : 26.00  
##  Mean   : 310.2                           Mean   : 38.42  
##  3rd Qu.: 412.0                           3rd Qu.: 46.00  
##  Max.   :1799.0                           Max.   :310.00  
##                                           NA's   :34
str(heartTr)
## 'data.frame':    103 obs. of  8 variables:
##  $ id        : int  15 43 61 75 6 42 54 38 85 2 ...
##  $ acceptyear: int  68 70 71 72 68 70 71 70 73 68 ...
##  $ age       : int  53 43 52 52 54 36 47 41 47 51 ...
##  $ survived  : Factor w/ 2 levels "alive","dead": 2 2 2 2 2 2 2 2 2 2 ...
##  $ survtime  : int  1 2 2 2 3 3 3 5 5 6 ...
##  $ prior     : Factor w/ 2 levels "no","yes": 1 1 1 1 1 1 1 1 1 1 ...
##  $ transplant: Factor w/ 2 levels "control","treatment": 1 1 1 1 1 1 1 2 1 1 ...
##  $ wait      : int  NA NA NA NA NA NA NA 5 NA NA ...
mosaicplot(table( heartTr$transplant, heartTr$survived) ,col ="blue")

cat("Proportion of dead of people on treatment is:", sum(heartTr$survived == "dead" & heartTr$transplant == "treatment") / sum(heartTr$transplant == "treatment") * 100)
## Proportion of dead of people on treatment is: 65.21739
cat("Proportion of dead of people on control is:", sum(heartTr$survived == "dead" & heartTr$transplant == "control") / sum(heartTr$transplant == "control") * 100)
## Proportion of dead of people on control is: 88.23529