Background

Lead is a heavy metal that can cause a variety of symptoms when it enters the human body. Lead interferes with the development of the nervous system and can cause headaches, confusion, irritability, and in severe cases, seizures, comas, and death. Lead has also been linked to learning and behavioral disorders. Lead can enter the human body through contaminated air, food, water, soil, or in manufactured products such as paint. To this end, the Centers for Disease Control (CDC) have set the acceptable level of lead to 10 micrograms/dL.

Getting started

Load the packages.

library(psych) #good for describing continuous vars
library(tidyverse) #for ggplot and data wrangling stuff 
library(skimr) #good for describing all var types
library(janitor) #really good for describing categories types 
library(readxl) # reading in excel format files
library(lubridate) # helps manipulate date and time variables

The Data

The leadiq_final is a dataset shows the results of a fictitious study of children born and raised in a town near a lead smelter. The blood levels of lead (BLL) and IQs of the children were all measured at different ages (in years), over a few months in 2009.

Hypothesis - Say we want to test the hypothesis that higher lead levels in blood are associated with decreased IQ among children living near a lead smelting plant. Secondarily, we want to explore if this effect is consistent across different age groups.

Pre-Analysis Questions

QUESTION #1

Given the information in the background, how were children living near the lead processing plant most likely exposure to the metal?

Children living near a lead smelting plant would have been exposed through inhalation of the plant’s lead fumes and ingestion of the airborne lead that settles onto nearby surfaces. They could also be exposed by eating food grown in contaminated soil near the plant. As well as water, if lead particles contaminated local water sources.

QUESTION #2

Name two possible routes of exposure.

Two possible routes of exposure would be inhalation of contaminated air released through the factory and Ingestion of contaminated dust, food, or water by contaminated land nearby the plant.

QUESTION #3

BLL provides a measurable indicator of lead’s impact on the body. What type of exposure assessment measure is BLL?

BLL is a Biomarker, meaning it will measure the amount of lead in the body’s blood.

QUESTION #4

What other hypothesis can you form with this information? (no wrong answers here, just consider your PICO and Hill Criteria)

Younger children will have a stronger negative association between blood lead level and IQ than older children, due to greater neurological vulnerability at a young age.

QUESTION #5

In our primary study [~ line 36 above], what would be considered the exposure and outcome variables? The exposure (independent) variable is selected or controlled as part of the study. The outcome (dependent) variable is measured or observed as a result of the exposure variable.

Exposure (independent) variable is Blood lead level and the Outcome (dependent) variable would be the IQ level of the children.

Data Analysis

Upload the data:

leadiq_final <-  read.csv("leadiq_final.csv")
# Be sure to also view characteristics of the dataset, including variable names, classes
names(leadiq_final)
## [1] "age"   "bll"   "iq"    "month"
skim(leadiq_final)
Data summary
Name leadiq_final
Number of rows 460
Number of columns 4
_______________________
Column type frequency:
character 1
numeric 3
________________________
Group variables None

Variable type: character

skim_variable n_missing complete_rate min max empty n_unique whitespace
month 0 1 3 3 0 5 0

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
age 0 1 5.19 2.83 1.00 3.00 5.00 7.00 9.00 ▇▆▇▇▇
bll 0 1 17.36 7.68 3.81 11.27 16.76 23.03 36.16 ▆▇▇▅▂
iq 0 1 104.65 4.17 96.23 101.20 104.50 108.63 113.50 ▅▇▇▇▃

Exercise 1. Create New Variables within Existing Dataset

Create a new variable in the leadiq_final dataset called season that uses the month variable to create seasons (hint: use mutate function).

leadiq_final <- leadiq_final %>%
  mutate(
    season = ifelse(month == "Feb", "Winter",
             ifelse(month == "Mar", "Spring",
             ifelse(month == "Apr", "Spring",
             ifelse(month == "May", "Spring",
             ifelse(month == "Jun", "Summer", "Fall"))))))
  
leadiq_final$season <- factor(
  leadiq_final$season,
  levels = c("Winter", "Spring", "Summer", "Fall")
)

tabyl(leadiq_final, month, season)
##  month Winter Spring Summer Fall
##    Apr      0     83      0    0
##    Feb     85      0      0    0
##    Jun      0      0     94    0
##    Mar      0     68      0    0
##    May      0    130      0    0

Exercise 2. Creating New Dataset using Subset of Existing Dataset

Create 2 new datasets based on age categories: one for children ≤ median age and one for children > median age

# new datasets
median_age <- median(leadiq_final$age, na.rm = TRUE)
print(paste("Median Age:", median_age))
## [1] "Median Age: 5"
children_below_median <- leadiq_final %>%
  filter(age <= median_age)

children_above_median <- leadiq_final %>%
  filter(age > median_age)

