Final Project

Author

Charles Ross

Load Libraries & dataset

library(tidyverse)
library(openintro)
library(infer)
library(ggplot2)
library(modeldata)
library(tidymodels)
setwd("/Users/charlesross/Downloads")
infant <- read_csv("infantmortality.csv")
head(infant)
# A tibble: 6 × 9
   Year Maternal Race or Ethnici…¹ Infant Mortality Rat…² Neonatal Mortality R…³
  <dbl> <chr>                                       <dbl>                  <dbl>
1  2016 Puerto Rican                                  3.4                    2.4
2  2016 Asian and Pacific Islander                    2.9                    2  
3  2016 Other/Two or More                            NA                     NA  
4  2016 Non-Hispanic Black                            8                      4.9
5  2016 Non-Hispanic White                            2.6                    1.6
6  2016 Other Hispanic                                3.8                    2.4
# ℹ abbreviated names: ¹​`Maternal Race or Ethnicity`, ²​`Infant Mortality Rate`,
#   ³​`Neonatal Mortality Rate`
# ℹ 5 more variables: `Postneonatal Mortality Rate` <dbl>,
#   `Infant Deaths` <dbl>, `Neonatal Infant Deaths` <dbl>,
#   `Postneonatal Infant Deaths` <dbl>, `Number of Live Births` <dbl>

Introduction

  • Infant Mortality Rate is defined as the number of deaths per 1,000 live births that occur prior to the infant reaching the age of 1 years old.

  • As time has passed the mean infant mortality rate in the U.S. has steadily declined among the general population, however observations have been made of infant mortality rates being disproportionately distributed among various different ethnic groups.

  • In order to determine whether these disparities are a result of racial inequality or are due to random chance I will be utilizing data gathered from a study performed by the CDC. The data for this study was collected through the use of randomized sampling & was performed by a very reputable organization, thus the results of this study were unlikely to be biased.

  • The statistic techniques that I plan to use to determine whether or not Race/Ethnicity affects the infant mortality rate of a population are Chi-Square tests, linear regressions, & ANOVA.

  • The overarching question I would like to answer is whether or not infant mortality rates in America are independent of maternal Race/Ethnicity.

Data

After loading my Dataset I used this chunk to edit my subtitles, making them lowercase & replacing spaces with underlines.

names(infant) <- tolower(names(infant))
names(infant) <- gsub(" ", "_", names(infant))
head(infant)
# A tibble: 6 × 9
   year maternal_race_or_ethnicity infant_mortality_rate neonatal_mortality_rate
  <dbl> <chr>                                      <dbl>                   <dbl>
1  2016 Puerto Rican                                 3.4                     2.4
2  2016 Asian and Pacific Islander                   2.9                     2  
3  2016 Other/Two or More                           NA                      NA  
4  2016 Non-Hispanic Black                           8                       4.9
5  2016 Non-Hispanic White                           2.6                     1.6
6  2016 Other Hispanic                               3.8                     2.4
# ℹ 5 more variables: postneonatal_mortality_rate <dbl>, infant_deaths <dbl>,
#   neonatal_infant_deaths <dbl>, postneonatal_infant_deaths <dbl>,
#   number_of_live_births <dbl>

I then used this chunk to filter out any N/A’s present in my data to ensure that it can be read smoothly.

IM <- infant |>
  filter(!is.na(number_of_live_births)) |>
  filter(!is.na(infant_mortality_rate)) |>
  filter(!is.na(neonatal_mortality_rate)) |>
  filter(!is.na(postneonatal_mortality_rate)) |>
  filter(!is.na(infant_deaths)) |>
  filter(!is.na(postneonatal_infant_deaths)) |>
  filter(!is.na(year)) 
IM
# A tibble: 48 × 9
    year maternal_race_or_ethnicity infant_mortality_rate neonatal_mortality_r…¹
   <dbl> <chr>                                      <dbl>                  <dbl>
 1  2016 Asian and Pacific Islander                   2.9                    2  
 2  2016 Non-Hispanic Black                           8                      4.9
 3  2016 Non-Hispanic White                           2.6                    1.6
 4  2016 Other Hispanic                               3.8                    2.4
 5  2015 Puerto Rican                                 6.1                    4.5
 6  2015 Non-Hispanic White                           2.7                    1.8
 7  2015 Non-Hispanic Black                           8                      4.8
 8  2015 Asian and Pacific Islander                   2.6                    1.6
 9  2015 Other Hispanic                               4.3                    2.9
10  2014 Asian and Pacific Islander                   2.6                    1.8
# ℹ 38 more rows
# ℹ abbreviated name: ¹​neonatal_mortality_rate
# ℹ 5 more variables: postneonatal_mortality_rate <dbl>, infant_deaths <dbl>,
#   neonatal_infant_deaths <dbl>, postneonatal_infant_deaths <dbl>,
#   number_of_live_births <dbl>

I will use this histogram to visualize the relationship between the # of infant deaths observed & their maternal ethnicity which can help illustrate whether certain races are more likely to die as infants.

ggplot(IM, aes(x= maternal_race_or_ethnicity, y= infant_deaths))+ 
  geom_histogram(stat = "identity") + theme(axis.text.x = element_text(size = 4)) + ggtitle("Infant Deaths by Maternal Race or Ethnicity") + xlab("Maternal Race or Ethnicity") + ylab("Infant Deaths") 
Warning in geom_histogram(stat = "identity"): Ignoring unknown parameters:
`binwidth`, `bins`, and `pad`

Using this chunk I plan to create a dot plot that helps to visualize the relative infant mortality rates of different ethinicities in a way that is easily digestible.

