library(tidyverse)
library(openintro)

Stats Scores

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

Mix and Match

(a). This histogram is symmetrical, unimodal and normally distributed. It matches to boxplot 2. (b). This histogram appears symmetrical and unimodal?, it would benefit from some data transformation to better see the info. It matches boxplot 3. (c) This histogram is unimodal, skewed to the right and matches boxplot 1.

Distributions and appropiate statistics

  1. The distribution would be right-skewed. Based on most of the prices costing below 1 million and some houses being over 6 million. The median and the IQR would best represent a typical observation of the data by not being as susceptible to the variability of the outliers.

  2. The distribution would be symmetrical. The mean and the standard deviation would better serve us in this case as we would have a normal distribution.

  3. This distribution would be symmetric, the mean and the standard deviation should be sufficient.

  4. This distribution would be right-skewed, the median and the IQR would allow us to better represent the observations and the variability of the higher salaries.

Heart transplants

  1. Based on the mosaic plot, it would appear that survival is not independent of treatment. Patients that got a transplant appear to have survived in a greater percentage than those in the control group.

  2. The box plots suggest that the heart transplant treatment is very effective in extending the survival times.

controlAvg <- (30/34)*100
treatmentAvg <- (45/69) * 100

controlAvg 
## [1] 88.23529
treatmentAvg
## [1] 65.21739
  1. About 88% of the patients in the control group died, compared to 65% in the treatment group.

  2. We are testing if a heart transplant will increase a patient’s lifespan.

  1. We write alive on 28 cards… and dead on 75 cards…. two groups one of size: 69 representing treatment and another of size: 34 representing control. Not sure how to do the rest….
  2. The simulated differences being so little, imply that the transplant program is indeed effective.
LS0tDQp0aXRsZTogIkRTNjA2LUhXMiINCmF1dGhvcjogIkdlb3JnZSBDcnV6Ig0KZGF0ZTogImByIFN5cy5EYXRlKClgIg0Kb3V0cHV0OiBvcGVuaW50cm86OmxhYl9yZXBvcnQNCi0tLQ0KDQpgYGB7ciBsb2FkLXBhY2thZ2VzLCBtZXNzYWdlPUZBTFNFfQ0KbGlicmFyeSh0aWR5dmVyc2UpDQpsaWJyYXJ5KG9wZW5pbnRybykNCmBgYA0KDQojIyMgU3RhdHMgU2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