children_above_median
##     age   bll     iq month season
## 1     9  5.18 110.57   Feb Winter
## 2     9  5.64 109.68   Feb Winter
## 3     9  5.65 108.83   Feb Winter
## 4     9  5.83 110.45   Feb Winter
## 5     9  5.86 111.45   Feb Winter
## 6     9  5.86 110.34   Feb Winter
## 7     9  5.89 109.28   Feb Winter
## 8     9  6.14 108.54   Feb Winter
## 9     9  6.24 110.38   Feb Winter
## 10    9  6.32 110.49   Feb Winter
## 11    7  6.50 108.48   Feb Winter
## 12    9  6.52 110.29   Feb Winter
## 13    9  6.61 110.25   Feb Winter
## 14    9  6.63 108.26   Feb Winter
## 15    9  6.87 111.02   Feb Winter
## 16    7  6.89 108.26   Feb Winter
## 17    9  6.89 110.17   Feb Winter
## 18    7  6.91 110.71   Feb Winter
## 19    9  7.44 110.68   Mar Spring
## 20    7  7.45 108.69   Mar Spring
## 21    9  7.45 109.45   Mar Spring
## 22    7  7.52 110.76   Mar Spring
## 23    9  7.62 109.83   Mar Spring
## 24    9 10.54 107.39   Mar Spring
## 25    9 10.80 110.05   Mar Spring
## 26    9 10.83 109.91   Mar Spring
## 27    7 11.10 106.12   Mar Spring
## 28    7 11.29 107.05   Mar Spring
## 29    7 11.32 105.91   Mar Spring
## 30    9 11.33 106.38   Mar Spring
## 31    9 11.46 106.67   Mar Spring
## 32    9 11.48 107.00   Mar Spring
## 33    9 23.57  97.88   Mar Spring
## 34    9 23.65  98.24   Mar Spring
## 35    9 23.82  99.93   Mar Spring
## 36    9 24.18  99.42   Mar Spring
## 37    9  7.67 109.00   Feb Winter
## 38    9  8.39 110.74   Feb Winter
## 39    7  8.47 108.66   Feb Winter
## 40    7  8.49 110.02   Feb Winter
## 41    9  8.83 108.72   Feb Winter
## 42    9  8.87 108.44   Feb Winter
## 43    9  8.92 108.57   Feb Winter
## 44    7  9.00 110.17   Feb Winter
## 45    9  9.31 109.55   Feb Winter
## 46    7  9.31 109.11   Feb Winter
## 47    9  9.35 107.56   Apr Spring
## 48    9  9.39 109.25   Apr Spring
## 49    9  9.43 108.31   Apr Spring
## 50    9  9.48 107.37   Apr Spring
## 51    9  9.74 106.91   Apr Spring
## 52    9 10.06 109.26   Apr Spring
## 53    9 10.20 107.01   Apr Spring
## 54    9 10.26 106.70   Apr Spring
## 55    7 10.28 110.21   Apr Spring
## 56    9 10.30 108.03   Apr Spring
## 57    7 11.82 104.86   Apr Spring
## 58    7 11.89 104.68   Apr Spring
## 59    9 11.93 106.46   Apr Spring
## 60    7 11.94 102.96   Apr Spring
## 61    7 12.07 103.41   Apr Spring
## 62    7 12.15 106.10   Apr Spring
## 63    7 12.16 107.92   Apr Spring
## 64    7 12.17 107.32   Apr Spring
## 65    7 12.22 103.67   Apr Spring
## 66    7 12.26 105.95   Apr Spring
## 67    7 13.21 106.56   Apr Spring
## 68    7 13.31 107.47   Apr Spring
## 69    7 13.44 104.49   Apr Spring
## 70    7 13.68 103.99   Apr Spring
## 71    7 13.83 107.08   Apr Spring
## 72    7 14.04 106.39   Apr Spring
## 73    7 14.12 104.75   Apr Spring
## 74    7 14.16 103.35   Apr Spring
## 75    7 14.25 102.04   Apr Spring
## 76    7 14.27 102.03   Apr Spring
## 77    7 14.32 102.00   Apr Spring
## 78    7  7.73 108.99   May Spring
## 79    7  7.78 107.21   May Spring
## 80    7  7.81 111.16   May Spring
## 81    7  7.88 109.64   Mar Spring
## 82    7  7.91 108.69   Mar Spring
## 83    7  7.99 109.05   Mar Spring
## 84    7  8.00 110.71   Mar Spring
## 85    7  8.04 109.34   Mar Spring
## 86    7  8.33 108.97   May Spring
## 87    7 12.58 104.52   May Spring
## 88    7 12.67 105.21   May Spring
## 89    7 12.70 103.59   May Spring
## 90    7 12.74 100.61   May Spring
## 91    7 16.07 102.07   May Spring
## 92    7 16.08 104.80   May Spring
## 93    7 16.21 104.95   May Spring
## 94    7 16.75 104.33   May Spring
## 95    7 16.76 103.73   May Spring
## 96    7 17.00 102.40   May Spring
## 97    7 17.25 102.50   May Spring
## 98    7 17.64 104.23   May Spring
## 99    7 17.78 103.86   May Spring
## 100   7 17.79 103.66   May Spring
## 101   7 17.80 103.71   May Spring
## 102   7 17.83 104.98   May Spring
## 103   9 17.89  99.28   May Spring
## 104   7 18.11 103.18   May Spring
## 105   7 18.22 106.47   May Spring
## 106   9 18.49  96.23   May Spring
## 107   9 18.61  99.28   May Spring
## 108   7 18.80 103.02   May Spring
## 109   7 18.88 103.14   Mar Spring
## 110   9 18.89  98.60   Mar Spring
## 111   7 19.16 104.47   Feb Winter
## 112   9 19.29  98.00   May Spring
## 113   9 19.45  97.35   May Spring
## 114   9 19.52  97.94   May Spring
## 115   7 19.56 102.70   May Spring
## 116   9 19.82  98.48   May Spring
## 117   7 20.03 104.31   Feb Winter
## 118   9 20.03  99.69   May Spring
## 119   9 20.07  97.45   May Spring
## 120   9 20.34  98.54   May Spring
## 121   9 20.57  98.08   May Spring
## 122   9 20.61  97.76   May Spring
## 123   9 20.74  98.82   May Spring
## 124   9 20.90  98.12   May Spring
## 125   9 20.98  97.73   May Spring
## 126   9 21.09  98.14   May Spring
## 127   9 21.11  99.73   May Spring
## 128   9 21.21  97.65   May Spring
## 129   9 21.61  96.46   May Spring
## 130   9 21.71  99.82   May Spring
## 131   9 22.12  97.66   May Spring
## 132   9 22.94  98.75   May Spring
## 133   9 22.96 100.38   May Spring
## 134   9 23.03  99.33   Feb Winter
## 135   9 23.04  99.66   Mar Spring
## 136   9 23.04 100.06   Mar Spring
## 137   9 23.21  99.79   Feb Winter
## 138   9 25.17 100.14   May Spring
## 139   9 25.41  96.91   May Spring
## 140   7  7.72 110.11   Feb Winter
## 141   7 12.87 107.19   Jun Summer
## 142   7 12.89 102.88   Jun Summer
## 143   7 12.93 105.97   Jun Summer
## 144   7 13.00 104.51   Jun Summer
## 145   7 13.02 104.99   Jun Summer
## 146   7 14.38 100.95   Jun Summer
## 147   7 14.40 106.79   Jun Summer
## 148   7 14.51 104.94   Jun Summer
## 149   7 14.67 103.16   Jun Summer
## 150   7 14.78 101.82   Jun Summer
## 151   7 14.99 103.80   Jun Summer
## 152   7 15.09 103.49   Jun Summer
## 153   7 15.22 107.10   Jun Summer
## 154   7 15.54 104.89   Jun Summer
## 155   9 22.43  98.90   Jun Summer
## 156   9 22.57  97.90   Jun Summer
## 157   9 22.61  98.62   Jun Summer
## 158   9 22.68  97.77   Jun Summer
## 159   9 22.87  99.39   Jun Summer
## 160   9 24.52  98.57   Jun Summer
## 161   7 33.61 100.96   Jun Summer
## 162   7 33.79 100.29   Jun Summer
## 163   7 34.25 101.73   Jun Summer
## 164   7  6.75 111.75   Feb Winter
## 165   7  7.22 107.73   Feb Winter
## 166   9 11.40 110.28   Feb Winter
## 167   9 10.66 106.12   Feb Winter
## 168   9 11.49 110.76   Jun Summer
## 169   9  9.18 112.27   Feb Winter
## 170   9 10.09 113.50   Feb Winter
## 171   7  3.81 109.12   May Spring
## 172   9 10.18 112.45   Feb Winter
## 173   9  5.81 109.88   Feb Winter
## 174   9 10.29 107.17   Feb Winter
## 175   9  5.90 110.42   Feb Winter
## 176   7 10.69 108.81   Mar Spring
## 177   9  4.50 104.22   Feb Winter
## 178   7  7.66 110.46   May Spring
## 179   7 29.27  98.34   Jun Summer
## 180   7 29.72  99.12   Jun Summer
## 181   7 29.33 101.03   Jun Summer
## 182   7 29.71  97.26   Feb Winter
## 183   9  7.01 109.09   May Spring
## 184   9  6.53 109.41   Apr Spring
## 185   7  8.21 110.84   May Spring
## 186   9  7.09 108.85   Mar Spring
## 187   9  7.99 110.17   Feb Winter
## 188   7  6.57 110.93   Feb Winter
## 189   9 26.60 101.16   Mar Spring
## 190   9 24.75 101.22   May Spring
## 191   7 20.53 100.02   Apr Spring
## 192   9 26.14 103.87   Jun Summer
## 193   7 30.35 102.48   Jun Summer
## 194   9 27.83 102.34   Jun Summer
## 195   9 19.89 103.42   Jun Summer
## 196   7 24.42 101.31   May Spring
## 197   7 14.10 101.43   Apr Spring
## 198   7 22.89 100.88   Apr Spring
## 199   7 10.89 106.52   Apr Spring
## 200   7 10.14 109.11   Apr Spring
children_below_median
##     age   bll     iq month season
## 1     1  5.36 111.16   Feb Winter
## 2     1  6.95 110.02   Feb Winter
## 3     1  7.28 109.69   Feb Winter
## 4     1  7.33 109.29   Mar Spring
## 5     1  7.52 108.89   Mar Spring
## 6     1  8.37 106.47   Mar Spring
## 7     5 10.34 108.98   Mar Spring
## 8     3 10.42 109.92   Mar Spring
## 9     5 10.64 110.19   Mar Spring
## 10    1 10.77 109.88   Mar Spring
## 11    1 10.89 103.30   Mar Spring
## 12    3 10.92 108.74   Mar Spring
## 13    5 11.08 110.96   Mar Spring
## 14    5 11.14 110.07   Mar Spring
## 15    3 11.23 109.13   Mar Spring
## 16    3 11.23 107.71   Mar Spring
## 17    3 11.36 106.02   Mar Spring
## 18    5 11.39 110.42   Mar Spring
## 19    3 11.40 109.49   Mar Spring
## 20    5 11.47 110.71   Mar Spring
## 21    1 23.46  99.76   Mar Spring
## 22    3 23.54 104.40   Mar Spring
## 23    1 23.56 100.78   Mar Spring
## 24    1 23.63 100.44   Mar Spring
## 25    3 23.79 102.31   Mar Spring
## 26    3 23.83 102.87   Mar Spring
## 27    5 23.84 102.24   Mar Spring
## 28    1 23.95  98.96   Mar Spring
## 29    3 24.07 103.30   Mar Spring
## 30    1 24.21  99.70   Mar Spring
## 31    1 24.25  99.28   Mar Spring
## 32    5 31.35 100.13   Mar Spring
## 33    5 31.67  99.04   Mar Spring
## 34    5 31.76  98.28   Mar Spring
## 35    3 32.54 101.00   Mar Spring
## 36    3 33.15 101.30   Mar Spring
## 37    3 33.21  98.02   Mar Spring
## 38    1  8.62 109.50   Feb Winter
## 39    1  8.71 110.23   Feb Winter
## 40    1  8.72 109.87   Feb Winter
## 41    1  8.73 109.92   Feb Winter
## 42    1  8.83 108.61   Feb Winter
## 43    1  8.95 107.72   Feb Winter
## 44    5  9.38 111.60   Apr Spring
## 45    1  9.57 108.86   Apr Spring
## 46    1  9.84 110.53   Apr Spring
## 47    1  9.86 110.46   Apr Spring
## 48    5 10.06 112.14   Apr Spring
## 49    1 10.20 109.29   Apr Spring
## 50    5 10.27 110.40   Apr Spring
## 51    3 10.28 109.60   Apr Spring
## 52    5 11.53 108.62   Apr Spring
## 53    5 11.54 108.91   Apr Spring
## 54    1 11.60 104.47   Apr Spring
## 55    5 11.62 111.74   Apr Spring
## 56    5 11.84 108.91   Apr Spring
## 57    3 11.99 109.24   Apr Spring
## 58    5 12.01 111.11   Apr Spring
## 59    1 12.08 105.20   Apr Spring
## 60    1 12.08 105.07   Apr Spring
## 61    1 12.11 103.18   Apr Spring
## 62    1 12.11 104.75   Apr Spring
## 63    3 12.15 109.27   Apr Spring
## 64    3 12.19 108.22   Apr Spring
## 65    1 12.21 103.94   Apr Spring
## 66    1 12.21 105.22   Apr Spring
## 67    3 12.21 108.13   Apr Spring
## 68    5 12.25 111.04   Apr Spring
## 69    1 12.29 103.43   Apr Spring
## 70    3 12.34 108.45   Apr Spring
## 71    3 12.40 108.84   Apr Spring
## 72    3 12.44 109.29   Apr Spring
## 73    5 12.58 110.14   Apr Spring
## 74    1 12.58 104.69   Apr Spring
## 75    3 13.05 109.30   Apr Spring
## 76    1 13.15 105.63   Apr Spring
## 77    1 13.19 103.43   Apr Spring
## 78    1 13.23 105.02   Apr Spring
## 79    1 13.33 105.59   Apr Spring
## 80    5 13.68 109.66   Apr Spring
## 81    5 13.73 111.55   Apr Spring
## 82    1 13.75 106.06   Apr Spring
## 83    1 13.92 106.41   Apr Spring
## 84    3 23.46 104.12   Apr Spring
## 85    1 25.77 100.06   Apr Spring
## 86    1 25.91 101.87   Apr Spring
## 87    3 26.40 102.24   Apr Spring
## 88    1  8.18 109.69   Feb Winter
## 89    1  8.35 109.87   May Spring
## 90    3 12.68 108.91   May Spring
## 91    1 12.69 104.35   Feb Winter
## 92    1 12.79 105.35   Feb Winter
## 93    5 12.81 108.85   Feb Winter
## 94    5 12.81 112.29   Feb Winter
## 95    3 12.84 110.42   Feb Winter
## 96    5 16.09 105.02   May Spring
## 97    1 16.12 102.54   May Spring
## 98    1 16.21 103.80   May Spring
## 99    5 16.22 105.40   May Spring
## 100   1 16.34 101.92   May Spring
## 101   3 16.36 103.50   May Spring
## 102   1 16.42 104.45   May Spring
## 103   1 16.60 102.73   May Spring
## 104   1 16.62 103.28   May Spring
## 105   5 16.64 106.23   May Spring
## 106   5 16.76 107.51   May Spring
## 107   5 16.76 105.19   Feb Winter
## 108   1 16.84 103.08   May Spring
## 109   1 16.90 100.04   May Spring
## 110   5 17.03 106.46   Feb Winter
## 111   5 17.06 104.74   Feb Winter
## 112   5 17.07 107.32   Feb Winter
## 113   3 17.10 107.02   Feb Winter
## 114   5 17.11 106.18   Feb Winter
## 115   5 17.14 106.87   Feb Winter
## 116   5 17.26 106.79   May Spring
## 117   5 17.34 107.66   May Spring
## 118   1 17.40 104.00   May Spring
## 119   5 17.40 103.67   May Spring
## 120   5 17.46 107.87   May Spring
## 121   3 17.50 107.76   May Spring
## 122   1 17.56 103.36   May Spring
## 123   1 17.56 105.49   May Spring
## 124   3 17.58 106.31   May Spring
## 125   3 17.79 105.73   May Spring
## 126   1 17.83 101.87   May Spring
## 127   5 17.91 104.52   May Spring
## 128   1 17.99 105.15   May Spring
## 129   5 18.07 105.66   May Spring
## 130   1 18.08 102.59   May Spring
## 131   3 18.21 107.71   May Spring
## 132   5 18.22 107.29   May Spring
## 133   1 18.25 103.29   May Spring
## 134   1 18.41 102.61   May Spring
## 135   3 18.56 106.05   Feb Winter
## 136   5 18.56 106.31   Feb Winter
## 137   1 18.57 104.55   May Spring
## 138   5 18.80 107.15   May Spring
## 139   3 18.84 106.08   Mar Spring
## 140   3 18.97 106.11   Mar Spring
## 141   3 18.97 107.74   Feb Winter
## 142   3 19.10 106.94   Feb Winter
## 143   3 19.17 105.18   May Spring
## 144   3 19.30 106.10   Feb Winter
## 145   5 19.45 107.30   May Spring
## 146   3 19.51 106.52   May Spring
## 147   3 19.53 106.26   May Spring
## 148   3 19.53 106.79   May Spring
## 149   3 19.55 107.45   May Spring
## 150   3 19.69 107.24   May Spring
## 151   3 19.92 104.40   May Spring
## 152   5 20.70 103.47   May Spring
## 153   5 21.08 102.30   May Spring
## 154   3 21.13 104.98   Feb Winter
## 155   5 21.16 102.75   May Spring
## 156   5 21.22 101.18   May Spring
## 157   5 21.53 102.87   May Spring
## 158   5 21.80 102.48   May Spring
## 159   5 21.95 101.78   May Spring
## 160   5 22.18 102.93   May Spring
## 161   5 22.90 100.35   May Spring
## 162   5 23.01 105.13   May Spring
## 163   1 23.06 101.91   Feb Winter
## 164   1 23.08  99.42   May Spring
## 165   3 23.10 102.44   May Spring
## 166   1 23.22  98.19   May Spring
## 167   5 23.39 102.69   May Spring
## 168   1 23.40 100.05   May Spring
## 169   3 24.92 102.80   May Spring
## 170   3 24.95 102.49   May Spring
## 171   3 24.99 104.07   May Spring
## 172   1 25.01  98.48   May Spring
## 173   3 25.16 103.53   May Spring
## 174   1 25.27 100.65   May Spring
## 175   3 25.38 102.99   May Spring
## 176   3 25.50 103.69   Feb Winter
## 177   1 25.51  99.92   May Spring
## 178   3 25.54 102.84   May Spring
## 179   1 25.69 100.35   May Spring
## 180   3 25.74 102.17   May Spring
## 181   3 35.56 100.80   May Spring
## 182   3 35.96 102.13   May Spring
## 183   3 36.16  99.96   May Spring
## 184   1  7.70 110.37   Feb Winter
## 185   1 12.89 106.61   Jun Summer
## 186   3 13.00 108.80   Jun Summer
## 187   1 13.02 104.86   Jun Summer
## 188   3 14.54 108.93   Jun Summer
## 189   3 14.56 109.24   Jun Summer
## 190   1 15.20 103.79   Jun Summer
## 191   1 15.46 101.21   Jun Summer
## 192   1 15.67 100.65   Jun Summer
## 193   5 22.21 103.54   Jun Summer
## 194   5 22.32  99.96   Jun Summer
## 195   5 22.61 102.10   Jun Summer
## 196   5 22.62 102.40   Jun Summer
## 197   5 22.66 101.67   Jun Summer
## 198   5 22.66 102.34   Jun Summer
## 199   5 22.78 103.00   Jun Summer
## 200   5 22.78 101.93   Jun Summer
## 201   1 22.89  99.31   Jun Summer
## 202   1 24.27 102.05   Jun Summer
## 203   3 24.27 102.77   Jun Summer
## 204   3 24.38 103.33   Jun Summer
## 205   3 24.42 103.55   Jun Summer
## 206   1 24.58  99.77   Jun Summer
## 207   1 24.59  98.83   Jun Summer
## 208   3 24.59 102.74   Jun Summer
## 209   3 24.78 102.08   Jun Summer
## 210   5 27.74  98.36   Jun Summer
## 211   5 28.36  98.75   Jun Summer
## 212   5 28.80 100.51   Jun Summer
## 213   5 28.93 101.98   Jun Summer
## 214   5 29.14 100.10   Jun Summer
## 215   5 29.30 100.03   Jun Summer
## 216   5 29.53  99.71   Jun Summer
## 217   5 29.63 100.03   Jun Summer
## 218   5 29.68  99.22   Jun Summer
## 219   5 29.71 100.34   Jun Summer
## 220   5 29.72 100.43   Jun Summer
## 221   5 29.77  97.98   Jun Summer
## 222   5 30.07  99.74   Jun Summer
## 223   5 30.10  98.71   Jun Summer
## 224   5 30.24  99.11   Jun Summer
## 225   5 30.89 100.59   Jun Summer
## 226   5 30.90 101.17   Jun Summer
## 227   3 33.50 101.61   Jun Summer
## 228   3 33.59  99.68   Jun Summer
## 229   3 33.91 101.47   Jun Summer
## 230   3 34.15 101.33   Jun Summer
## 231   3 34.42 101.03   Jun Summer
## 232   3 34.69 102.38   Jun Summer
## 233   3 34.71 102.37   Jun Summer
## 234   3 34.77 101.26   Jun Summer
## 235   3 35.19 100.53   Jun Summer
## 236   3 35.24  99.97   Jun Summer
## 237   3 35.25 101.40   Jun Summer
## 238   5 16.30 112.60   Jun Summer
## 239   5 10.82 109.36   Feb Winter
## 240   5  9.97 111.18   Jun Summer
## 241   1  5.89 111.40   Feb Winter
## 242   1  9.33 108.78   Feb Winter
## 243   1 28.90  99.73   Jun Summer
## 244   5 29.43  98.29   Jun Summer
## 245   5 29.43 100.01   Jun Summer
## 246   3 29.93 101.59   Jun Summer
## 247   1 30.51  97.53   Jun Summer
## 248   1 28.82  97.18   May Spring
## 249   5 28.56  97.14   Apr Spring
## 250   5 29.16  99.98   May Spring
## 251   3 30.37  96.77   Mar Spring
## 252   3 31.14  96.69   Feb Winter
## 253   3 26.06  98.02   Feb Winter
## 254   3 24.15 100.80   Feb Winter
## 255   5 24.48  97.54   Jun Summer
## 256   1 24.92  99.88   Jun Summer
## 257   5 22.79 102.24   Jun Summer
## 258   3 20.86  98.56   Feb Winter
## 259   5 22.88 100.59   Mar Spring
## 260   5 12.38 106.85   Apr Spring