ggplot(IM, aes(x= maternal_race_or_ethnicity, y= infant_mortality_rate)) + 
  geom_point(stat = "identity") + theme(axis.text.x = element_text(size = 4)) + ggtitle("Infant Mortality by Maternal Race or Ethnicity") + xlab("Maternal Race or Ethnicity") + ylab("Infant Mortality") 

With this chunk I plan create a scatterplot & to plot a line of best fit for the number of infant deaths to number of live births, color coded by the maternal race/ethnicity to see whether race results in any significant outliers to the best fit line.

ggplot(IM, aes(x= number_of_live_births, y= infant_deaths, colour = maternal_race_or_ethnicity)) + 
  geom_point(stat = "identity") + theme(axis.text.x = element_text(size = 4)) + geom_smooth(method = "lm", se = TRUE, colour= "red") + ggtitle("Infant Live Births by Infant Deaths") + xlab("# of Live Births") + ylab("# of Infant Deaths")
`geom_smooth()` using formula = 'y ~ x'

summary(IM)
      year      maternal_race_or_ethnicity infant_mortality_rate
 Min.   :2007   Length:48                  Min.   : 2.600       
 1st Qu.:2009   Class :character           1st Qu.: 3.100       
 Median :2011   Mode  :character           Median : 4.300       
 Mean   :2011                              Mean   : 5.062       
 3rd Qu.:2014                              3rd Qu.: 6.650       
 Max.   :2016                              Max.   :10.200       
 neonatal_mortality_rate postneonatal_mortality_rate infant_deaths  
 Min.   :1.60            Min.   :0.600               Min.   : 46.0  
 1st Qu.:2.10            1st Qu.:0.975               1st Qu.: 62.0  
 Median :2.70            Median :1.600               Median :111.5  
 Mean   :3.31            Mean   :1.754               Mean   :119.4  
 3rd Qu.:4.55            3rd Qu.:2.425               3rd Qu.:144.0  
 Max.   :6.50            Max.   :3.800               Max.   :287.0  
 neonatal_infant_deaths postneonatal_infant_deaths number_of_live_births
 Min.   : 33.00         Min.   : 12.00             Min.   : 7561        
 1st Qu.: 43.00         1st Qu.: 20.75             1st Qu.:19372        
 Median : 75.00         Median : 36.50             Median :26230        
 Mean   : 77.62         Mean   : 41.73             Mean   :25109        
 3rd Qu.: 97.00         3rd Qu.: 48.50             3rd Qu.:30104        
 Max.   :182.00         Max.   :110.00             Max.   :40633        
summary(IM$infant_mortality_rate)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
  2.600   3.100   4.300   5.062   6.650  10.200 
table (IM$maternal_race_or_ethnicity)

Asian and Pacific Islander         Black Non-Hispanic 
                        10                          8 
        Non-Hispanic Black         Non-Hispanic White 
                         2                          2 
            Other Hispanic               Puerto Rican 
                        10                          8 
        White Non-Hispanic 
                         8 
NHWhite <- c(35,40607)
NHBlack <- c(74,23116)
IMR <- data_frame(NHBlack,NHWhite)
Warning: `data_frame()` was deprecated in tibble 1.1.0.
ℹ Please use `tibble()` instead.
rownames(IMR) <- c("Number of Infant Deaths", "Number of Live Births")
Warning: Setting row names on a tibble is deprecated.
IMR
# A tibble: 2 × 2
  NHBlack NHWhite
*   <dbl>   <dbl>
1      74      35
2   23116   40607
chisq.test(IMR)

    Pearson's Chi-squared test with Yates' continuity correction

data:  IMR
X-squared = 45.66, df = 1, p-value = 1.407e-11

With a p-value of 1.407e-11 I concluded that these values were very significant.

IM |>
  group_by(maternal_race_or_ethnicity) |>
  summarise(mean(infant_mortality_rate))
# A tibble: 7 × 2
  maternal_race_or_ethnicity `mean(infant_mortality_rate)`
  <chr>                                              <dbl>
1 Asian and Pacific Islander                          2.99
2 Black Non-Hispanic                                  8.81
3 Non-Hispanic Black                                  8   
4 Non-Hispanic White                                  2.65
5 Other Hispanic                                      4.38
6 Puerto Rican                                        6.59
7 White Non-Hispanic                                  3.1 
mod <- aov(infant_mortality_rate ~ maternal_race_or_ethnicity, data = IM)
summary(mod)
                           Df Sum Sq Mean Sq F value Pr(>F)    
maternal_race_or_ethnicity  6 238.42   39.74   155.6 <2e-16 ***
Residuals                  41  10.47    0.26                   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Based off of my P value of 2e-16 I would conclude that there is a statistically significant relationship between race & infant mortality rate.

Conclusions

Here I will add a general conclusion, restate any important results from my findings, & state my thoughts on the implications, as well as the validity of my findings

Work Cited

-Mortality rate, infants(per 1,000 live births). (2022). World Bank Open Data. https://data.worldbank.org/indicator/SP.DYN.IMRT.IN

-Infant mortality rate. (2024). We are the Nation’s first line of defense - CIA. https://www.cia.gov/the-world-factbook/field/infant-mortality-rate/country-comparison/

-Infant mortality rates by race/ethnicity: United States, 2018-2020 average. (n.d.). March of Dimes | PeriStats. https://www.marchofdimes.org/peristats/data?reg=99&top=6&stop=92&lev=1&slev=1&obj=1

-Infant mortality. (2024, May 20). Maternal Infant Health. https://www.cdc.gov/maternal-infant-health/infant-mortality/index.html

-Infant mortality in the United States, 2021: Data from the period linked birth/Infant death file.(September).PubMed.https://pubmed.ncbi.nlm.nih.gov/37748084/