library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.3.6      ✔ purrr   0.3.4 
## ✔ tibble  3.1.8      ✔ dplyr   1.0.10
## ✔ tidyr   1.2.1      ✔ stringr 1.4.1 
## ✔ readr   2.1.2      ✔ forcats 0.5.2 
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
library(openintro)
## Loading required package: airports
## Loading required package: cherryblossom
## Loading required package: usdata

Quiz 2

Question 1

COHb <- c(6.4, 2.6, 3.5, 2.9, 3.9, 2.2, 5.5, 4.4, 3.5, 3.2, 2.8, 2.4, 3.5, 3.3, 
3.7, 2.6, 3.5, 4.5, 4.2, 2.9, 3.1, 3.3, 4.3, 2.6, 4.1, 3.7)

1a

mean(COHb)
## [1] 3.561538

The statistical symbol for mean is x- or y-bar

median(COHb)
## [1] 3.5

The statistical symbol is x- or y-tilde

sd(COHb)
## [1] 0.9533423

The statistical symbol for sd is lowercase s

summary(COHb)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   2.200   2.900   3.500   3.562   4.050   6.400
iqr <- 4.050-2.900

iqr = 1.15

lowerfence <- 2.900-1.5*iqr

lowerfence = 1.175

upperfence <- 4.050+1.5*iqr

upperfence = 5.775

1b

boxplot(COHb, main = "blood hemoglobin bound to carbon monoxide in women who smoke", 
        ylab = "percent increase")

1c

hist(COHb)

Question 2

Estriol <- c(7, 9, 17, 12, 14, 16, 18, 14, 16, 20, 17, 19, 21, 24, 15)
Birthweight <- c(25, 25, 32, 27, 27, 27, 35, 30, 30, 38, 30, 31, 30, 28, 32)
Number <- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15)
Estriol <- c(7, 9, 17, 12, 14, 16, 18, 14, 16, 20, 17, 19, 21, 24, 15)
Birthweight <- c(25, 25, 32, 27, 27, 27, 35, 30, 30, 38, 30, 31, 30, 28, 32)
women <- data.frame(Number, Estriol, Birthweight)
ggplot(data = women, aes(x = Estriol, y = Birthweight)) + 
  geom_point() +
  geom_smooth(method = lm)
## `geom_smooth()` using formula 'y ~ x'

Question 3

  1. The median is right around 40 and there is an outlier greater than 60. This boxplot most closely aligns with the data on the histogram.