QUESTION #6

How many children fall into each of the newly created datasets (i.e., how many children were ≤ median age, and how many were > median age)?

There were 200 children that fell into the data set above the median age and 260 children that fell into the data set below the median age.

Exercise 3. Descriptives

Obtain the mean, median, min, max and IQR for exposure and outcome variables, obtain proportions for main categorical (season and age) variables in the full dataset.

describe(leadiq_final, IQR = T)
##         vars   n   mean   sd median trimmed  mad   min    max range  skew
## age        1 460   5.19 2.83   5.00    5.24 2.97  1.00   9.00  8.00 -0.11
## bll        2 460  17.36 7.68  16.76   16.87 8.90  3.81  36.16 32.35  0.45
## iq         3 460 104.65 4.17 104.50  104.69 5.50 96.23 113.50 17.27 -0.03
## month*     4 460   3.17 1.47   3.00    3.21 1.48  1.00   5.00  4.00 -0.10
## season*    5 460   2.02 0.62   2.00    2.02 0.00  1.00   3.00  2.00 -0.01
##         kurtosis   se   IQR
## age        -1.30 0.13  4.00
## bll        -0.67 0.36 11.76
## iq         -1.15 0.19  7.43
## month*     -1.38 0.07  3.00
## season*    -0.44 0.03  0.00

QUESTION #7

Write one or two sentences commenting on the descriptive values.

The means and medians are very close showing similar distributions, with values reasonable ranges of the mins and maxs. The IQRs show more variability thought with BLL being 11.76, IQ being 7.43, and age being 4.00.

QUESTION #8

What percentage of BLL samples were assessed in the Summer?

20.4% of BLL samples were assessed in the summer.

Exercise 4. Describing by an Important Confounding Variable

Obtain the mean, median, min, max and IQR for exposure and outcome variables by season.

leadiq_final %>%
  group_by(season) %>%
  summarise(mean_bll = mean(bll, na.rm = TRUE)) %>%
  arrange(desc(mean_bll)) 
## # A tibble: 3 × 2
##   season mean_bll
##   <fct>     <dbl>
## 1 Summer     24.3
## 2 Spring     16.8
## 3 Winter     11.7
leadiq_final %>%
  group_by(season) %>%
  summarise(min_bll = min(bll, na.rm = TRUE)) %>%
  arrange(desc(min_bll)) 
## # A tibble: 3 × 2
##   season min_bll
##   <fct>    <dbl>
## 1 Summer    9.97
## 2 Winter    4.5 
## 3 Spring    3.81
leadiq_final %>%
  group_by(season) %>%
  summarise(max_bll = max(bll, na.rm = TRUE)) %>%
  arrange(desc(max_bll))
## # A tibble: 3 × 2
##   season max_bll
##   <fct>    <dbl>
## 1 Spring    36.2
## 2 Summer    35.2
## 3 Winter    31.1
leadiq_final %>%
  group_by(season) %>%
  summarise(median_bll = median(bll, na.rm = TRUE)) %>%
  arrange(desc(median_bll)) 
## # A tibble: 3 × 2
##   season median_bll
##   <fct>       <dbl>
## 1 Summer      24.5 
## 2 Spring      16.6 
## 3 Winter       8.87
leadiq_final %>%
  group_by(season) %>%
  summarise(mean_iq = mean(iq, na.rm = TRUE)) %>%
  arrange(desc(mean_iq))
## # A tibble: 3 × 2
##   season mean_iq
##   <fct>    <dbl>
## 1 Winter    108.
## 2 Spring    105.
## 3 Summer    102.
leadiq_final %>%
  group_by(season) %>%
  summarise(min_iq = min(iq, na.rm = TRUE)) %>%
  arrange(desc(min_iq)) 
## # A tibble: 3 × 2
##   season min_iq
##   <fct>   <dbl>
## 1 Summer   97.5
## 2 Winter   96.7
## 3 Spring   96.2
leadiq_final %>%
  group_by(season) %>%
  summarise(max_iq = max(iq, na.rm = TRUE)) %>%
  arrange(desc(max_iq))
## # A tibble: 3 × 2
##   season max_iq
##   <fct>   <dbl>
## 1 Winter   114.
## 2 Summer   113.
## 3 Spring   112.
leadiq_final %>%
  group_by(season) %>%
  summarise(median_iq = median(iq, na.rm = TRUE)) %>%
  arrange(desc(median_iq))
## # A tibble: 3 × 2
##   season median_iq
##   <fct>      <dbl>
## 1 Winter      109.
## 2 Spring      105.
## 3 Summer      101.

QUESTION #9

Are patterns of the primary exposure variable dependent on season?

Mean BLL levels are highest in summer at 24.3 bll, 16.8 bll in spring, and lowest in winter with 11.7 bll, showing that exposure varies by season, with higher levels during the summer time.

QUESTION #10

Which season was associated with highest average lead exposure?

The season of summer has the highest average lead exposure of 24.29766 bll compared to spring with 16.75491 bll and winter with 11.67953 bll. There medians back this up as well with summer having 24.55 bll, spring having 16.64 bll, and winter having 8.87 bll.

Exercise 5. Creating Descriptive Plots 1

Create a plot that shows the association between blood lead concentration by season (hint: a plot would you need to look at 1 numeric and 1 categorical variable).

ggplot(leadiq_final, aes(x = season, y = bll)) +
  geom_boxplot(fill = "lightblue", color = "black") +
  labs(
    title = "Association between blood lead concentration by season",
    x = "Season",
    y = "Blood Lead Conectration"
  ) +
  theme_minimal()

QUESTION #11

Is the observed pattern similar to your response in question 8?

Yes, I had stated that the bll levels would be higher and increase in the summer months and decrease as the temperature got colder in the year, with spring being next and winter being the lowest. This graph shows I was spot on with my obervations for question 8.

QUESTION #12

Briefly, what do you think is responsible for this exposure pattern by season? (hint. think about exposure pathways)

I believe the seasonal pattern in bll is due to changes in exposure pathways that are more common during warmer months than in colder months. In summer people spend more time outdoors, which increases contact with lead-contaminated soil and dust. This soil and dust can also be tracked indoors and ingested through hand-to-mouth contact. Dryer climates also increase suspended dust, making inhalation and ingestion rates higher. Plus open windows can cause contaminated outdoor dust to get indoors. All reasons why summer bll are higher compared to spring and winter.

Exercise 6. Creating Descriptive Plots 2

Create a plot that shows the association between blood lead concentration and IQ of the children (hint: a plot would you need to look at 2 numeric variables).

ggplot(data = leadiq_final, aes(x = bll, y = iq)) +  
  geom_point(color = 'black') +
  theme_bw() + 
  labs(title = "Relationship between blood lead concentration and IQ in children",
       y="IQ Levels",
       x="BLL Concentration") +
  facet_grid(~ season)

QUESTION #13

What relationship exists between blood lead concentration and measured IQ?

The graphs are showing a negative correlation with bll levels and iq in children throughout all seasons. Each graph shows that the iq levels start high in the left of the graph with little bll concentration and gradually decreases moving left to right along the x axis, eventually ending with lower iq levels with hugh amounts of bll concentrations.

Exercise 7. Creating Descriptive Plots by Subsets

Now create a plot that shows the association between blood lead concentration and IQ within the subset of children ≤ median age and the subset of children > median age (Hint: create a plot similar to that from exercise 6 for each of the two individual datasets)

# Under 5 
ggplot(data = children_below_median, aes(x = bll, y = iq)) +  
  geom_point(color = 'black') +
  theme_bw() + 
  labs(title = "Relationship between blood lead concentration and IQ in children under 5",
       y="IQ Levels",
       x="BLL Concentration")

# Five and over
ggplot(data = children_above_median, aes(x = bll, y = iq)) +  
  geom_point(color = 'black') +
  theme_bw() + 
  labs(title = "Relationship between blood lead concentration and IQ in children 5 and over",
       y="IQ Levels",
       x="BLL Concentration")

ggplot() +
  geom_line(data = children_below_median, aes(x = bll, y = iq, color = "Below 5")) +
  geom_line(data = children_above_median, aes(x = bll, y = iq, color = "5 and over")) +
  labs(
    title = "Relationship between blood lead concentration and IQ in children below and over 5 yrs",
    x = "BLL Concetrations",
    y = "IQ Levels",
    color = "Age"
  ) +
  theme_minimal()

QUESTION #14

Is the relationship between blood lead concentration and measured IQ similar or different in the subset of children were ≤ median age vs. the subset of children > median age?

It’s somewhat similar, The graphs show that children under 5 and 5 over measure very similarly with their bll concentrations and IQ levels. Children below 5 seem to suffer more considerably when reaching 25 bll and above in term of their iq levels. Theirs decreases heavily while 5 and overs stays relativly the stable enough.

QUESTION #15

Based on this, is it reasonable to say children under 5 are at higher risk of lead exposure-based neurotoxicity compared to older children? Briefly justify your answer.

Yes, once they reach a certain point, roughly at 10 bll, their iq drastically decreases and plummets below 100 by 25 bll. This makes sense as younger children still have their brains and organs developing, and with there smaller size it takes less toxicity to have a greater affect on them compared to more mature children/adults.

Exercise 8. The Final Stretch

Given the CDC standards for the acceptable level of lead (10microg/dL), let’s test this cutoff.
Create 2 new datasets based on blood lead levels: one for blood lead levels ≤ 10 and one for blood lead levels > 10

median_bll <- median(leadiq_final$bll, na.rm = TRUE)
print(paste("Median BLL:", median_bll))
## [1] "Median BLL: 16.76"
bll_below_median <- leadiq_final %>%
  filter(bll <= median_bll)

bll_above_median <- leadiq_final %>%
  filter(bll > median_bll)

bll_below_median
##     age   bll     iq month season
## 1     9  5.18 110.57   Feb Winter
## 2     1  5.36 111.16   Feb Winter
## 3     9  5.64 109.68   Feb Winter
## 4     9  5.65 108.83   Feb Winter
## 5     9  5.83 110.45   Feb Winter
## 6     9  5.86 111.45   Feb Winter
## 7     9  5.86 110.34   Feb Winter
## 8     9  5.89 109.28   Feb Winter
## 9     9  6.14 108.54   Feb Winter
## 10    9  6.24 110.38   Feb Winter
## 11    9  6.32 110.49   Feb Winter
## 12    7  6.50 108.48   Feb Winter
## 13    9  6.52 110.29   Feb Winter
## 14    9  6.61 110.25   Feb Winter
## 15    9  6.63 108.26   Feb Winter
## 16    9  6.87 111.02   Feb Winter
## 17    7  6.89 108.26   Feb Winter
## 18    9  6.89 110.17   Feb Winter
## 19    7  6.91 110.71   Feb Winter
## 20    1  6.95 110.02   Feb Winter
## 21    1  7.28 109.69   Feb Winter
## 22    1  7.33 109.29   Mar Spring
## 23    9  7.44 110.68   Mar Spring
## 24    7  7.45 108.69   Mar Spring
## 25    9  7.45 109.45   Mar Spring
## 26    7  7.52 110.76   Mar Spring
## 27    1  7.52 108.89   Mar Spring
## 28    9  7.62 109.83   Mar Spring
## 29    1  8.37 106.47   Mar Spring
## 30    5 10.34 108.98   Mar Spring
## 31    3 10.42 109.92   Mar Spring
## 32    9 10.54 107.39   Mar Spring
## 33    5 10.64 110.19   Mar Spring
## 34    1 10.77 109.88   Mar Spring
## 35    9 10.80 110.05   Mar Spring
## 36    9 10.83 109.91   Mar Spring
## 37    1 10.89 103.30   Mar Spring
## 38    3 10.92 108.74   Mar Spring
## 39    5 11.08 110.96   Mar Spring
## 40    7 11.10 106.12   Mar Spring
## 41    5 11.14 110.07   Mar Spring
## 42    3 11.23 109.13   Mar Spring
## 43    3 11.23 107.71   Mar Spring
## 44    7 11.29 107.05   Mar Spring
## 45    7 11.32 105.91   Mar Spring
## 46    9 11.33 106.38   Mar Spring
## 47    3 11.36 106.02   Mar Spring
## 48    5 11.39 110.42   Mar Spring
## 49    3 11.40 109.49   Mar Spring
## 50    9 11.46 106.67   Mar Spring
## 51    5 11.47 110.71   Mar Spring
## 52    9 11.48 107.00   Mar Spring
## 53    9  7.67 109.00   Feb Winter
## 54    9  8.39 110.74   Feb Winter
## 55    7  8.47 108.66   Feb Winter
## 56    7  8.49 110.02   Feb Winter
## 57    1  8.62 109.50   Feb Winter
## 58    1  8.71 110.23   Feb Winter
## 59    1  8.72 109.87   Feb Winter
## 60    1  8.73 109.92   Feb Winter
## 61    9  8.83 108.72   Feb Winter
## 62    1  8.83 108.61   Feb Winter
## 63    9  8.87 108.44   Feb Winter
## 64    9  8.92 108.57   Feb Winter
## 65    1  8.95 107.72   Feb Winter
## 66    7  9.00 110.17   Feb Winter
## 67    9  9.31 109.55   Feb Winter
## 68    7  9.31 109.11   Feb Winter
## 69    9  9.35 107.56   Apr Spring
## 70    5  9.38 111.60   Apr Spring
## 71    9  9.39 109.25   Apr Spring
## 72    9  9.43 108.31   Apr Spring
## 73    9  9.48 107.37   Apr Spring
## 74    1  9.57 108.86   Apr Spring
## 75    9  9.74 106.91   Apr Spring
## 76    1  9.84 110.53   Apr Spring
## 77    1  9.86 110.46   Apr Spring
## 78    5 10.06 112.14   Apr Spring
## 79    9 10.06 109.26   Apr Spring
## 80    1 10.20 109.29   Apr Spring
## 81    9 10.20 107.01   Apr Spring
## 82    9 10.26 106.70   Apr Spring
## 83    5 10.27 110.40   Apr Spring
## 84    3 10.28 109.60   Apr Spring
## 85    7 10.28 110.21   Apr Spring
## 86    9 10.30 108.03   Apr Spring
## 87    5 11.53 108.62   Apr Spring
## 88    5 11.54 108.91   Apr Spring
## 89    1 11.60 104.47   Apr Spring
## 90    5 11.62 111.74   Apr Spring
## 91    7 11.82 104.86   Apr Spring
## 92    5 11.84 108.91   Apr Spring
## 93    7 11.89 104.68   Apr Spring
## 94    9 11.93 106.46   Apr Spring
## 95    7 11.94 102.96   Apr Spring
## 96    3 11.99 109.24   Apr Spring
## 97    5 12.01 111.11   Apr Spring
## 98    7 12.07 103.41   Apr Spring
## 99    1 12.08 105.20   Apr Spring
## 100   1 12.08 105.07   Apr Spring
## 101   1 12.11 103.18   Apr Spring
## 102   1 12.11 104.75   Apr Spring
## 103   7 12.15 106.10   Apr Spring
## 104   3 12.15 109.27   Apr Spring
## 105   7 12.16 107.92   Apr Spring
## 106   7 12.17 107.32   Apr Spring
## 107   3 12.19 108.22   Apr Spring
## 108   1 12.21 103.94   Apr Spring
## 109   1 12.21 105.22   Apr Spring
## 110   3 12.21 108.13   Apr Spring
## 111   7 12.22 103.67   Apr Spring
## 112   5 12.25 111.04   Apr Spring
## 113   7 12.26 105.95   Apr Spring
## 114   1 12.29 103.43   Apr Spring
## 115   3 12.34 108.45   Apr Spring
## 116   3 12.40 108.84   Apr Spring
## 117   3 12.44 109.29   Apr Spring
## 118   5 12.58 110.14   Apr Spring
## 119   1 12.58 104.69   Apr Spring
## 120   3 13.05 109.30   Apr Spring
## 121   1 13.15 105.63   Apr Spring
## 122   1 13.19 103.43   Apr Spring
## 123   7 13.21 106.56   Apr Spring
## 124   1 13.23 105.02   Apr Spring
## 125   7 13.31 107.47   Apr Spring
## 126   1 13.33 105.59   Apr Spring
## 127   7 13.44 104.49   Apr Spring
## 128   7 13.68 103.99   Apr Spring
## 129   5 13.68 109.66   Apr Spring
## 130   5 13.73 111.55   Apr Spring
## 131   1 13.75 106.06   Apr Spring
## 132   7 13.83 107.08   Apr Spring
## 133   1 13.92 106.41   Apr Spring
## 134   7 14.04 106.39   Apr Spring
## 135   7 14.12 104.75   Apr Spring
## 136   7 14.16 103.35   Apr Spring
## 137   7 14.25 102.04   Apr Spring
## 138   7 14.27 102.03   Apr Spring
## 139   7 14.32 102.00   Apr Spring
## 140   7  7.73 108.99   May Spring
## 141   7  7.78 107.21   May Spring
## 142   7  7.81 111.16   May Spring
## 143   7  7.88 109.64   Mar Spring
## 144   7  7.91 108.69   Mar Spring
## 145   7  7.99 109.05   Mar Spring
## 146   7  8.00 110.71   Mar Spring
## 147   7  8.04 109.34   Mar Spring
## 148   1  8.18 109.69   Feb Winter
## 149   7  8.33 108.97   May Spring
## 150   1  8.35 109.87   May Spring
## 151   7 12.58 104.52   May Spring
## 152   7 12.67 105.21   May Spring
## 153   3 12.68 108.91   May Spring
## 154   1 12.69 104.35   Feb Winter
## 155   7 12.70 103.59   May Spring
## 156   7 12.74 100.61   May Spring
## 157   1 12.79 105.35   Feb Winter
## 158   5 12.81 108.85   Feb Winter
## 159   5 12.81 112.29   Feb Winter
## 160   3 12.84 110.42   Feb Winter
## 161   7 16.07 102.07   May Spring
## 162   7 16.08 104.80   May Spring
## 163   5 16.09 105.02   May Spring
## 164   1 16.12 102.54   May Spring
## 165   1 16.21 103.80   May Spring
## 166   7 16.21 104.95   May Spring
## 167   5 16.22 105.40   May Spring
## 168   1 16.34 101.92   May Spring
## 169   3 16.36 103.50   May Spring
## 170   1 16.42 104.45   May Spring
## 171   1 16.60 102.73   May Spring
## 172   1 16.62 103.28   May Spring
## 173   5 16.64 106.23   May Spring
## 174   7 16.75 104.33   May Spring
## 175   5 16.76 107.51   May Spring
## 176   5 16.76 105.19   Feb Winter
## 177   7 16.76 103.73   May Spring
## 178   1  7.70 110.37   Feb Winter
## 179   7  7.72 110.11   Feb Winter
## 180   7 12.87 107.19   Jun Summer
## 181   7 12.89 102.88   Jun Summer
## 182   1 12.89 106.61   Jun Summer
## 183   7 12.93 105.97   Jun Summer
## 184   7 13.00 104.51   Jun Summer
## 185   3 13.00 108.80   Jun Summer
## 186   1 13.02 104.86   Jun Summer
## 187   7 13.02 104.99   Jun Summer
## 188   7 14.38 100.95   Jun Summer
## 189   7 14.40 106.79   Jun Summer
## 190   7 14.51 104.94   Jun Summer
## 191   3 14.54 108.93   Jun Summer
## 192   3 14.56 109.24   Jun Summer
## 193   7 14.67 103.16   Jun Summer
## 194   7 14.78 101.82   Jun Summer
## 195   7 14.99 103.80   Jun Summer
## 196   7 15.09 103.49   Jun Summer
## 197   1 15.20 103.79   Jun Summer
## 198   7 15.22 107.10   Jun Summer
## 199   1 15.46 101.21   Jun Summer
## 200   7 15.54 104.89   Jun Summer
## 201   1 15.67 100.65   Jun Summer
## 202   7  6.75 111.75   Feb Winter
## 203   5 16.30 112.60   Jun Summer
## 204   5 10.82 109.36   Feb Winter
## 205   5  9.97 111.18   Jun Summer
## 206   7  7.22 107.73   Feb Winter
## 207   1  5.89 111.40   Feb Winter
## 208   9 11.40 110.28   Feb Winter
## 209   9 10.66 106.12   Feb Winter
## 210   9 11.49 110.76   Jun Summer
## 211   9  9.18 112.27   Feb Winter
## 212   9 10.09 113.50   Feb Winter
## 213   7  3.81 109.12   May Spring
## 214   9 10.18 112.45   Feb Winter
## 215   9  5.81 109.88   Feb Winter
## 216   9 10.29 107.17   Feb Winter
## 217   9  5.90 110.42   Feb Winter
## 218   7 10.69 108.81   Mar Spring
## 219   9  4.50 104.22   Feb Winter
## 220   7  7.66 110.46   May Spring
## 221   1  9.33 108.78   Feb Winter
## 222   9  7.01 109.09   May Spring
## 223   9  6.53 109.41   Apr Spring
## 224   7  8.21 110.84   May Spring
## 225   9  7.09 108.85   Mar Spring
## 226   9  7.99 110.17   Feb Winter
## 227   7  6.57 110.93   Feb Winter
## 228   7 14.10 101.43   Apr Spring
## 229   5 12.38 106.85   Apr Spring
## 230   7 10.89 106.52   Apr Spring
## 231   7 10.14 109.11   Apr Spring
bll_above_median
##     age   bll     iq month season
## 1     1 23.46  99.76   Mar Spring
## 2     3 23.54 104.40   Mar Spring
## 3     1 23.56 100.78   Mar Spring
## 4     9 23.57  97.88   Mar Spring
## 5     1 23.63 100.44   Mar Spring
## 6     9 23.65  98.24   Mar Spring
## 7     3 23.79 102.31   Mar Spring
## 8     9 23.82  99.93   Mar Spring
## 9     3 23.83 102.87   Mar Spring
## 10    5 23.84 102.24   Mar Spring
## 11    1 23.95  98.96   Mar Spring
## 12    3 24.07 103.30   Mar Spring
## 13    9 24.18  99.42   Mar Spring
## 14    1 24.21  99.70   Mar Spring
## 15    1 24.25  99.28   Mar Spring
## 16    5 31.35 100.13   Mar Spring
## 17    5 31.67  99.04   Mar Spring
## 18    5 31.76  98.28   Mar Spring
## 19    3 32.54 101.00   Mar Spring
## 20    3 33.15 101.30   Mar Spring
## 21    3 33.21  98.02   Mar Spring
## 22    3 23.46 104.12   Apr Spring
## 23    1 25.77 100.06   Apr Spring
## 24    1 25.91 101.87   Apr Spring
## 25    3 26.40 102.24   Apr Spring
## 26    1 16.84 103.08   May Spring
## 27    1 16.90 100.04   May Spring
## 28    7 17.00 102.40   May Spring
## 29    5 17.03 106.46   Feb Winter
## 30    5 17.06 104.74   Feb Winter
## 31    5 17.07 107.32   Feb Winter
## 32    3 17.10 107.02   Feb Winter
## 33    5 17.11 106.18   Feb Winter
## 34    5 17.14 106.87   Feb Winter
## 35    7 17.25 102.50   May Spring
## 36    5 17.26 106.79   May Spring
## 37    5 17.34 107.66   May Spring
## 38    1 17.40 104.00   May Spring
## 39    5 17.40 103.67   May Spring
## 40    5 17.46 107.87   May Spring
## 41    3 17.50 107.76   May Spring
## 42    1 17.56 103.36   May Spring
## 43    1 17.56 105.49   May Spring
## 44    3 17.58 106.31   May Spring
## 45    7 17.64 104.23   May Spring
## 46    7 17.78 103.86   May Spring
## 47    3 17.79 105.73   May Spring
## 48    7 17.79 103.66   May Spring
## 49    7 17.80 103.71   May Spring
## 50    1 17.83 101.87   May Spring
## 51    7 17.83 104.98   May Spring
## 52    9 17.89  99.28   May Spring
## 53    5 17.91 104.52   May Spring
## 54    1 17.99 105.15   May Spring
## 55    5 18.07 105.66   May Spring
## 56    1 18.08 102.59   May Spring
## 57    7 18.11 103.18   May Spring
## 58    3 18.21 107.71   May Spring
## 59    5 18.22 107.29   May Spring
## 60    7 18.22 106.47   May Spring
## 61    1 18.25 103.29   May Spring
## 62    1 18.41 102.61   May Spring
## 63    9 18.49  96.23   May Spring
## 64    3 18.56 106.05   Feb Winter
## 65    5 18.56 106.31   Feb Winter
## 66    1 18.57 104.55   May Spring
## 67    9 18.61  99.28   May Spring
## 68    7 18.80 103.02   May Spring
## 69    5 18.80 107.15   May Spring
## 70    3 18.84 106.08   Mar Spring
## 71    7 18.88 103.14   Mar Spring
## 72    9 18.89  98.60   Mar Spring
## 73    3 18.97 106.11   Mar Spring
## 74    3 18.97 107.74   Feb Winter
## 75    3 19.10 106.94   Feb Winter
## 76    7 19.16 104.47   Feb Winter
## 77    3 19.17 105.18   May Spring
## 78    9 19.29  98.00   May Spring
## 79    3 19.30 106.10   Feb Winter
## 80    9 19.45  97.35   May Spring
## 81    5 19.45 107.30   May Spring
## 82    3 19.51 106.52   May Spring
## 83    9 19.52  97.94   May Spring
## 84    3 19.53 106.26   May Spring
## 85    3 19.53 106.79   May Spring
## 86    3 19.55 107.45   May Spring
## 87    7 19.56 102.70   May Spring
## 88    3 19.69 107.24   May Spring
## 89    9 19.82  98.48   May Spring
## 90    3 19.92 104.40   May Spring
## 91    7 20.03 104.31   Feb Winter
## 92    9 20.03  99.69   May Spring
## 93    9 20.07  97.45   May Spring
## 94    9 20.34  98.54   May Spring
## 95    9 20.57  98.08   May Spring
## 96    9 20.61  97.76   May Spring
## 97    5 20.70 103.47   May Spring
## 98    9 20.74  98.82   May Spring
## 99    9 20.90  98.12   May Spring
## 100   9 20.98  97.73   May Spring
## 101   5 21.08 102.30   May Spring
## 102   9 21.09  98.14   May Spring
## 103   9 21.11  99.73   May Spring
## 104   3 21.13 104.98   Feb Winter
## 105   5 21.16 102.75   May Spring
## 106   9 21.21  97.65   May Spring
## 107   5 21.22 101.18   May Spring
## 108   5 21.53 102.87   May Spring
## 109   9 21.61  96.46   May Spring
## 110   9 21.71  99.82   May Spring
## 111   5 21.80 102.48   May Spring
## 112   5 21.95 101.78   May Spring
## 113   9 22.12  97.66   May Spring
## 114   5 22.18 102.93   May Spring
## 115   5 22.90 100.35   May Spring
## 116   9 22.94  98.75   May Spring
## 117   9 22.96 100.38   May Spring
## 118   5 23.01 105.13   May Spring
## 119   9 23.03  99.33   Feb Winter
## 120   9 23.04  99.66   Mar Spring
## 121   9 23.04 100.06   Mar Spring
## 122   1 23.06 101.91   Feb Winter
## 123   1 23.08  99.42   May Spring
## 124   3 23.10 102.44   May Spring
## 125   9 23.21  99.79   Feb Winter
## 126   1 23.22  98.19   May Spring
## 127   5 23.39 102.69   May Spring
## 128   1 23.40 100.05   May Spring
## 129   3 24.92 102.80   May Spring
## 130   3 24.95 102.49   May Spring
## 131   3 24.99 104.07   May Spring
## 132   1 25.01  98.48   May Spring
## 133   3 25.16 103.53   May Spring
## 134   9 25.17 100.14   May Spring
## 135   1 25.27 100.65   May Spring
## 136   3 25.38 102.99   May Spring
## 137   9 25.41  96.91   May Spring
## 138   3 25.50 103.69   Feb Winter
## 139   1 25.51  99.92   May Spring
## 140   3 25.54 102.84   May Spring
## 141   1 25.69 100.35   May Spring
## 142   3 25.74 102.17   May Spring
## 143   3 35.56 100.80   May Spring
## 144   3 35.96 102.13   May Spring
## 145   3 36.16  99.96   May Spring
## 146   5 22.21 103.54   Jun Summer
## 147   5 22.32  99.96   Jun Summer
## 148   9 22.43  98.90   Jun Summer
## 149   9 22.57  97.90   Jun Summer
## 150   5 22.61 102.10   Jun Summer
## 151   9 22.61  98.62   Jun Summer
## 152   5 22.62 102.40   Jun Summer
## 153   5 22.66 101.67   Jun Summer
## 154   5 22.66 102.34   Jun Summer
## 155   9 22.68  97.77   Jun Summer
## 156   5 22.78 103.00   Jun Summer
## 157   5 22.78 101.93   Jun Summer
## 158   9 22.87  99.39   Jun Summer
## 159   1 22.89  99.31   Jun Summer
## 160   1 24.27 102.05   Jun Summer
## 161   3 24.27 102.77   Jun Summer
## 162   3 24.38 103.33   Jun Summer
## 163   3 24.42 103.55   Jun Summer
## 164   9 24.52  98.57   Jun Summer
## 165   1 24.58  99.77   Jun Summer
## 166   1 24.59  98.83   Jun Summer
## 167   3 24.59 102.74   Jun Summer
## 168   3 24.78 102.08   Jun Summer
## 169   5 27.74  98.36   Jun Summer
## 170   5 28.36  98.75   Jun Summer
## 171   5 28.80 100.51   Jun Summer
## 172   5 28.93 101.98   Jun Summer
## 173   5 29.14 100.10   Jun Summer
## 174   5 29.30 100.03   Jun Summer
## 175   5 29.53  99.71   Jun Summer
## 176   5 29.63 100.03   Jun Summer
## 177   5 29.68  99.22   Jun Summer
## 178   5 29.71 100.34   Jun Summer
## 179   5 29.72 100.43   Jun Summer
## 180   5 29.77  97.98   Jun Summer
## 181   5 30.07  99.74   Jun Summer
## 182   5 30.10  98.71   Jun Summer
## 183   5 30.24  99.11   Jun Summer
## 184   5 30.89 100.59   Jun Summer
## 185   5 30.90 101.17   Jun Summer
## 186   3 33.50 101.61   Jun Summer
## 187   3 33.59  99.68   Jun Summer
## 188   7 33.61 100.96   Jun Summer
## 189   7 33.79 100.29   Jun Summer
## 190   3 33.91 101.47   Jun Summer
## 191   3 34.15 101.33   Jun Summer
## 192   7 34.25 101.73   Jun Summer
## 193   3 34.42 101.03   Jun Summer
## 194   3 34.69 102.38   Jun Summer
## 195   3 34.71 102.37   Jun Summer
## 196   3 34.77 101.26   Jun Summer
## 197   3 35.19 100.53   Jun Summer
## 198   3 35.24  99.97   Jun Summer
## 199   3 35.25 101.40   Jun Summer
## 200   7 29.27  98.34   Jun Summer
## 201   1 28.90  99.73   Jun Summer
## 202   5 29.43  98.29   Jun Summer
## 203   5 29.43 100.01   Jun Summer
## 204   3 29.93 101.59   Jun Summer
## 205   7 29.72  99.12   Jun Summer
## 206   7 29.33 101.03   Jun Summer
## 207   1 30.51  97.53   Jun Summer
## 208   1 28.82  97.18   May Spring
## 209   5 28.56  97.14   Apr Spring
## 210   5 29.16  99.98   May Spring
## 211   3 30.37  96.77   Mar Spring
## 212   7 29.71  97.26   Feb Winter
## 213   3 31.14  96.69   Feb Winter
## 214   9 26.60 101.16   Mar Spring
## 215   3 26.06  98.02   Feb Winter
## 216   9 24.75 101.22   May Spring
## 217   3 24.15 100.80   Feb Winter
## 218   5 24.48  97.54   Jun Summer
## 219   7 20.53 100.02   Apr Spring
## 220   9 26.14 103.87   Jun Summer
## 221   7 30.35 102.48   Jun Summer
## 222   1 24.92  99.88   Jun Summer
## 223   5 22.79 102.24   Jun Summer
## 224   9 27.83 102.34   Jun Summer
## 225   3 20.86  98.56   Feb Winter
## 226   9 19.89 103.42   Jun Summer
## 227   7 24.42 101.31   May Spring
## 228   5 22.88 100.59   Mar Spring
## 229   7 22.89 100.88   Apr Spring

QUESTION #16

Which group had more children?

The group below the median for bll levels had 231 children while the group above the median had 229 children. This makes the groups very close and just barely not equal.

Exercise 9. Creating Descriptive Plots by Subsets II

Now create a plot that shows the association between blood lead concentration and IQ within the subset of children with bll ≤ 10microg/dL and the subset of children with bll > 10microg/dL.

ggplot() +
  geom_point(data = bll_below_median, aes(x = bll, y = iq, color = "bll ≤ 10microg/dL")) +
  geom_point(data = bll_above_median, aes(x = bll, y = iq, color = "bll > 10microg/dL")) +
  labs(
    title = "Relationship between blood lead concentration and IQ above the median bll and below",
    x = "BLL Concetrations",
    y = "IQ Levels",
    color = "bll levels"
  ) +
  theme_minimal()

QUESTION #17

How is the relationship between lead concentration and IQ change different for children below the CDC cutoff vs. children above the CDC cutoff?

The relationship differs in both strength and pattern across the CDC cutoff. For children below the CDC cutoff, iq is higher overall and shows a clear negative trend, indicating that increases in lead concentration are correlated with declines in iq For children above the CDC cutoff, iq levels are lower and the relationship appears flatter and more variable, meaning there might be a plateau point where increases in lead lead to much smaller declines in iq

QUESTION #18

Based on the data analysis, does the legal limit of 10 microg/dL seem reasonable? Justify your answer.
Based on the data I believe that the legal limit of 10 microg/dL should be lower. The children below the CDC limit already show a clear negative association with increasing lead. This means that even below the CDC cutoff, lead is still linked to cognitive decline. If harm can occur below the CDC limit than the CDC should take action and lower the microg/dL to 5, where the negative association is less strong.

QUESTION #19

Imagine that you are mayor of this town. The lead smelting plant is the single biggest employer, bringing hundreds of well-paying manufacturing jobs to the area. Given the results of this study, what steps would you take to protect the mental health of the children while still maintaining a good relationship with the lead smelter?

If i was mayor I would first try to strengthen environmental controls at the plant, making it a requirement to upgrade the dust-capturing technology and enforce strict workplace hygiene practices. I’d also inform the community to make sure kids aren’t getting too dirty or too close to the plant. I’d also test the soil around the plant to see if there lead levels are high and see if it’s getting into the local food and water grown/sourced. I’d also incentive’s getting your child monitored for bll early on to help prevent worse effects later in life for them.

QUESTION #20

As a bonus, can you determine the theme from the chunk names?

US women soccer players <3

Now that you are done, go to the top of this window to the “Knit button”. Rename (add your name) and click the drop down menu and select “Knit to lab report”. Submit the .Rmd file, AND .html file to the Moodle dropbox for R Lab Final.

  • Answer questions intelligibly, ensure adequate spaces between instructions, responses and chunks (read through html file before submitting)
  • Feel free to work in pairs/groups
LS0tCnRpdGxlOiAiRU5TVCBGaW5hbDogTGVhZCBJUSBBY3Rpdml0eSIKYXV0aG9yOiAiQmVuamFtaW4gQ29vayAoV29ya2VkIHdpdGggWm9lIEFrc2ltKSIKZGF0ZTogImByIFN5cy5EYXRlKClgIgpvdXRwdXQ6IG9wZW5pbnRybzo6bGFiX3JlcG9ydAotLS0KCgpgYGB7ciBnbG9iYWwtb3B0aW9ucywgaW5jbHVkZT1GQUxTRSwgbWVzc2FnZT1GQUxTRSwgd2FybmluZz1GQUxTRX0KIyBrbml0cjo6b3B0c19jaHVuayRzZXQoZXZhbCA9IFRSVUUsIHJlc3VsdHMgPSBGQUxTRSwgZmlnLnNob3cgPSAiaGlkZSIsIG1lc3NhZ2UgPSBGQUxTRSkKYGBgCiAgCiMjIEJhY2tncm91bmQKTGVhZCBpcyBhIGhlYXZ5IG1ldGFsIHRoYXQgY2FuIGNhdXNlIGEgdmFyaWV0eSBvZiBzeW1wdG9tcyB3aGVuIGl0IGVudGVycyB0aGUgaHVtYW4gYm9keS4gTGVhZCBpbnRlcmZlcmVzIHdpdGggdGhlIGRldmVsb3BtZW50IG9mIHRoZSBuZXJ2b3VzIHN5c3RlbSBhbmQgY2FuIGNhdXNlIGhlYWRhY2hlcywgY29uZnVzaW9uLCBpcnJpdGFiaWxpdHksIGFuZCBpbiBzZXZlcmUgY2FzZXMsIHNlaXp1cmV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