Final Project for Advanced Methods

Author

Schaefer and Luttinen

In this study we seek to find connections between two population processes: mortality and fertility. Deaths of despair, first introduced by Case & Deaton (2017) as deaths from suicide, overdoses, and alcohol related injuries, have been on the rise since the 1950s. This phenomenon is seen within non-Hispanic white populations with low levels of education. (Case & Deaton 2017). Fertility, on the other hand, has been decreasing since 2008. Some research, however, has found increases in births to certain segments of the population. For example, Caudillo & Villareal (2021) find a positive association between opioid overdose deaths, a component of deaths of despair, and nonmarital fertility. This study seeks to expand the scope of Caudillo & Villareal (2021) by focusing on various classifications of state-level mortality and nonmarital fertility. 

Theoretical Framework 

We operationalize despair from the lens of mortality. We test several different measures of mortality may capture different dimensions of state-level despair; these include death rates for deaths classified as deaths of despair (we use the Case and Deaton ICD code list), opioid death rates and all cause-mortality amongst working age adults. 

To understand the relationship between state-level despair and nonmarital fertility, we employ three theoretical frameworks. The first framework is the idea that women postpone childbearing in times of economic uncertainty (Morgan & Bachrach & Morgan 2013; Lutz et al. 2006). Although this argument is economic, we believe it applies to mortality because the deaths we are studying are either at early ages or due to unnatural causes. Witnessing an influx of these deaths may induce feelings of “despair.” The second theory explains nonmarital fertility’s connection to despair by arguing that despair leads to hopelessness. Using this framework, women who feel hopeless seek to have children now rather than postpone childbearing they because they believe their situation is not going to improve anyways (Kearny & Levine 2011). 

Lastly, this study uses the concepts of exposure and cumulative disadvantage theory to explain the time-relationship of despair with fertility. Exposure considers which factors a person is exposed to over time to see if it can influence their health outcomes (Merton 1968; Montez & Hayward 2014). Cumulative disadvantage theory explains how an individual’s negative experiences can pile and build off each other to contribute to their poor health (Melchoir et al. 2006). We use the concepts of exposure and cumulative disadvantage in explaining how economic despair can affect nonmarital fertility overtime. For example, a woman may see deaths of despair affecting her community over a certain time period. The longer this period is, the more pronounced the effect of despair on nonmarital fertility decision-making.  

We seek to investigate the validity of these theories by testing the association between nonmarital fertility, deaths of despair, opioid deaths, and working age mortality. Our hypotheses are:   

H1: Higher rates of deaths classified as deaths of despair will be associated with higher rates of nonmarital fertility  

H1a: Length of exposure to deaths of despair will be associated with higher rates of nonmarital fertility 

H2: Higher rates of all-cause working age adult mortality will be associated with higher rates of nonmarital fertility 

H2a: Length of exposure to all-cause working age mortality will be associated with higher rates of nonmarital fertility 

H3: Higher rates of opioid death will be associated with higher rates of nonmarital fertility 

H3a: Length of exposure to opioid deaths will be associated with higher rates of nonmarital fertility 

Literature Survey 

Research has identified a downward trend in nonmarital fertility since 2008. For example, Schneider & Gemmill (2016) use time series analysis and fixed effects methods to study nonmarital fertility using vital statistics and American Community Survey data. They argue that the increased utilization of long-term contraception methods and effects of the Great Recession have led to a decrease in unplanned births. Another project by Kearney & Levine (2015) specifically study trends in the  teen birth rate using vital statistic and census data as well. This study also argues that the increase in unemployment resulting from the Great Recession also led to a decrease in teen births. Both studies investigate state-level trends. 

Studying nonmarital fertility at smaller geographic levels can provide even more finite detail. As mentioned earlier, Caudillo and Villareal (2021) find support for a positive association between opioid death rates and nonmarital fertility at the CPUMA level. Since nonmarital fertility has been decreasing since 2008, Caudillo & Villareal (2021) argue that if there weren’t such an increase in opioid deaths, nonmarital fertility would have decreased further. To investigate this further we sought out to study the relationship between different classifications of mortality: deaths of despair, opioid deaths and working age mortality at the state-level for this project. Our study adds to the literature by investigating opioid death rates and nonmarital fertility at the state-level as well as other classifications of mortality. Moving forward, we plan to carry out this analysis at the county-level to get into even more detail. 

Methods

First, we source mortality rates for deaths of despair, opioid overdose deaths and all-cause working age mortality from CDC wonder for the years 2006-2020 at the state-level. Secondly, we use ACS data from 2010-2021 to calculate state-level nonmarital population estimates. Lastly, we use CDC wonder natality data to get total nonmarried births at the state-level. We then calculate the state-level nonmarital fertility rates. We use the total nonmarital fertility rate as our dependent variable, total nonmarried births over the total nonmarried female population in their childbearing years (15-49). These birth rates are interpreted as births per 1,000 women.

Mortality data is from the CDC WONDER compressed mortality and multiple cause of death files. Midlife Mortality is defined as a death from any cause for an individual between the ages of 25 and 64 (this is the most common age range see Woolf 2018, Woolf 2019, Montez 2022). For deaths of despair we use the ICD classification scheme introduced by Case and Deaton for their cause of death definitions. Opioid death classifications follow the from the work of Caudillo and Villareal. All mortality rates are age-standardized.

Our unit of analysis is state-year. We set the lag between the independent variables, mortality rates and dependent variable, nonmarital fertility rates from 1-5 years to see the differences in the effect of exposure. We use the Hausman test to determine if random effects or fixed effects is the superior specification for each lag. Fixed effects controls for unobserved factors that may be related to either state-level mortality or fertility, while a random effects model allows these unobserved factors to vary. 

1. Load Libraries

library(dplyr)
library(tidyverse)
library(ggplot2)
library(readr)
library(stringr)
library(naniar)
library(foreign)
library(plm)
library(tigris)
library(leaflet)
library(sf)
library(tmap)

2. Import DOD Data

DOD05 <- read_delim("DOD05.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

DOD06 <- read_delim("DOD06.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

DOD07 <- read_delim("DOD07.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

DOD08 <- read_delim("DOD08.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

DOD09 <- read_delim("DOD09.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

DOD10 <- read_delim("DOD10.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

DOD11 <- read_delim("DOD11.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

DOD12 <- read_delim("DOD12.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

DOD13 <- read_delim("DOD13.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

DOD14 <- read_delim("DOD14.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

DOD15 <- read_delim("DOD15.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

DOD16 <- read_delim("DOD16.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

#example of data frame layout
head(DOD16)
# A tibble: 6 × 7
  Notes State    `State Code` Deaths Population `Crude Rate` `Age Adjusted Rate`
  <chr> <chr>    <chr>         <dbl>      <dbl>        <dbl>               <dbl>
1 <NA>  Alabama  01             1902    4863300         39.1                38.1
2 <NA>  Alaska   02              490     741894         66                  64.1
3 <NA>  Arizona  04             3862    6931071         55.7                53.8
4 <NA>  Arkansas 05             1188    2988248         39.8                38.9
5 <NA>  Califor… 06            13683   39250017         34.9                32.7
6 <NA>  Colorado 08             2901    5540545         52.4                50  

3. Clean DOD Data

#05
DOD05$Notes <- NULL 
DOD05 <- DOD05 %>% drop_na()
DOD05$Y05 <- DOD05$`Age Adjusted Rate`
DOD05$Deaths <- NULL
DOD05$Population <- NULL
DOD05$`Crude Rate` <- NULL
DOD05$`Age Adjusted Rate` <- NULL

#06
DOD06$Notes <- NULL
DOD06 <- DOD06 %>% drop_na()
DOD06$Y06 <- DOD06$`Age Adjusted Rate`
DOD06$Deaths <- NULL
DOD06$Population <- NULL
DOD06$`Crude Rate` <- NULL
DOD06$`Age Adjusted Rate` <- NULL

#07
DOD07$Notes <- NULL
DOD07 <- DOD07 %>% drop_na()
DOD07$Y07 <- DOD07$`Age Adjusted Rate`
DOD07$Deaths <- NULL
DOD07$Population <- NULL
DOD07$`Crude Rate` <- NULL
DOD07$`Age Adjusted Rate` <- NULL

#08
DOD08$Notes <- NULL
DOD08 <- DOD08 %>% drop_na()
DOD08$Y08 <- DOD08$`Age Adjusted Rate`
DOD08$Deaths <- NULL
DOD08$Population <- NULL
DOD08$`Crude Rate` <- NULL
DOD08$`Age Adjusted Rate` <- NULL

#09
DOD09$Notes <- NULL
DOD09 <- DOD09 %>% drop_na()
DOD09$Y09 <- DOD09$`Age Adjusted Rate`
DOD09$Deaths <- NULL
DOD09$Population <- NULL
DOD09$`Crude Rate` <- NULL
DOD09$`Age Adjusted Rate` <- NULL

#10
DOD10$Notes <- NULL
DOD10 <- DOD10 %>% drop_na()
DOD10$Y10 <- DOD10$`Age Adjusted Rate`
DOD10$Deaths <- NULL
DOD10$Population <- NULL
DOD10$`Crude Rate` <- NULL
DOD10$`Age Adjusted Rate` <- NULL

#11
DOD11$Notes <- NULL
DOD11 <- DOD11 %>% drop_na()
DOD11$Y11 <- DOD11$`Age Adjusted Rate`
DOD11$Deaths <- NULL
DOD11$Population <- NULL
DOD11$`Crude Rate` <- NULL
DOD11$`Age Adjusted Rate` <- NULL

#12
DOD12$Notes <- NULL
DOD12 <- DOD12 %>% drop_na()
DOD12$Y12 <- DOD12$`Age Adjusted Rate`
DOD12$Deaths <- NULL
DOD12$Population <- NULL
DOD12$`Crude Rate` <- NULL
DOD12$`Age Adjusted Rate` <- NULL

#13
DOD13$Notes <- NULL
DOD13 <- DOD13 %>% drop_na()
DOD13$Y13 <- DOD13$`Age Adjusted Rate`
DOD13$Deaths <- NULL
DOD13$Population <- NULL
DOD13$`Crude Rate` <- NULL
DOD13$`Age Adjusted Rate` <- NULL

#14
DOD14$Notes <- NULL
DOD14 <- DOD14 %>% drop_na()
DOD14$Y14 <- DOD14$`Age Adjusted Rate`
DOD14$Deaths <- NULL
DOD14$Population <- NULL
DOD14$`Crude Rate` <- NULL
DOD14$`Age Adjusted Rate` <- NULL

#15
DOD15$Notes <- NULL
DOD15 <- DOD15 %>% drop_na()
DOD15$Y15 <- DOD15$`Age Adjusted Rate`
DOD15$Deaths <- NULL
DOD15$Population <- NULL
DOD15$`Crude Rate` <- NULL
DOD15$`Age Adjusted Rate` <- NULL

#16
DOD16$Notes <- NULL
DOD16 <- DOD16 %>% drop_na()
DOD16$Y16 <- DOD16$`Age Adjusted Rate`
DOD16$Deaths <- NULL
DOD16$Population <- NULL
DOD16$`Crude Rate` <- NULL
DOD16$`Age Adjusted Rate` <- NULL

#example of cleaned data frame
head(DOD16)
# A tibble: 6 × 3
  State      `State Code`   Y16
  <chr>      <chr>        <dbl>
1 Alabama    01            38.1
2 Alaska     02            64.1
3 Arizona    04            53.8
4 Arkansas   05            38.9
5 California 06            32.7
6 Colorado   08            50  

4. Import Midlife Mort Data

MLM05 <- read_delim("MLM05.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

MLM06 <- read_delim("MLM06.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

MLM07 <- read_delim("MLM07.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

MLM08 <- read_delim("MLM08.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

MLM09 <- read_delim("MLM09.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

MLM10 <- read_delim("MLM10.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

MLM11 <- read_delim("MLM11.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

MLM12 <- read_delim("MLM12.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

MLM13 <- read_delim("MLM13.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

MLM14 <- read_delim("MLM14.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

MLM15 <- read_delim("MLM15.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

MLM16 <- read_delim("MLM16.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)

#example of data frame layout
head(MLM16)
# A tibble: 6 × 7
  Notes State    `State Code` Deaths Population `Crude Rate` `Age Adjusted Rate`
  <chr> <chr>    <chr>         <dbl>      <dbl>        <dbl>               <dbl>
1 <NA>  Alabama  01            14652    2522310         581.                502.
2 <NA>  Alaska   02             1671     402087         416.                379.
3 <NA>  Arizona  04            13885    3456387         402.                355.
4 <NA>  Arkansas 05             8504    1514723         561.                485.
5 <NA>  Califor… 06            62779   20961732         300.                269.
6 <NA>  Colorado 08             9695    3001518         323                 292.

5. Clean Midlife Mort Data

#05
MLM05$Notes <- NULL
MLM05 <- MLM05 %>% drop_na()
MLM05$Y05 <- MLM05$`Age Adjusted Rate`
MLM05$Deaths <- NULL
MLM05$Population <- NULL
MLM05$`Crude Rate` <- NULL
MLM05$`Age Adjusted Rate` <- NULL 

#06
MLM06$Notes <- NULL
MLM06 <- MLM06 %>% drop_na()
MLM06$Y06 <- MLM06$`Age Adjusted Rate`
MLM06$Deaths <- NULL
MLM06$Population <- NULL
MLM06$`Crude Rate` <- NULL
MLM06$`Age Adjusted Rate` <- NULL 

#07
MLM07$Notes <- NULL
MLM07 <- MLM07 %>% drop_na()
MLM07$Y07 <- MLM07$`Age Adjusted Rate`
MLM07$Deaths <- NULL
MLM07$Population <- NULL
MLM07$`Crude Rate` <- NULL
MLM07$`Age Adjusted Rate` <- NULL 

#08
MLM08$Notes <- NULL
MLM08 <- MLM08 %>% drop_na()
MLM08$Y08 <- MLM08$`Age Adjusted Rate`
MLM08$Deaths <- NULL
MLM08$Population <- NULL
MLM08$`Crude Rate` <- NULL
MLM08$`Age Adjusted Rate` <- NULL 

#09
MLM09$Notes <- NULL
MLM09 <- MLM09 %>% drop_na()
MLM09$Y09 <- MLM09$`Age Adjusted Rate`
MLM09$Deaths <- NULL
MLM09$Population <- NULL
MLM09$`Crude Rate` <- NULL
MLM09$`Age Adjusted Rate` <- NULL 

#10
MLM10$Notes <- NULL
MLM10 <- MLM10 %>% drop_na()
MLM10$Y10 <- MLM10$`Age Adjusted Rate`
MLM10$Deaths <- NULL
MLM10$Population <- NULL
MLM10$`Crude Rate` <- NULL
MLM10$`Age Adjusted Rate` <- NULL 

#11
MLM11$Notes <- NULL
MLM11 <- MLM11 %>% drop_na()
MLM11$Y11 <- MLM11$`Age Adjusted Rate`
MLM11$Deaths <- NULL
MLM11$Population <- NULL
MLM11$`Crude Rate` <- NULL
MLM11$`Age Adjusted Rate` <- NULL 

#12
MLM12$Notes <- NULL
MLM12 <- MLM12 %>% drop_na()
MLM12$Y12 <- MLM12$`Age Adjusted Rate`
MLM12$Deaths <- NULL
MLM12$Population <- NULL
MLM12$`Crude Rate` <- NULL
MLM12$`Age Adjusted Rate` <- NULL 

#13
MLM13$Notes <- NULL
MLM13 <- MLM13 %>% drop_na()
MLM13$Y13 <- MLM13$`Age Adjusted Rate`
MLM13$Deaths <- NULL
MLM13$Population <- NULL
MLM13$`Crude Rate` <- NULL
MLM13$`Age Adjusted Rate` <- NULL 

#14
MLM14$Notes <- NULL
MLM14 <- MLM14 %>% drop_na()
MLM14$Y14 <- MLM14$`Age Adjusted Rate`
MLM14$Deaths <- NULL
MLM14$Population <- NULL
MLM14$`Crude Rate` <- NULL
MLM14$`Age Adjusted Rate` <- NULL 

#15
MLM15$Notes <- NULL
MLM15 <- MLM15 %>% drop_na()
MLM15$Y15 <- MLM15$`Age Adjusted Rate`
MLM15$Deaths <- NULL
MLM15$Population <- NULL
MLM15$`Crude Rate` <- NULL
MLM15$`Age Adjusted Rate` <- NULL 

#16
MLM16$Notes <- NULL
MLM16 <- MLM16 %>% drop_na()
MLM16$Y16 <- MLM16$`Age Adjusted Rate`
MLM16$Deaths <- NULL
MLM16$Population <- NULL
MLM16$`Crude Rate` <- NULL
MLM16$`Age Adjusted Rate` <- NULL 

#example of cleaned data layout
head(MLM16)
# A tibble: 6 × 3
  State      `State Code`   Y16
  <chr>      <chr>        <dbl>
1 Alabama    01            502.
2 Alaska     02            379.
3 Arizona    04            355.
4 Arkansas   05            485.
5 California 06            269.
6 Colorado   08            292.

6. Import Opioid data

#05
OP05 <- read_delim("OP05.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)
OP05 <- OP05[-(which(OP05$State %in% "North Dakota")),]
OP05$`Age Adjusted Rate` <- replace(OP05$`Age Adjusted Rate`, 
                                    OP05$`Age Adjusted Rate` == "Unreliable", "NA")
OP05$`Age Adjusted Rate` <- OP05$`Age Adjusted Rate` %>% as.numeric()
OP05$Deaths <- OP05$Deaths %>% as.numeric()
OP05$Population <- OP05$Population %>% as.numeric()
OP05$Calculated <- round((OP05$Deaths/OP05$Population)*100000,
                         digits = 1)
OP05$`Age Adjusted Rate` <- ifelse(is.na(OP05$`Age Adjusted Rate`),
                                   OP05$Calculated, 
                                   OP05$`Age Adjusted Rate`)

#06
OP06 <- read_delim("OP06.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)
OP06 <- OP06[-(which(OP06$State %in% "North Dakota")),]
OP06$`Age Adjusted Rate` <- replace(OP06$`Age Adjusted Rate`, 
                                    OP06$`Age Adjusted Rate` == "Unreliable", "NA")
OP06$`Age Adjusted Rate` <- OP06$`Age Adjusted Rate` %>% as.numeric()
OP06$Deaths <- OP06$Deaths %>% as.numeric()
OP06$Population <- OP06$Population %>% as.numeric()
OP06$Calculated <- round((OP06$Deaths/OP06$Population)*100000,
                         digits = 1)
OP06$`Age Adjusted Rate` <- ifelse(is.na(OP06$`Age Adjusted Rate`),
                                   OP06$Calculated, 
                                   OP06$`Age Adjusted Rate`)

#07
OP07 <- read_delim("OP07.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)
OP07 <- OP07[-(which(OP07$State %in% "North Dakota")),]
OP07$`Age Adjusted Rate` <- replace(OP07$`Age Adjusted Rate`, 
                                    OP07$`Age Adjusted Rate` == "Unreliable", "NA")
OP07$`Age Adjusted Rate` <- OP07$`Age Adjusted Rate` %>% as.numeric()
OP07$Deaths <- OP07$Deaths %>% as.numeric()
OP07$Population <- OP07$Population %>% as.numeric()
OP07$Calculated <- round((OP07$Deaths/OP07$Population)*100000,
                         digits = 1)
OP07$`Age Adjusted Rate` <- ifelse(is.na(OP07$`Age Adjusted Rate`),
                                   OP07$Calculated, 
                                   OP07$`Age Adjusted Rate`)

#08
OP08 <- read_delim("OP08.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)
OP08 <- OP08[-(which(OP08$State %in% "North Dakota")),]
OP08$`Age Adjusted Rate` <- replace(OP08$`Age Adjusted Rate`, OP08$`Age Adjusted Rate` == "Unreliable", "NA")
OP08$`Age Adjusted Rate` <- OP08$`Age Adjusted Rate` %>% as.numeric()
OP08$Deaths <- OP08$Deaths %>% as.numeric()
OP08$Population <- OP08$Population %>% as.numeric()
OP08$Calculated <- round((OP08$Deaths/OP08$Population)*100000,digits = 1)
OP08$`Age Adjusted Rate` <- ifelse(is.na(OP08$`Age Adjusted Rate`), OP08$Calculated, OP08$`Age Adjusted Rate`)

#09
OP09 <- read_delim("OP09.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)
OP09 <- OP09[-(which(OP09$State %in% "North Dakota")),]
OP09$`Age Adjusted Rate` <- replace(OP09$`Age Adjusted Rate`, OP09$`Age Adjusted Rate` == "Unreliable", "NA")
OP09$`Age Adjusted Rate` <- OP09$`Age Adjusted Rate` %>% as.numeric()
OP09$Deaths <- OP09$Deaths %>% as.numeric()
OP09$Population <- OP09$Population %>% as.numeric()
OP09$Calculated <- round((OP09$Deaths/OP09$Population)*100000,digits = 1)
OP09$`Age Adjusted Rate` <- ifelse(is.na(OP09$`Age Adjusted Rate`), OP09$Calculated, OP09$`Age Adjusted Rate`)

#10
OP10 <- read_delim("OP10.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)
OP10 <- OP10[-(which(OP10$State %in% "North Dakota")),]
OP10$`Age Adjusted Rate` <- replace(OP10$`Age Adjusted Rate`, OP10$`Age Adjusted Rate` == "Unreliable", "NA")
OP10$`Age Adjusted Rate` <- OP10$`Age Adjusted Rate` %>% as.numeric()
OP10$Deaths <- OP10$Deaths %>% as.numeric()
OP10$Population <- OP10$Population %>% as.numeric()
OP10$Calculated <- round((OP10$Deaths/OP10$Population)*100000,digits = 1)
OP10$`Age Adjusted Rate` <- ifelse(is.na(OP10$`Age Adjusted Rate`), OP10$Calculated, OP10$`Age Adjusted Rate`)

#11
OP11 <- read_delim("OP11.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)
OP11 <- OP11[-(which(OP11$State %in% "North Dakota")),]
OP11$`Age Adjusted Rate` <- replace(OP11$`Age Adjusted Rate`, OP11$`Age Adjusted Rate` == "Unreliable", "NA")
OP11$`Age Adjusted Rate` <- OP11$`Age Adjusted Rate` %>% as.numeric()
OP11$Deaths <- OP11$Deaths %>% as.numeric()
OP11$Population <- OP11$Population %>% as.numeric()
OP11$Calculated <- round((OP11$Deaths/OP11$Population)*100000,digits = 1)
OP11$`Age Adjusted Rate` <- ifelse(is.na(OP11$`Age Adjusted Rate`), OP11$Calculated, OP11$`Age Adjusted Rate`)

#12
OP12 <- read_delim("OP12.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)
OP12 <- OP12[-(which(OP12$State %in% "North Dakota")),]
OP12$`Age Adjusted Rate` <- replace(OP12$`Age Adjusted Rate`, OP12$`Age Adjusted Rate` == "Unreliable", "NA")
OP12$`Age Adjusted Rate` <- OP12$`Age Adjusted Rate` %>% as.numeric()
OP12$Deaths <- OP12$Deaths %>% as.numeric()
OP12$Population <- OP12$Population %>% as.numeric()
OP12$Calculated <- round((OP12$Deaths/OP12$Population)*100000,digits = 1)
OP12$`Age Adjusted Rate` <- ifelse(is.na(OP12$`Age Adjusted Rate`), OP12$Calculated, OP12$`Age Adjusted Rate`)

#13
OP13 <- read_delim("OP13.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)
OP13 <- OP13[-(which(OP13$State %in% "North Dakota")),]
OP13$`Age Adjusted Rate` <- replace(OP13$`Age Adjusted Rate`, OP13$`Age Adjusted Rate` == "Unreliable", "NA")
OP13$`Age Adjusted Rate` <- OP13$`Age Adjusted Rate` %>% as.numeric()
OP13$Deaths <- OP13$Deaths %>% as.numeric()
OP13$Population <- OP13$Population %>% as.numeric()
OP13$Calculated <- round((OP13$Deaths/OP13$Population)*100000,digits = 1)
OP13$`Age Adjusted Rate` <- ifelse(is.na(OP13$`Age Adjusted Rate`), OP13$Calculated, OP13$`Age Adjusted Rate`)

#14
OP14 <- read_delim("OP14.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)
OP14 <- OP14[-(which(OP14$State %in% "North Dakota")),]
OP14$`Age Adjusted Rate` <- replace(OP14$`Age Adjusted Rate`, OP14$`Age Adjusted Rate` == "Unreliable", "NA")
OP14$`Age Adjusted Rate` <- OP14$`Age Adjusted Rate` %>% as.numeric()
OP14$Deaths <- OP14$Deaths %>% as.numeric()
OP14$Population <- OP14$Population %>% as.numeric()
OP14$Calculated <- round((OP14$Deaths/OP14$Population)*100000,digits = 1)
OP14$`Age Adjusted Rate` <- ifelse(is.na(OP14$`Age Adjusted Rate`), OP14$Calculated, OP14$`Age Adjusted Rate`)

#15
OP15 <- read_delim("OP15.txt", 
    delim = "\t", escape_double = FALSE, 
    trim_ws = TRUE)
OP15 <- OP15[-(which(OP15$State %in% "North Dakota")),]
OP15$`Age Adjusted Rate` <- replace(OP15$`Age Adjusted Rate`, OP15$`Age Adjusted Rate` == "Unreliable", "NA")
OP15$`Age Adjusted Rate` <- OP15$`Age Adjusted Rate` %>% as.numeric()
OP15$Deaths <- OP15$Deaths %>% as.numeric()
OP15$Population <- OP15$Population %>% as.numeric()
OP15$Calculated <- round((OP15$Deaths/OP15$Population)*100000,digits = 1)
OP15$`Age Adjusted Rate` <- ifelse(is.na(OP15$`Age Adjusted Rate`), OP15$Calculated, OP15$`Age Adjusted Rate`)

7. Clean Opioid data

#05
OP05$Notes <- NULL
OP05 <- OP05 %>% drop_na()
OP05$Y05 <- OP05$`Age Adjusted Rate`
OP05$Deaths <- NULL
OP05$Population <- NULL
OP05$`Crude Rate` <- NULL
OP05$`Age Adjusted Rate` <- NULL 
OP05$Calculated <- NULL

#06
OP06$Notes <- NULL
OP06 <- OP06 %>% drop_na()
OP06$Y06 <- OP06$`Age Adjusted Rate`
OP06$Deaths <- NULL
OP06$Population <- NULL
OP06$`Crude Rate` <- NULL
OP06$`Age Adjusted Rate` <- NULL 
OP06$Calculated <- NULL

#07
OP07$Notes <- NULL
OP07 <- OP07 %>% drop_na()
OP07$Y07 <- OP07$`Age Adjusted Rate`
OP07$Deaths <- NULL
OP07$Population <- NULL
OP07$`Crude Rate` <- NULL
OP07$`Age Adjusted Rate` <- NULL 
OP07$Calculated <- NULL

#08
OP08$Notes <- NULL
OP08 <- OP08 %>% drop_na()
OP08$Y08 <- OP08$`Age Adjusted Rate`
OP08$Deaths <- NULL
OP08$Population <- NULL
OP08$`Crude Rate` <- NULL
OP08$`Age Adjusted Rate` <- NULL 
OP08$Calculated <- NULL

#09
OP09$Notes <- NULL
OP09 <- OP09 %>% drop_na()
OP09$Y09 <- OP09$`Age Adjusted Rate`
OP09$Deaths <- NULL
OP09$Population <- NULL
OP09$`Crude Rate` <- NULL
OP09$`Age Adjusted Rate` <- NULL 
OP09$Calculated <- NULL

#10
OP10$Notes <- NULL
OP10 <- OP10 %>% drop_na()
OP10$Y10 <- OP10$`Age Adjusted Rate`
OP10$Deaths <- NULL
OP10$Population <- NULL
OP10$`Crude Rate` <- NULL
OP10$`Age Adjusted Rate` <- NULL 
OP10$Calculated <- NULL

#11
OP11$Notes <- NULL
OP11 <- OP11 %>% drop_na()
OP11$Y11 <- OP11$`Age Adjusted Rate`
OP11$Deaths <- NULL
OP11$Population <- NULL
OP11$`Crude Rate` <- NULL
OP11$`Age Adjusted Rate` <- NULL 
OP11$Calculated <- NULL

#12
OP12$Notes <- NULL
OP12 <- OP12 %>% drop_na()
OP12$Y12 <- OP12$`Age Adjusted Rate`
OP12$Deaths <- NULL
OP12$Population <- NULL
OP12$`Crude Rate` <- NULL
OP12$`Age Adjusted Rate` <- NULL 
OP12$Calculated <- NULL

#13
OP13$Notes <- NULL
OP13 <- OP13 %>% drop_na()
OP13$Y13 <- OP13$`Age Adjusted Rate`
OP13$Deaths <- NULL
OP13$Population <- NULL
OP13$`Crude Rate` <- NULL
OP13$`Age Adjusted Rate` <- NULL 
OP13$Calculated <- NULL

#14
OP14$Notes <- NULL
OP14 <- OP14 %>% drop_na()
OP14$Y14 <- OP14$`Age Adjusted Rate`
OP14$Deaths <- NULL
OP14$Population <- NULL
OP14$`Crude Rate` <- NULL
OP14$`Age Adjusted Rate` <- NULL 
OP14$Calculated <- NULL

#15
OP15$Notes <- NULL
OP15 <- OP15 %>% drop_na()
OP15$Y15 <- OP15$`Age Adjusted Rate`
OP15$Deaths <- NULL
OP15$Population <- NULL
OP15$`Crude Rate` <- NULL
OP15$`Age Adjusted Rate` <- NULL 
OP15$Calculated <- NULL

8. Join data sets

DODlist_df = list(DOD05, DOD06, DOD07, DOD08, DOD09, DOD10, DOD11, DOD12, DOD13, DOD14, DOD15, DOD16)
DODtestdf <- DODlist_df %>% reduce(inner_join, by=c('State', 'State Code'))

MLMlist_df = list(MLM05, MLM06, MLM07, MLM08, MLM09, MLM10, MLM11, MLM12, MLM13, MLM14, MLM15, MLM16)
MLMtestdf <- MLMlist_df %>% reduce(inner_join, by=c('State', 'State Code'))

OPlist_df =list(OP05, OP06, OP07, OP08, OP09, OP10, OP11, OP12, OP13, OP14, OP15)
OPtestdf <- OPlist_df %>% reduce(inner_join,by=c('State', 'State Code'))

fulllist <- list(DODtestdf, MLMtestdf, OPtestdf)
fulldataset <- fulllist %>% reduce(inner_join, by=c('State', 'State Code'))

9. create long deaths of despair data frame

longDODdata <- DODtestdf %>% pivot_longer(cols = c(Y05, Y06, Y07, Y08, Y09, Y10, Y11, Y12, Y13, Y14, Y15, Y16), 
                                          names_to = 'year', 
                                          values_to = 'DDR')

10. create long midlife mortality data frame

longMLMdata <- MLMtestdf %>% pivot_longer(cols=c(Y05, Y06, Y07, Y08, Y09, Y10, Y11, Y12, Y13, Y14, Y15, Y16),
                                          names_to = 'year', 
                                          values_to = 'MLDR')

11. create long opioid data frame

longOPdata <- OPtestdf %>% pivot_longer(cols = c(Y05, Y06, Y07, Y08, Y09, Y10, Y11, Y12, Y13, Y14, Y15), 
                                        names_to = 'year', 
                                        values_to = 'OPDR')

12. Long format for all mortality indicators

fulllonglist <- list(longDODdata, longMLMdata, longOPdata)
fulllongdataset <- fulllonglist %>% 
  reduce(inner_join, by=c('State', 'State Code', 'year'))

13. read in non marital fertility rates and clean

nmfr <- read_csv("nmfr.csv")

nmfr$...1 <- NULL
nmfr$Pop <- NULL
nmfr$Births <- NULL

nmfr$STATEFIP <- nmfr$STATEFIP %>% str_pad(2,pad = "0")
nmfr$year5 <- nmfr$YEAR-5
nmfr$year4 <- nmfr$YEAR-4
nmfr$year3 <- nmfr$YEAR-3
nmfr$year2 <- nmfr$YEAR-2
nmfr$year1 <- nmfr$YEAR-1

fulllongdataset$STATEFIP <- fulllongdataset$`State Code`
fulllongdataset$`State Code` <- NULL
fulllongdataset <- fulllongdataset %>% 
  mutate(year = recode(year, Y05 = '2005', Y06='2006', Y07='2007',Y08='2008',Y09='2009',Y10='2010',Y11='2011',Y12='2012',Y13='2013',Y14='2014',Y15='2015'))

nmfr <- nmfr %>% drop_na()

14. set up five year lag

#with a five year lag
fiveyeartestmerge <- merge(fulllongdataset, nmfr, by.x=c('STATEFIP', 'year'), by.y=c('STATEFIP', 'year5'))

15. set up four year lag

fouryeartestmerge <- merge(fulllongdataset, nmfr, by.x=c('STATEFIP', 'year'), by.y=c('STATEFIP', 'year4'))

16. set up three year lag

threeyeartestmerge <- merge(fulllongdataset, nmfr, by.x=c('STATEFIP', 'year'), by.y=c('STATEFIP', 'year3'))

17. set up two year lag

twoyeartestmerge <- merge(fulllongdataset, nmfr, by.x=c('STATEFIP', 'year'), by.y=c('STATEFIP', 'year2'))

18. set up one year lag

oneyeartestmerge <- merge(fulllongdataset, nmfr, by.x=c('STATEFIP', 'year'), by.y=c('STATEFIP', 'year1'))

19. graphs for deaths of despair

fulllongdataset %>% ggplot(aes(x=year, y=DDR, group=State))+
  geom_line(aes(color=State))+
  geom_point(aes(color=State))+
  ggtitle("Mortality Rates for \n Deaths of Despair")+
  xlab("Year")+
  ylab("Mortality Rate per 100,000")+
  labs(caption = "Mortality rates are age standardized \n Source: CDC WONDER")

fulllongdataset %>% ggplot(aes(x=year, y=DDR, group=State))+
  geom_line()+
  geom_point()+
  facet_wrap(~ State)+
  ggtitle("Yearly mortality rates for deaths \n classified as deaths of despair")+
  xlab("Year")+
  ylab("Mortality Rate per 100,000")+
  labs(caption = "Mortality rates are age standardized \n Source: CDC WONDER")

20. graphs for midlife mortality

fulllongdataset %>% ggplot(aes(x=year, y=MLDR, group=State))+
  geom_line(aes(color=State))+
  geom_point(aes(color=State))+
  ggtitle("Mortality rates \n for Midlife Mortality")+
  xlab("Year")+
  ylab("Mortality Rate per 100,000")+
  labs(caption = "Mortality rates are age standardized \n Source: CDC WONDER")

fulllongdataset %>% ggplot(aes(x=year, y=MLDR, group=State))+
  geom_line()+
  geom_point()+
  facet_wrap(~State)+
  ggtitle("Yearly mortality rates for midlife mortality")+
  xlab("Year")+
  ylab("Mortality Rate per 100,000")+
  labs(caption = "Mortality rates are age standardized \n Source: CDC WONDER")

21. graphs for opioid deaths

fulllongdataset %>% ggplot(aes(x=year, y=OPDR, group=State))+
  geom_line(aes(color=State))+
  geom_point(aes(color=State))+
  ggtitle("Mortality Rates for \n Deaths with Opioids")+
  xlab("Year")+
  ylab("Mortality Rate per 100,000")+
  labs(caption = "Mortality rates are age standardized \n Source: CDC WONDER")

fulllongdataset %>% ggplot(aes(x=year, y=OPDR, group=State))+
  geom_line()+
  geom_point()+
  facet_wrap(~ State)+
  ggtitle("Yearly mortality rates for deaths with opioids")+
  xlab("Year")+
  ylab("Mortality Rate per 100,000")+
  labs(caption = "Mortality rates are age standardized \n Source: CDC WONDER")

22. graphs for nonmarital fertility

fiveyeartestmerge %>% ggplot(aes(x=YEAR, y=nmfr, group=State))+
  geom_line(aes(color=State))+
  geom_point(aes(color=State))+
  ggtitle("Nonmarital Fertility Rates")+
  xlab("Year")+
  ylab("Nonmarital fertiltiy rate")+
  labs(caption = "Source: ACS")

oneyeartestmerge %>% ggplot(aes(x=YEAR, y=nmfr, group=State))+geom_line()+geom_point()+facet_wrap(~State)+
  ggtitle("Yearly nonmarital fertility rates")+
  xlab("Year")+
  ylab("Nonmarital fertiltiy rate")+
  labs(caption = "Source: ACS")

23. set up data frames for maps

states2<-states%>%
  filter(substr(GEOID, 1, 2) != "02") %>%
  filter(substr(GEOID, 1, 2) != "15") %>%
  filter(substr(GEOID, 1, 2) != "66") %>%
  filter(substr(GEOID, 1, 2) != "72")

states2$STATEFIP<-states2$GEOID
full<-merge(fiveyeartestmerge,states2, by="STATEFIP")

24. Maps for midlife mortality

We exclude North Dakota due to suppressions for certain causes of death from CDC WONDER. California is missing data for some years due to state privacy concerns with data sharing.

full2020<-full%>%
filter(YEAR=="2020")
full2020 <- st_sf(full2020)

full2015 <- full %>%
  filter(YEAR=="2015")
full2015 <- st_sf(full2015)

full2010<-full%>%
filter(YEAR=="2010")
full2010 <- st_sf(full2010)

ggplot(data=full2010, aes(fill = MLDR))+ geom_sf()+
  ggtitle("Mortality Rates for Midlife Mortality - 2010")+
  ggthemes::theme_map()+
  labs(caption = "Source: CDC WONDER \n Midlife mortality defined as ages 25-64")

ggplot(data=full2015, aes(fill = MLDR))+ geom_sf()+
  ggtitle("Mortality Rates for Midlife Mortality - 2015")+
  ggthemes::theme_map()+
  labs(caption = "Source: CDC WONDER \n Midlife mortality defined as ages 25-64")

ggplot(data=full2020, aes(fill = MLDR))+ geom_sf()+
  ggtitle("Mortality Rates for Midlife Mortality - 2020")+
  ggthemes::theme_map()+
  labs(caption = "Source: CDC WONDER \n Midlife mortality defined as ages 25-64")

25. Map for deaths of despair

ggplot(data=full2010, aes(fill = DDR))+ geom_sf()+
  ggtitle("Mortality Rates for deaths of despair - 2010")+
  ggthemes::theme_map()+
  labs(caption = "Source: CDC WONDER \n Deaths of despair follow Case and Deaton's classifications")

ggplot(data=full2015, aes(fill = DDR))+ geom_sf()+
  ggtitle("Mortality Rates for deaths of despair - 2015")+
  ggthemes::theme_map()+
  labs(caption = "Source: CDC WONDER \n Deaths of despair follow Case and Deaton's classifications")

ggplot(data=full2020, aes(fill = DDR))+ geom_sf()+
  ggtitle("Mortality Rates for deaths of despair - 2020")+
  ggthemes::theme_map()+
  labs(caption = "Source: CDC WONDER \n Deaths of despair follow Case and Deaton's classifications")

26. maps for opioids

ggplot(data=full2010, aes(fill = OPDR))+ geom_sf()+
  ggtitle("Mortality Rates from Opioids - 2010")+
  ggthemes::theme_map()+
  labs(caption = "Source: CDC WONDER \n ")

ggplot(data=full2015, aes(fill = OPDR))+ geom_sf()+
  ggtitle("Mortality Rates from Opioids - 2015")+
  ggthemes::theme_map()+
  labs(caption = "Source: CDC WONDER \n ")

ggplot(data=full2020, aes(fill = OPDR))+ geom_sf()+
  ggtitle("Mortality Rates from Opioids - 2020")+
  ggthemes::theme_map()+
  labs(caption = "Source: CDC WONDER \n ")

Nonmarital fertility maps

ggplot(data=full2010, aes(fill = nmfr))+ geom_sf()+
  ggtitle("Nonmarital Fertility Rates - 2010")+
  ggthemes::theme_map()+
  labs(caption = "Source: ACS")+ 
  scale_fill_distiller(palette = "RdPu", direction = 1)

ggplot(data=full2015, aes(fill = nmfr))+ geom_sf()+
  ggtitle("Nonmarital Fertility Rates - 2015")+
  ggthemes::theme_map()+
  labs(caption = "Source: ACS")+ 
  scale_fill_distiller(palette = "RdPu", direction = 1)

ggplot(data=full2020, aes(fill = nmfr))+ geom_sf()+
  ggtitle("Nonmarital Fertility Rates - 2020")+
  ggthemes::theme_map()+
  labs(caption = "Source: ACS")+ 
  scale_fill_distiller(palette = "RdPu", direction = 1)

27. Bivariate plots with five year lag for midlife mortality and nonmarital ferility

fiveyeartestmerge2020 <- fiveyeartestmerge %>% 
  filter(YEAR==2020)
fiveyeartestmerge2015 <- fiveyeartestmerge %>%
  filter(YEAR==2015)
fiveyeartestmerge2010 <- fiveyeartestmerge %>%
  filter(YEAR==2010)

ggplot(data=fiveyeartestmerge2020, aes(x=MLDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Midlife Mortality and Nonmarital Fertility - 2020 (Five Year Lag)")+
  labs(caption = "2020 Ferility and 2015 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Midlife Mortality Rate")+
  ylab("Nonmarital Fertility rate")

ggplot(data=fiveyeartestmerge2015, aes(x=MLDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Midlife Mortality and Nonmarital Fertility - 2015 (Five Year Lag)")+
  labs(caption = "2015 Ferility and 2010 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Midlife Mortality Rate")+
  ylab("Nonmarital Fertility Rate")

ggplot(data=fiveyeartestmerge2010, aes(x=MLDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Midlife Mortality and Nonmarital Fertility - 2010 (Five Year Lag)")+
  labs(caption = "2010 Ferility and 2005 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Midlife Mortality Rate")+
  ylab("Nonmarital Fertility rate")

28. Bivariate plots with three year lag for midlife mortality and nonmarital ferility

threeyeartestmerge2018 <- threeyeartestmerge %>% 
  filter(YEAR==2018)
threeyeartestmerge2014 <- threeyeartestmerge %>%
  filter(YEAR==2014)
threeyeartestmerge2010 <- threeyeartestmerge %>%
  filter(YEAR==2010)

ggplot(data=threeyeartestmerge2018, aes(x=MLDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Midlife Mortality and Nonmarital Fertility - 2018 (Three Year Lag)")+
  labs(caption = "2018 Ferility and 2015 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Midlife Mortality Rate")+
  ylab("Nonmarital Fertility rate")

ggplot(data=threeyeartestmerge2014, aes(x=MLDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Midlife Mortality and Nonmarital Fertility - 2014 (Three Year Lag)")+
  labs(caption = "2014 Ferility and 2012 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Midlife Mortality Rate")+
  ylab("Nonmarital Fertility rate")

ggplot(data=threeyeartestmerge2010, aes(x=MLDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Midlife Mortality and Nonmarital Fertility - 2010 (Three Year Lag)")+
  labs(caption = "2010 Ferility and 2007 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Midlife Mortality Rate")+
  ylab("Nonmarital Fertility rate")

29. Bivariate plots with one year lag for midlife mortality and nonmarital ferility

oneyearyeartestmerge2016 <- oneyeartestmerge %>% 
  filter(YEAR==2016)
oneyeartestmerge2013 <- oneyeartestmerge %>%
  filter(YEAR==2013)
oneyeartestmerge2010 <- oneyeartestmerge %>%
  filter(YEAR==2010)

ggplot(data=oneyearyeartestmerge2016, aes(x=MLDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Midlife Mortality and Nonmarital Fertility - 2016 (One Year Lag)")+
  labs(caption = "2016 Ferility and 2015 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Midlife Mortality Rate")+
  ylab("Nonmarital Fertility rate")

ggplot(data=oneyeartestmerge2013, aes(x=MLDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Midlife Mortality and Nonmarital Fertility - 2013 (One Year Lag)")+
  labs(caption = "2013 Ferility and 2012 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Midlife Mortality Rate")+
  ylab("Nonmarital Fertility rate")

ggplot(data=oneyeartestmerge2010, aes(x=MLDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Midlife Mortality and Nonmarital Fertility - 2010 (One Year Lag)")+
  labs(caption = "2010 Ferility and 2009 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Midlife Mortality Rate")+
  ylab("Nonmarital Fertility rate")

30. Bivariate plots with five year lag for deaths of despair and nonmarital fertility

ggplot(data=fiveyeartestmerge2020, aes(x=DDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Deaths of Despair and Nonmarital Fertility - 2020 (Five Year Lag)")+
  labs(caption = "2020 Ferility and 2015 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Deaths of Despair Mortality Rate")+
  ylab("Nonmarital Fertility rate")

ggplot(data=fiveyeartestmerge2015, aes(x=DDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Deaths of Despair and Nonmarital Fertility - 2015 (Five Year Lag)")+
  labs(caption = "2015 Ferility and 2010 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Deaths of Despair Mortality Rate")+
  ylab("Nonmarital Fertility rate")

ggplot(data=fiveyeartestmerge2010, aes(x=DDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Deaths of Despair and Nonmarital Fertility - 2010 (Five Year Lag)")+
  labs(caption = "2010 Ferility and 2005 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Deaths of Despair Mortality Rate")+
  ylab("Nonmarital Fertility rate")

31. Bivariate plots with three year lag for deaths of despair and nonmarital fertility

ggplot(data=threeyeartestmerge2018, aes(x=DDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Deaths of Despair and Nonmarital Fertility - 2018 (Three Year Lag)")+
  labs(caption = "2018 Ferility and 2015 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Deaths of Despair Mortality Rate")+
  ylab("Nonmarital Fertility rate")

ggplot(data=threeyeartestmerge2014, aes(x=DDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Deaths of Despair and Nonmarital Fertility - 2014 (Three Year Lag)")+
  labs(caption = "2014 Ferility and 2011 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Deaths of Despair Mortality Rate")+
  ylab("Nonmarital Fertility rate")

ggplot(data=threeyeartestmerge2010, aes(x=DDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Deaths of Despair and Nonmarital Fertility - 2010 (Three Year Lag)")+
  labs(caption = "2010 Ferility and 2007 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Deaths of Despair Mortality Rate")+
  ylab("Nonmarital Fertility rate")

32. Bivariate plots with one year lags for deaths of despair deaths and nonmarital ferility

ggplot(data=oneyearyeartestmerge2016, aes(x=DDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Deaths of Despair and Nonmarital Fertility - 2016 (One Year Lag)")+
  labs(caption = "2016 Ferility and 2015 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Deaths of Despair Mortality Rate")+
  ylab("Nonmarital Fertility rate")

ggplot(data=oneyeartestmerge2013, aes(x=DDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Deaths of Despair and Nonmarital Fertility - 2013 (One Year Lag)")+
  labs(caption = "2013 Ferility and 2012 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Deaths of Despair Mortality Rate")+
  ylab("Nonmarital Fertility rate")

ggplot(data=oneyeartestmerge2010, aes(x=DDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Deaths of Despair and Nonmarital Fertility - 2010 (One Year Lag)")+
  labs(caption = "2010 Ferility and 2009 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Deaths of Despair Mortality Rate")+
  ylab("Nonmarital Fertility rate")

33. Bivariate plots with five year lags for opioid deaths and nonmarital ferility

ggplot(data=fiveyeartestmerge2020, aes(x=OPDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Opioid Mortality and Nonmarital Fertility - 2020 (Five Year Lag)")+
  labs(caption = "2020 Ferility and 2015 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Opioid related Mortality Rate")+
  ylab("Nonmarital Fertility rate")

ggplot(data=fiveyeartestmerge2015, aes(x=OPDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Opioid Mortality and Nonmarital Fertility - 2015 (Five Year Lag)")+
  labs(caption = "2015 Ferility and 2010 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Opioid related Mortality Rate")+
  ylab("Nonmarital Fertility rate")

ggplot(data=fiveyeartestmerge2010, aes(x=OPDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Opioid Mortality and Nonmarital Fertility - 2010 (Five Year Lag)")+
  labs(caption = "2010 Ferility and 2005 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Opioid related Mortality Rate")+
  ylab("Nonmarital Fertility rate")

34. Bivariate plots with three year lags for opioid deaths and nonmarital ferility

ggplot(data=threeyeartestmerge2018, aes(x=OPDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Opioid Mortality and Nonmarital Fertility - 2018 (Three Year Lag)")+
  labs(caption = "2018 Ferility and 2015 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Opioid related Mortality Rate")+
  ylab("Nonmarital Fertility rate")

ggplot(data=threeyeartestmerge2014, aes(x=OPDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Opioid Mortality and Nonmarital Fertility - 2014 (Three Year Lag)")+
  labs(caption = "2014 Ferility and 2011 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Opioid related Mortality Rate")+
  ylab("Nonmarital Fertility rate")

ggplot(data=threeyeartestmerge2010, aes(x=OPDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Opioid Mortality and Nonmarital Fertility - 2010 (Three Year Lag)")+
  labs(caption = "2010 Ferility and 2007 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Opioid related Mortality Rate")+
  ylab("Nonmarital Fertility rate")

35. Bivariate plots with one year lags for opioid deaths and nonmarital ferility

ggplot(data=oneyearyeartestmerge2016, aes(x=OPDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Opioid Mortality and Nonmarital Fertility - 2016 (One Year Lag)")+
  labs(caption = "2016 Ferility and 2015 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Opioid related Mortality Rate")+
  ylab("Nonmarital Fertility rate")

ggplot(data=oneyeartestmerge2013, aes(x=OPDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Opioid Mortality and Nonmarital Fertility - 2013 (One Year Lag)")+
  labs(caption = "2013 Ferility and 2012 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Opioid related Mortality Rate")+
  ylab("Nonmarital Fertility rate")

ggplot(data=oneyeartestmerge2010, aes(x=OPDR, y=nmfr)) +
  geom_point() +
  geom_smooth(method=lm)+
  ggtitle("Opioid Mortality and Nonmarital Fertility - 2010 (One Year Lag)")+
  labs(caption = "2010 Ferility and 2009 Mortality Rates \n Sources: ACS and CDC WONDER")+
  xlab("Opioid related Mortality Rate")+
  ylab("Nonmarital Fertility rate")

Now, we show the correlation between the three different mortality indicators with nonmarital fertility with different lag schemes. Some of the coefficients are reasonably strong (such as midlife mortality and nonmaritial ferility which is consistent with the previous plots).

36. correlation between different indicators with five year lag

#mid life mortality and nonmarital fertility
cor(fiveyeartestmerge$MLDR, fiveyeartestmerge$nmfr)
[1] 0.6495454
#deaths of despair and nonmarital fertility
cor(fiveyeartestmerge$DDR, fiveyeartestmerge$nmfr)
[1] 0.05213902
#opioid deaths and nonmarital fertility
cor(fiveyeartestmerge$OPDR, fiveyeartestmerge$nmfr)
[1] -0.166279

37. correlation between different indicators with four year lag

#mid life mortality and nonmarital fertility
cor(fouryeartestmerge$MLDR, fouryeartestmerge$nmfr)
[1] 0.6507215
#deaths of despair and nonmarital fertility
cor(fouryeartestmerge$DDR, fouryeartestmerge$nmfr)
[1] 0.08268375
#opioid deaths and nonmarital fertility
cor(fouryeartestmerge$OPDR, fouryeartestmerge$nmfr)
[1] -0.1368531

38. correlation between different indicators with three year lag

#mid life mortality and nonmarital fertility
cor(threeyeartestmerge$MLDR, threeyeartestmerge$nmfr)
[1] 0.6513654
#deaths of despair and nonmarital fertility
cor(threeyeartestmerge$DDR, threeyeartestmerge$nmfr)
[1] 0.09573672
#opioid deaths and nonmarital fertility
cor(threeyeartestmerge$OPDR, threeyeartestmerge$nmfr)
[1] -0.1226983

39. correlation between different indicators with two year lag

#mid life mortality and nonmarital fertility
cor(twoyeartestmerge$MLDR, twoyeartestmerge$nmfr)
[1] 0.6583056
#deaths of despair and nonmarital fertility
cor(twoyeartestmerge$DDR, twoyeartestmerge$nmfr)
[1] 0.1138378
#opioid deaths and nonmarital fertility
cor(twoyeartestmerge$OPDR, twoyeartestmerge$nmfr)
[1] -0.1109387

40. correlation between different indicators with one year lag

#mid life mortality and nonmarital fertility
cor(oneyeartestmerge$MLDR, oneyeartestmerge$nmfr)
[1] 0.674302
#deaths of despair and nonmarital fertility
cor(oneyeartestmerge$DDR, oneyeartestmerge$nmfr)
[1] 0.125499
#opioid deaths and nonmarital fertility
cor(oneyeartestmerge$OPDR, oneyeartestmerge$nmfr)
[1] -0.1156244

Next, we present fixed and random effect models for the three different mortality indicators with nonmarital fertility (we use lag times of five, four, three, two, and one years). We will interpret an early output as an example. We also run the Hausman test for every set of models to test whether fixed or random effects is preferable.

41. fixed effect models with states included with five year lags

MLmodel5 <- lm(nmfr ~ MLDR + State -1, data=fiveyeartestmerge)
summary(MLmodel5)

Call:
lm(formula = nmfr ~ MLDR + State - 1, data = fiveyeartestmerge)

Residuals:
    Min      1Q  Median      3Q     Max 
-48.403  -2.687   0.320   2.665  18.012 

Coefficients:
                          Estimate Std. Error t value Pr(>|t|)    
MLDR                       0.03589    0.01489   2.410  0.01631 *  
StateAlabama              39.85560    7.29915   5.460 7.53e-08 ***
StateAlaska               43.20804    5.31573   8.128 3.50e-15 ***
StateArizona              49.66729    5.30248   9.367  < 2e-16 ***
StateArkansas             51.32047    7.06274   7.266 1.44e-12 ***
StateCalifornia           38.91880    4.56460   8.526  < 2e-16 ***
StateColorado             24.78962    4.43803   5.586 3.84e-08 ***
StateConnecticut          25.49018    4.18153   6.096 2.19e-09 ***
StateDelaware             35.91660    5.59289   6.422 3.16e-10 ***
StateDistrict of Columbia 19.81661    7.29424   2.717  0.00682 ** 
StateFlorida              41.37817    5.49338   7.532 2.38e-13 ***
StateGeorgia              43.98924    5.89061   7.468 3.70e-13 ***
StateHawaii               40.64329    4.48653   9.059  < 2e-16 ***
StateIdaho                35.35163    4.67320   7.565 1.90e-13 ***
StateIllinois             38.48395    4.94521   7.782 4.18e-14 ***
StateIndiana              44.49585    5.75567   7.731 5.99e-14 ***
StateIowa                 39.05491    4.65229   8.395 4.92e-16 ***
StateKansas               44.09800    5.17540   8.521  < 2e-16 ***
StateKentucky             46.74437    6.85299   6.821 2.64e-11 ***
StateLouisiana            49.08901    7.16083   6.855 2.12e-11 ***
StateMaine                30.28824    4.80598   6.302 6.49e-10 ***
StateMaryland             31.86271    5.09558   6.253 8.69e-10 ***
StateMassachusetts        29.73916    4.27632   6.954 1.12e-11 ***
StateMichigan             34.48460    5.53953   6.225 1.03e-09 ***
StateMinnesota            33.74476    3.96930   8.501  < 2e-16 ***
StateMississippi          50.12110    7.77148   6.449 2.67e-10 ***
StateMissouri             40.89313    5.92337   6.904 1.56e-11 ***
StateMontana              35.07275    5.31274   6.602 1.05e-10 ***
StateNebraska             39.60828    4.55262   8.700  < 2e-16 ***
StateNevada               46.70467    5.74599   8.128 3.50e-15 ***
StateNew Hampshire        24.29951    4.28888   5.666 2.49e-08 ***
StateNew Jersey           27.73755    4.46942   6.206 1.15e-09 ***
StateNew Mexico           45.88552    6.07038   7.559 1.98e-13 ***
StateNew York             32.87743    4.44071   7.404 5.72e-13 ***
StateNorth Carolina       38.48898    5.67763   6.779 3.45e-11 ***
StateOhio                 42.22715    5.74821   7.346 8.45e-13 ***
StateOklahoma             54.02154    7.09331   7.616 1.34e-13 ***
StateOregon               30.43350    4.86446   6.256 8.53e-10 ***
StatePennsylvania         32.92890    5.28429   6.231 9.88e-10 ***
StateRhode Island         27.37241    4.68283   5.845 9.17e-09 ***
StateSouth Carolina       42.28369    6.56639   6.439 2.84e-10 ***
StateSouth Dakota         46.34850    4.87451   9.508  < 2e-16 ***
StateTennessee            43.54850    6.81599   6.389 3.85e-10 ***
StateTexas                51.55881    5.31339   9.704  < 2e-16 ***
StateUtah                 25.79309    4.53382   5.689 2.19e-08 ***
StateVermont              26.44752    4.29701   6.155 1.55e-09 ***
StateVirginia             37.58935    4.84062   7.765 4.70e-14 ***
StateWashington           32.54779    4.46227   7.294 1.20e-12 ***
StateWest Virginia        41.99450    7.27953   5.769 1.41e-08 ***
StateWisconsin            34.72824    4.52730   7.671 9.11e-14 ***
StateWyoming              38.33204    5.41836   7.074 5.14e-12 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 4.937 on 496 degrees of freedom
Multiple R-squared:  0.9917,    Adjusted R-squared:  0.9909 
F-statistic:  1168 on 51 and 496 DF,  p-value: < 2.2e-16
Dmodel5 <- lm(nmfr ~ DDR + State -1, data=fiveyeartestmerge)
summary(Dmodel5)

Call:
lm(formula = nmfr ~ DDR + State - 1, data = fiveyeartestmerge)

Residuals:
    Min      1Q  Median      3Q     Max 
-48.981  -1.805  -0.137   1.770  17.570 

Coefficients:
                          Estimate Std. Error t value Pr(>|t|)    
DDR                       -0.57693    0.03707  -15.56   <2e-16 ***
StateAlabama              74.45374    1.65907   44.88   <2e-16 ***
StateAlaska               86.84995    2.35829   36.83   <2e-16 ***
StateArizona              88.05735    2.07931   42.35   <2e-16 ***
StateArkansas             86.41136    1.70632   50.64   <2e-16 ***
StateCalifornia           66.34853    1.81696   36.52   <2e-16 ***
StateColorado             59.43811    1.99965   29.72   <2e-16 ***
StateConnecticut          50.14939    1.57006   31.94   <2e-16 ***
StateDelaware             67.48703    1.71195   39.42   <2e-16 ***
StateDistrict of Columbia 54.22436    1.65138   32.84   <2e-16 ***
StateFlorida              74.38321    1.78905   41.58   <2e-16 ***
StateGeorgia              73.18199    1.57871   46.36   <2e-16 ***
StateHawaii               65.92269    1.56356   42.16   <2e-16 ***
StateIdaho                68.29214    1.88479   36.23   <2e-16 ***
StateIllinois             64.09462    1.53094   41.87   <2e-16 ***
StateIndiana              76.83998    1.72848   44.45   <2e-16 ***
StateIowa                 64.84602    1.56712   41.38   <2e-16 ***
StateKansas               73.61959    1.66771   44.14   <2e-16 ***
StateKentucky             86.96641    1.97580   44.02   <2e-16 ***
StateLouisiana            84.61050    1.71477   49.34   <2e-16 ***
StateMaine                60.82803    1.75502   34.66   <2e-16 ***
StateMaryland             58.87560    1.57111   37.47   <2e-16 ***
StateMassachusetts        55.64944    1.61121   34.54   <2e-16 ***
StateMichigan             66.52997    1.73943   38.25   <2e-16 ***
StateMinnesota            57.57127    1.55877   36.93   <2e-16 ***
StateMississippi          85.04661    1.62350   52.38   <2e-16 ***
StateMissouri             74.34756    1.76009   42.24   <2e-16 ***
StateMontana              74.19663    2.11620   35.06   <2e-16 ***
StateNebraska             63.73993    1.51261   42.14   <2e-16 ***
StateNevada               86.93381    2.11730   41.06   <2e-16 ***
StateNew Hampshire        54.67395    1.80876   30.23   <2e-16 ***
StateNew Jersey           50.71271    1.47797   34.31   <2e-16 ***
StateNew Mexico           96.12718    2.62173   36.66   <2e-16 ***
StateNew York             55.54317    1.46957   37.80   <2e-16 ***
StateNorth Carolina       69.28515    1.66840   41.53   <2e-16 ***
StateOhio                 75.63311    1.77805   42.54   <2e-16 ***
StateOklahoma             96.42038    2.05652   46.88   <2e-16 ***
StateOregon               65.44314    1.96314   33.34   <2e-16 ***
StatePennsylvania         64.10364    1.72895   37.08   <2e-16 ***
StateRhode Island         58.47549    1.79568   32.56   <2e-16 ***
StateSouth Carolina       76.45814    1.72019   44.45   <2e-16 ***
StateSouth Dakota         77.44474    1.77269   43.69   <2e-16 ***
StateTennessee            81.36622    1.86162   43.71   <2e-16 ***
StateTexas                78.85206    1.56044   50.53   <2e-16 ***
StateUtah                 61.44680    2.03845   30.14   <2e-16 ***
StateVermont              55.61031    1.75141   31.75   <2e-16 ***
StateVirginia             63.10323    1.53741   41.05   <2e-16 ***
StateWashington           64.23727    1.85024   34.72   <2e-16 ***
StateWest Virginia        87.00248    2.16896   40.11   <2e-16 ***
StateWisconsin            63.12224    1.69025   37.34   <2e-16 ***
StateWyoming              79.34676    2.20214   36.03   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 4.07 on 496 degrees of freedom
Multiple R-squared:  0.9944,    Adjusted R-squared:  0.9938 
F-statistic:  1722 on 51 and 496 DF,  p-value: < 2.2e-16
OPmodel5 <- lm(nmfr ~ OPDR + State -1, data=fiveyeartestmerge)
summary(OPmodel5)

Call:
lm(formula = nmfr ~ OPDR + State - 1, data = fiveyeartestmerge)

Residuals:
    Min      1Q  Median      3Q     Max 
-49.106  -2.026  -0.162   2.229  18.246 

Coefficients:
                          Estimate Std. Error t value Pr(>|t|)    
OPDR                      -0.69909    0.06858  -10.19   <2e-16 ***
StateAlabama              59.83597    1.38801   43.11   <2e-16 ***
StateAlaska               61.41754    1.47971   41.51   <2e-16 ***
StateArizona              67.91343    1.48241   45.81   <2e-16 ***
StateArkansas             72.25640    1.42513   50.70   <2e-16 ***
StateCalifornia           52.29979    1.62723   32.14   <2e-16 ***
StateColorado             40.09671    1.45487   27.56   <2e-16 ***
StateConnecticut          40.97739    1.48589   27.58   <2e-16 ***
StateDelaware             55.60853    1.51168   36.79   <2e-16 ***
StateDistrict of Columbia 42.33340    1.45752   29.05   <2e-16 ***
StateFlorida              59.58183    1.46293   40.73   <2e-16 ***
StateGeorgia              61.35449    1.40716   43.60   <2e-16 ***
StateHawaii               54.05972    1.39746   38.68   <2e-16 ***
StateIdaho                49.33913    1.39960   35.25   <2e-16 ***
StateIllinois             55.05480    1.45399   37.87   <2e-16 ***
StateIndiana              61.50562    1.40669   43.72   <2e-16 ***
StateIowa                 53.02735    1.40047   37.86   <2e-16 ***
StateKansas               59.44441    1.40165   42.41   <2e-16 ***
StateKentucky             71.79587    1.61884   44.35   <2e-16 ***
StateLouisiana            68.88761    1.39113   49.52   <2e-16 ***
StateMaine                48.03199    1.51303   31.75   <2e-16 ***
StateMaryland             51.29164    1.55612   32.96   <2e-16 ***
StateMassachusetts        47.61856    1.58215   30.10   <2e-16 ***
StateMichigan             52.77200    1.46179   36.10   <2e-16 ***
StateMinnesota            45.88613    1.39873   32.81   <2e-16 ***
StateMississippi          70.84330    1.38058   51.31   <2e-16 ***
StateMissouri             61.09819    1.49865   40.77   <2e-16 ***
StateMontana              51.74946    1.42773   36.25   <2e-16 ***
StateNebraska             51.87784    1.37409   37.75   <2e-16 ***
StateNevada               70.21091    1.68552   41.66   <2e-16 ***
StateNew Hampshire        42.94843    1.62019   26.51   <2e-16 ***
StateNew Jersey           41.66952    1.41085   29.54   <2e-16 ***
StateNew Mexico           69.97088    1.67238   41.84   <2e-16 ***
StateNew York             47.52406    1.43309   33.16   <2e-16 ***
StateNorth Carolina       57.89695    1.49118   38.83   <2e-16 ***
StateOhio                 63.34297    1.55854   40.64   <2e-16 ***
StateOklahoma             79.60871    1.61581   49.27   <2e-16 ***
StateOregon               47.70892    1.48764   32.07   <2e-16 ***
StatePennsylvania         49.46424    1.42568   34.70   <2e-16 ***
StateRhode Island         47.73339    1.65873   28.78   <2e-16 ***
StateSouth Carolina       61.93654    1.42348   43.51   <2e-16 ***
StateSouth Dakota         60.19204    1.38610   43.42   <2e-16 ***
StateTennessee            66.69735    1.53001   43.59   <2e-16 ***
StateTexas                66.88346    1.39348   48.00   <2e-16 ***
StateUtah                 46.51182    1.70109   27.34   <2e-16 ***
StateVermont              42.47984    1.49580   28.40   <2e-16 ***
StateVirginia             53.36173    1.43643   37.15   <2e-16 ***
StateWashington           49.36590    1.51086   32.67   <2e-16 ***
StateWest Virginia        75.33005    2.08973   36.05   <2e-16 ***
StateWisconsin            50.63838    1.46824   34.49   <2e-16 ***
StateWyoming              55.46437    1.43348   38.69   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 4.515 on 496 degrees of freedom
Multiple R-squared:  0.9931,    Adjusted R-squared:  0.9924 
F-statistic:  1398 on 51 and 496 DF,  p-value: < 2.2e-16

For the first fixed effects model we test midlife mortality and nonmarital fertility with a five year lag (for example 2020 ferility rates and 2015 mortality rates). The coefficient of 0.03589 means that an increase in state-level midlife mortality is associated with a slight increase in state-level nonmarital fertility. This result is significant (at the 5% level).

The second fixed effects model tests deaths of despair and nonmarital fertility (again with a five year lag). The coefficient here of -0.57693 means that an increase in state-level mortality rates for deaths classified as deaths of despair is associated with a decrease in state-level nonmarital fertility. This result is significant.

The third fixed effects model tests opioid deaths and nonmarital fertility (also with a five year lag). The coefficient of -0.69909 means that an increase in state-level mortality rates for deaths involving opioids is associated with a drecrease in state-level nonmarital fertility. This result is significant.

42. fixed and random effect models with five year lags and Hausman test

MLfixed5 <- plm(nmfr ~ MLDR, data=fiveyeartestmerge, index=c("State", "year"), model="within")
MLrandom5 <- plm(nmfr ~ MLDR, data=fiveyeartestmerge, index=c("State", "year"), model="random")

summary(MLfixed5)
Oneway (individual) effect Within Model

Call:
plm(formula = nmfr ~ MLDR, data = fiveyeartestmerge, model = "within", 
    index = c("State", "year"))

Unbalanced Panel: n = 50, T = 8-11, N = 547

Residuals:
     Min.   1st Qu.    Median   3rd Qu.      Max. 
-48.40267  -2.68686   0.32018   2.66470  18.01230 

Coefficients:
     Estimate Std. Error t-value Pr(>|t|)  
MLDR 0.035892   0.014892  2.4101  0.01631 *
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    12230
Residual Sum of Squares: 12089
R-Squared:      0.011575
Adj. R-Squared: -0.088064
F-statistic: 5.80868 on 1 and 496 DF, p-value: 0.01631
summary(MLrandom5)
Oneway (individual) effect Random Effect Model 
   (Swamy-Arora's transformation)

Call:
plm(formula = nmfr ~ MLDR, data = fiveyeartestmerge, model = "random", 
    index = c("State", "year"))

Unbalanced Panel: n = 50, T = 8-11, N = 547

Effects:
                 var std.dev share
idiosyncratic 24.373   4.937 0.353
individual    44.693   6.685 0.647
theta:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.7474  0.7827  0.7827  0.7821  0.7827  0.7827 

Residuals:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
-47.053  -2.974  -0.102  -0.002   2.839  20.474 

Coefficients:
             Estimate Std. Error z-value  Pr(>|z|)    
(Intercept) 25.854607   3.706839  6.9748 3.062e-12 ***
MLDR         0.070832   0.010249  6.9114 4.800e-12 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    14706
Residual Sum of Squares: 13507
R-Squared:      0.081489
Adj. R-Squared: 0.079804
Chisq: 47.767 on 1 DF, p-value: 4.8001e-12
phtest(MLfixed5, MLrandom5)

    Hausman Test

data:  nmfr ~ MLDR
chisq = 10.456, df = 1, p-value = 0.001222
alternative hypothesis: one model is inconsistent
Dfixed5 <- plm(nmfr ~ DDR, data=fiveyeartestmerge, index=c("State", "year"), model="within")
Drandom5 <- plm(nmfr ~ DDR, data=fiveyeartestmerge, index=c("State", "year"), model="random")

summary(Dfixed5)
Oneway (individual) effect Within Model

Call:
plm(formula = nmfr ~ DDR, data = fiveyeartestmerge, model = "within", 
    index = c("State", "year"))

Unbalanced Panel: n = 50, T = 8-11, N = 547

Residuals:
     Min.   1st Qu.    Median   3rd Qu.      Max. 
-48.98105  -1.80475  -0.13666   1.77028  17.56991 

Coefficients:
     Estimate Std. Error t-value  Pr(>|t|)    
DDR -0.576928   0.037068 -15.564 < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    12230
Residual Sum of Squares: 8217.3
R-Squared:      0.32813
Adj. R-Squared: 0.2604
F-statistic: 242.236 on 1 and 496 DF, p-value: < 2.22e-16
summary(Drandom5)
Oneway (individual) effect Random Effect Model 
   (Swamy-Arora's transformation)

Call:
plm(formula = nmfr ~ DDR, data = fiveyeartestmerge, model = "random", 
    index = c("State", "year"))

Unbalanced Panel: n = 50, T = 8-11, N = 547

Effects:
                 var std.dev share
idiosyncratic 16.567   4.070 0.151
individual    92.989   9.643 0.849
theta:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.8524  0.8738  0.8738  0.8734  0.8738  0.8738 

Residuals:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
-49.562  -2.170  -0.412   0.001   1.945  18.742 

Coefficients:
             Estimate Std. Error z-value  Pr(>|z|)    
(Intercept) 69.042633   1.896186  36.411 < 2.2e-16 ***
DDR         -0.535105   0.036897 -14.503 < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    13066
Residual Sum of Squares: 9423.8
R-Squared:      0.27876
Adj. R-Squared: 0.27744
Chisq: 210.33 on 1 DF, p-value: < 2.22e-16
phtest(Dfixed5, Drandom5)

    Hausman Test

data:  nmfr ~ DDR
chisq = 137.93, df = 1, p-value < 2.2e-16
alternative hypothesis: one model is inconsistent
OPfixed5 <- plm(nmfr ~ OPDR, data=fiveyeartestmerge, index=c("State", "year"), model="within")
OPrandom5 <- plm(nmfr ~ OPDR, data=fiveyeartestmerge, index=c("State", "year"), model="random")

summary(OPfixed5)
Oneway (individual) effect Within Model

Call:
plm(formula = nmfr ~ OPDR, data = fiveyeartestmerge, model = "within", 
    index = c("State", "year"))

Unbalanced Panel: n = 50, T = 8-11, N = 547

Residuals:
     Min.   1st Qu.    Median   3rd Qu.      Max. 
-49.10644  -2.02609  -0.16164   2.22936  18.24563 

Coefficients:
     Estimate Std. Error t-value  Pr(>|t|)    
OPDR -0.69909    0.06858 -10.194 < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    12230
Residual Sum of Squares: 10112
R-Squared:      0.17322
Adj. R-Squared: 0.08987
F-statistic: 103.914 on 1 and 496 DF, p-value: < 2.22e-16
summary(OPrandom5)
Oneway (individual) effect Random Effect Model 
   (Swamy-Arora's transformation)

Call:
plm(formula = nmfr ~ OPDR, data = fiveyeartestmerge, model = "random", 
    index = c("State", "year"))

Unbalanced Panel: n = 50, T = 8-11, N = 547

Effects:
                 var std.dev share
idiosyncratic 20.387   4.515 0.174
individual    96.691   9.833 0.826
theta:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.8398  0.8629  0.8629  0.8625  0.8629  0.8629 

Residuals:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
-49.734  -2.441  -0.330   0.002   2.358  19.713 

Coefficients:
             Estimate Std. Error z-value  Pr(>|z|)    
(Intercept) 56.162816   1.509538  37.205 < 2.2e-16 ***
OPDR        -0.682532   0.067454 -10.118 < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    13217
Residual Sum of Squares: 11121
R-Squared:      0.15855
Adj. R-Squared: 0.15701
Chisq: 102.383 on 1 DF, p-value: < 2.22e-16
phtest(OPfixed5, OPrandom5)

    Hausman Test

data:  nmfr ~ OPDR
chisq = 1.7909, df = 1, p-value = 0.1808
alternative hypothesis: one model is inconsistent

These previous models for both fixed and random effects were used to run the Hausman test to determine if fixed effects or random effects is preferable. For example, for the midlife mortality models the Hausman test is significant meaning that the models are different which means that the fixed effects model is what we should use.

43. fixed effect models with states included with four year lags

MLmodel4 <- lm(nmfr ~ MLDR + State -1, data=fouryeartestmerge)
summary(MLmodel4)

Call:
lm(formula = nmfr ~ MLDR + State - 1, data = fouryeartestmerge)

Residuals:
    Min      1Q  Median      3Q     Max 
-48.914  -2.512  -0.038   2.379  17.189 

Coefficients:
                           Estimate Std. Error t value Pr(>|t|)    
MLDR                       0.004122   0.016398   0.251    0.802    
StateAlabama              54.871036   8.000732   6.858 2.33e-11 ***
StateAlaska               54.469538   5.831145   9.341  < 2e-16 ***
StateArizona              61.873592   5.765566  10.732  < 2e-16 ***
StateArkansas             66.597245   7.758935   8.583  < 2e-16 ***
StateCalifornia           47.936527   4.862567   9.858  < 2e-16 ***
StateColorado             34.327940   4.834162   7.101 4.90e-12 ***
StateConnecticut          34.120900   4.537748   7.519 3.04e-13 ***
StateDelaware             47.904139   6.112406   7.837 3.40e-14 ***
StateDistrict of Columbia 35.853042   7.833441   4.577 6.12e-06 ***
StateFlorida              53.419500   5.976426   8.938  < 2e-16 ***
StateGeorgia              57.227797   6.410920   8.927  < 2e-16 ***
StateHawaii               50.099609   4.877053  10.273  < 2e-16 ***
StateIdaho                45.439783   5.110734   8.891  < 2e-16 ***
StateIllinois             49.183018   5.371719   9.156  < 2e-16 ***
StateIndiana              56.830494   6.315621   8.998  < 2e-16 ***
StateIowa                 48.648892   5.086754   9.564  < 2e-16 ***
StateKansas               55.158041   5.649431   9.763  < 2e-16 ***
StateKentucky             61.624130   7.540089   8.173 3.13e-15 ***
StateLouisiana            64.598144   7.793851   8.288 1.35e-15 ***
StateMaine                40.583802   5.232833   7.756 6.00e-14 ***
StateMaryland             42.607623   5.525427   7.711 8.17e-14 ***
StateMassachusetts        38.904710   4.640502   8.384 6.74e-16 ***
StateMichigan             46.346207   6.053129   7.657 1.19e-13 ***
StateMinnesota            42.077933   4.308197   9.767  < 2e-16 ***
StateMississippi          66.921913   8.500918   7.872 2.66e-14 ***
StateMissouri             53.581980   6.484443   8.263 1.63e-15 ***
StateMontana              46.900619   5.808487   8.074 6.34e-15 ***
StateNebraska             49.272079   4.972959   9.908  < 2e-16 ***
StateNevada               59.503631   6.236483   9.541  < 2e-16 ***
StateNew Hampshire        33.264904   4.666582   7.128 4.11e-12 ***
StateNew Jersey           37.079612   4.838683   7.663 1.14e-13 ***
StateNew Mexico           59.407680   6.676042   8.899  < 2e-16 ***
StateNew York             42.292714   4.807667   8.797  < 2e-16 ***
StateNorth Carolina       50.809271   6.188265   8.211 2.38e-15 ***
StateOhio                 54.471333   6.296986   8.650  < 2e-16 ***
StateOklahoma             69.453265   7.786449   8.920  < 2e-16 ***
StateOregon               41.039814   5.300270   7.743 6.55e-14 ***
StatePennsylvania         43.900385   5.759232   7.623 1.50e-13 ***
StateRhode Island         37.128914   5.111832   7.263 1.69e-12 ***
StateSouth Carolina       56.620089   7.173265   7.893 2.29e-14 ***
StateSouth Dakota         57.291821   5.291935  10.826  < 2e-16 ***
StateTennessee            58.381822   7.463449   7.822 3.77e-14 ***
StateTexas                63.762663   5.789003  11.014  < 2e-16 ***
StateUtah                 35.676343   4.952638   7.204 2.51e-12 ***
StateVermont              35.560147   4.711485   7.548 2.51e-13 ***
StateVirginia             47.906878   5.256875   9.113  < 2e-16 ***
StateWashington           42.116859   4.853965   8.677  < 2e-16 ***
StateWest Virginia        57.555148   8.042615   7.156 3.42e-12 ***
StateWisconsin            44.324909   4.925607   8.999  < 2e-16 ***
StateWyoming              49.925959   5.928977   8.421 5.14e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 4.74 on 447 degrees of freedom
Multiple R-squared:  0.9926,    Adjusted R-squared:  0.9918 
F-statistic:  1179 on 51 and 447 DF,  p-value: < 2.2e-16
Dmodel4 <- lm(nmfr ~ DDR + State -1, data=fouryeartestmerge)
summary(Dmodel4)

Call:
lm(formula = nmfr ~ DDR + State - 1, data = fouryeartestmerge)

Residuals:
    Min      1Q  Median      3Q     Max 
-48.518  -1.709  -0.139   1.693  16.661 

Coefficients:
                          Estimate Std. Error t value Pr(>|t|)    
DDR                       -0.53571    0.04075  -13.14   <2e-16 ***
StateAlabama              73.36777    1.78884   41.01   <2e-16 ***
StateAlaska               85.23740    2.57022   33.16   <2e-16 ***
StateArizona              87.79768    2.25856   38.87   <2e-16 ***
StateArkansas             85.87312    1.83436   46.81   <2e-16 ***
StateCalifornia           65.29577    1.88319   34.67   <2e-16 ***
StateColorado             58.54537    2.16756   27.01   <2e-16 ***
StateConnecticut          49.64018    1.68151   29.52   <2e-16 ***
StateDelaware             67.15237    1.85619   36.18   <2e-16 ***
StateDistrict of Columbia 53.57838    1.75034   30.61   <2e-16 ***
StateFlorida              73.82707    1.92334   38.38   <2e-16 ***
StateGeorgia              73.29622    1.68444   43.51   <2e-16 ***
StateHawaii               65.55887    1.67408   39.16   <2e-16 ***
StateIdaho                67.67302    2.04297   33.12   <2e-16 ***
StateIllinois             63.92056    1.63274   39.15   <2e-16 ***
StateIndiana              76.36172    1.86898   40.86   <2e-16 ***
StateIowa                 64.25450    1.67859   38.28   <2e-16 ***
StateKansas               73.03236    1.78798   40.85   <2e-16 ***
StateKentucky             86.31882    2.15373   40.08   <2e-16 ***
StateLouisiana            83.95261    1.83818   45.67   <2e-16 ***
StateMaine                60.09558    1.88365   31.90   <2e-16 ***
StateMaryland             58.27462    1.67593   34.77   <2e-16 ***
StateMassachusetts        55.34059    1.72647   32.05   <2e-16 ***
StateMichigan             65.94335    1.87646   35.14   <2e-16 ***
StateMinnesota            57.23052    1.66643   34.34   <2e-16 ***
StateMississippi          84.51259    1.73448   48.73   <2e-16 ***
StateMissouri             73.77827    1.90387   38.75   <2e-16 ***
StateMontana              73.49480    2.30014   31.95   <2e-16 ***
StateNebraska             63.40131    1.60902   39.40   <2e-16 ***
StateNevada               86.12854    2.29505   37.53   <2e-16 ***
StateNew Hampshire        53.95050    1.95903   27.54   <2e-16 ***
StateNew Jersey           50.25199    1.56713   32.07   <2e-16 ***
StateNew Mexico           95.11391    2.88761   32.94   <2e-16 ***
StateNew York             55.45688    1.56713   35.39   <2e-16 ***
StateNorth Carolina       68.78076    1.78569   38.52   <2e-16 ***
StateOhio                 74.99415    1.92518   38.95   <2e-16 ***
StateOklahoma             95.67358    2.24444   42.63   <2e-16 ***
StateOregon               64.68885    2.12524   30.44   <2e-16 ***
StatePennsylvania         63.22829    1.86570   33.89   <2e-16 ***
StateRhode Island         57.90532    1.95748   29.58   <2e-16 ***
StateSouth Carolina       75.99210    1.84790   41.12   <2e-16 ***
StateSouth Dakota         77.28516    1.90994   40.47   <2e-16 ***
StateTennessee            80.65153    2.00904   40.14   <2e-16 ***
StateTexas                79.18766    1.66065   47.69   <2e-16 ***
StateUtah                 60.62683    2.21100   27.42   <2e-16 ***
StateVermont              55.17017    1.89691   29.08   <2e-16 ***
StateVirginia             62.72147    1.63785   38.30   <2e-16 ***
StateWashington           63.50028    1.99677   31.80   <2e-16 ***
StateWest Virginia        86.45529    2.41088   35.86   <2e-16 ***
StateWisconsin            62.52909    1.81596   34.43   <2e-16 ***
StateWyoming              78.65679    2.43515   32.30   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 4.025 on 447 degrees of freedom
Multiple R-squared:  0.9947,    Adjusted R-squared:  0.9941 
F-statistic:  1638 on 51 and 447 DF,  p-value: < 2.2e-16
OPmodel4 <- lm(nmfr ~ OPDR + State -1, data=fouryeartestmerge)
summary(OPmodel4)

Call:
lm(formula = nmfr ~ OPDR + State - 1, data = fouryeartestmerge)

Residuals:
    Min      1Q  Median      3Q     Max 
-48.868  -2.066  -0.238   1.869  17.368 

Coefficients:
                          Estimate Std. Error t value Pr(>|t|)    
OPDR                      -0.60723    0.07285  -8.336 9.58e-16 ***
StateAlabama              59.37266    1.42698  41.607  < 2e-16 ***
StateAlaska               61.36934    1.54179  39.804  < 2e-16 ***
StateArizona              68.58630    1.53320  44.734  < 2e-16 ***
StateArkansas             72.33642    1.46801  49.275  < 2e-16 ***
StateCalifornia           51.96071    1.59676  32.541  < 2e-16 ***
StateColorado             40.10423    1.50058  26.726  < 2e-16 ***
StateConnecticut          40.71117    1.54335  26.378  < 2e-16 ***
StateDelaware             55.58136    1.57970  35.185  < 2e-16 ***
StateDistrict of Columbia 42.38248    1.49951  28.264  < 2e-16 ***
StateFlorida              59.70733    1.51019  39.536  < 2e-16 ***
StateGeorgia              62.06155    1.44846  42.847  < 2e-16 ***
StateHawaii               54.03519    1.43345  37.696  < 2e-16 ***
StateIdaho                49.60697    1.43831  34.490  < 2e-16 ***
StateIllinois             55.16749    1.50356  36.691  < 2e-16 ***
StateIndiana              61.66388    1.44925  42.549  < 2e-16 ***
StateIowa                 52.92515    1.44177  36.709  < 2e-16 ***
StateKansas               59.52697    1.44011  41.335  < 2e-16 ***
StateKentucky             71.60030    1.70088  42.096  < 2e-16 ***
StateLouisiana            69.07716    1.42775  48.382  < 2e-16 ***
StateMaine                47.72811    1.56291  30.538  < 2e-16 ***
StateMaryland             50.76365    1.61668  31.400  < 2e-16 ***
StateMassachusetts        47.33791    1.64849  28.716  < 2e-16 ***
StateMichigan             52.71466    1.51300  34.841  < 2e-16 ***
StateMinnesota            46.05044    1.43885  32.005  < 2e-16 ***
StateMississippi          71.17492    1.41807  50.191  < 2e-16 ***
StateMissouri             60.94865    1.55736  39.136  < 2e-16 ***
StateMontana              52.21574    1.47100  35.497  < 2e-16 ***
StateNebraska             52.12782    1.40864  37.006  < 2e-16 ***
StateNevada               69.90909    1.75506  39.833  < 2e-16 ***
StateNew Hampshire        42.43370    1.69672  25.009  < 2e-16 ***
StateNew Jersey           41.53942    1.44964  28.655  < 2e-16 ***
StateNew Mexico           69.81137    1.74669  39.968  < 2e-16 ***
StateNew York             47.62479    1.48201  32.135  < 2e-16 ***
StateNorth Carolina       57.78963    1.54117  37.497  < 2e-16 ***
StateOhio                 63.10114    1.63351  38.629  < 2e-16 ***
StateOklahoma             79.30434    1.68805  46.980  < 2e-16 ***
StateOregon               47.72210    1.53778  31.033  < 2e-16 ***
StatePennsylvania         49.16625    1.46961  33.455  < 2e-16 ***
StateRhode Island         46.96182    1.73491  27.069  < 2e-16 ***
StateSouth Carolina       62.22113    1.46846  42.372  < 2e-16 ***
StateSouth Dakota         60.91757    1.42264  42.820  < 2e-16 ***
StateTennessee            66.56523    1.58868  41.900  < 2e-16 ***
StateTexas                67.82790    1.43047  47.417  < 2e-16 ***
StateUtah                 45.93489    1.76886  25.969  < 2e-16 ***
StateVermont              42.34839    1.55124  27.300  < 2e-16 ***
StateVirginia             53.35119    1.48176  36.005  < 2e-16 ***
StateWashington           49.10069    1.55963  31.482  < 2e-16 ***
StateWest Virginia        74.48527    2.27120  32.796  < 2e-16 ***
StateWisconsin            50.56256    1.52074  33.249  < 2e-16 ***
StateWyoming              55.62459    1.48499  37.458  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 4.41 on 447 degrees of freedom
Multiple R-squared:  0.9936,    Adjusted R-squared:  0.9929 
F-statistic:  1363 on 51 and 447 DF,  p-value: < 2.2e-16

44. fixed and random effect models with four year lags and Hausman test

MLfixed4 <- plm(nmfr ~ MLDR, data=fouryeartestmerge, index=c("State", "year"), model="within")
MLrandom4 <- plm(nmfr ~ MLDR, data=fouryeartestmerge, index=c("State", "year"), model="random")

summary(MLfixed4)
Oneway (individual) effect Within Model

Call:
plm(formula = nmfr ~ MLDR, data = fouryeartestmerge, model = "within", 
    index = c("State", "year"))

Unbalanced Panel: n = 50, T = 8-10, N = 498

Residuals:
      Min.    1st Qu.     Median    3rd Qu.       Max. 
-48.914380  -2.512200  -0.037569   2.378607  17.188634 

Coefficients:
      Estimate Std. Error t-value Pr(>|t|)
MLDR 0.0041219  0.0163977  0.2514   0.8016

Total Sum of Squares:    10043
Residual Sum of Squares: 10041
R-Squared:      0.00014134
Adj. R-Squared: -0.1117
F-statistic: 0.0631883 on 1 and 447 DF, p-value: 0.80164
summary(MLrandom4)
Oneway (individual) effect Random Effect Model 
   (Swamy-Arora's transformation)

Call:
plm(formula = nmfr ~ MLDR, data = fouryeartestmerge, model = "random", 
    index = c("State", "year"))

Unbalanced Panel: n = 50, T = 8-10, N = 498

Effects:
                var std.dev share
idiosyncratic 22.46    4.74 0.332
individual    45.29    6.73 0.668
theta:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.7584  0.7826  0.7826  0.7822  0.7826  0.7826 

Residuals:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
-47.666  -2.836  -0.105  -0.001   2.653  19.700 

Coefficients:
             Estimate Std. Error z-value  Pr(>|z|)    
(Intercept) 29.937223   3.908026  7.6604 1.853e-14 ***
MLDR         0.060929   0.010865  5.6078 2.050e-08 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    12321
Residual Sum of Squares: 11584
R-Squared:      0.059797
Adj. R-Squared: 0.057901
Chisq: 31.447 on 1 DF, p-value: 2.0496e-08
phtest(MLfixed4, MLrandom4)

    Hausman Test

data:  nmfr ~ MLDR
chisq = 21.395, df = 1, p-value = 3.738e-06
alternative hypothesis: one model is inconsistent
Dfixed4 <- plm(nmfr ~ DDR, data=fouryeartestmerge, index=c("State", "year"), model="within")
Drandom4 <- plm(nmfr ~ DDR, data=fouryeartestmerge, index=c("State", "year"), model="random")

summary(Dfixed4)
Oneway (individual) effect Within Model

Call:
plm(formula = nmfr ~ DDR, data = fouryeartestmerge, model = "within", 
    index = c("State", "year"))

Unbalanced Panel: n = 50, T = 8-10, N = 498

Residuals:
     Min.   1st Qu.    Median   3rd Qu.      Max. 
-48.51797  -1.70916  -0.13883   1.69271  16.66118 

Coefficients:
     Estimate Std. Error t-value  Pr(>|t|)    
DDR -0.535706   0.040753 -13.145 < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    10043
Residual Sum of Squares: 7242.9
R-Squared:      0.27879
Adj. R-Squared: 0.19812
F-statistic: 172.795 on 1 and 447 DF, p-value: < 2.22e-16
summary(Drandom4)
Oneway (individual) effect Random Effect Model 
   (Swamy-Arora's transformation)

Call:
plm(formula = nmfr ~ DDR, data = fouryeartestmerge, model = "random", 
    index = c("State", "year"))

Unbalanced Panel: n = 50, T = 8-10, N = 498

Effects:
                 var std.dev share
idiosyncratic 16.203   4.025 0.147
individual    94.075   9.699 0.853
theta:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.8548  0.8699  0.8699  0.8696  0.8699  0.8699 

Residuals:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
-49.195  -2.219  -0.344   0.001   1.819  17.977 

Coefficients:
            Estimate Std. Error z-value  Pr(>|z|)    
(Intercept) 68.19447    1.99969  34.103 < 2.2e-16 ***
DDR         -0.48665    0.04033 -12.067 < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    10859
Residual Sum of Squares: 8394
R-Squared:      0.22702
Adj. R-Squared: 0.22546
Chisq: 145.609 on 1 DF, p-value: < 2.22e-16
phtest(Dfixed4, Drandom4)

    Hausman Test

data:  nmfr ~ DDR
chisq = 70.057, df = 1, p-value < 2.2e-16
alternative hypothesis: one model is inconsistent
OPfixed4 <- plm(nmfr ~ OPDR, data=fouryeartestmerge, index=c("State", "year"), model="within")
OPrandom4 <- plm(nmfr ~ OPDR, data=fouryeartestmerge, index=c("State", "year"), model="random")

summary(OPfixed4)
Oneway (individual) effect Within Model

Call:
plm(formula = nmfr ~ OPDR, data = fouryeartestmerge, model = "within", 
    index = c("State", "year"))

Unbalanced Panel: n = 50, T = 8-10, N = 498

Residuals:
     Min.   1st Qu.    Median   3rd Qu.      Max. 
-48.86795  -2.06561  -0.23769   1.86900  17.36798 

Coefficients:
      Estimate Std. Error t-value  Pr(>|t|)    
OPDR -0.607227   0.072846 -8.3358 9.581e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    10043
Residual Sum of Squares: 8691.6
R-Squared:      0.13453
Adj. R-Squared: 0.037727
F-statistic: 69.4852 on 1 and 447 DF, p-value: 9.5808e-16
summary(OPrandom4)
Oneway (individual) effect Random Effect Model 
   (Swamy-Arora's transformation)

Call:
plm(formula = nmfr ~ OPDR, data = fouryeartestmerge, model = "random", 
    index = c("State", "year"))

Unbalanced Panel: n = 50, T = 8-10, N = 498

Effects:
                 var std.dev share
idiosyncratic 19.444   4.410 0.165
individual    98.318   9.916 0.835
theta:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.8447  0.8607  0.8607  0.8605  0.8607  0.8607 

Residuals:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
-49.529  -2.293  -0.308   0.001   2.032  18.985 

Coefficients:
             Estimate Std. Error z-value  Pr(>|z|)    
(Intercept) 56.113902   1.539727 36.4441 < 2.2e-16 ***
OPDR        -0.589556   0.071396 -8.2576 < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    10978
Residual Sum of Squares: 9650.1
R-Squared:      0.12095
Adj. R-Squared: 0.11918
Chisq: 68.1882 on 1 DF, p-value: < 2.22e-16
phtest(OPfixed4, OPrandom4)

    Hausman Test

data:  nmfr ~ OPDR
chisq = 1.4926, df = 1, p-value = 0.2218
alternative hypothesis: one model is inconsistent

45. fixed effect models with states included with three year lags

MLmodel3 <- lm(nmfr ~ MLDR + State -1, data=threeyeartestmerge)
summary(MLmodel3)

Call:
lm(formula = nmfr ~ MLDR + State - 1, data = threeyeartestmerge)

Residuals:
    Min      1Q  Median      3Q     Max 
-49.254  -2.191  -0.169   2.128  16.374 

Coefficients:
                          Estimate Std. Error t value Pr(>|t|)    
MLDR                      -0.03190    0.01843  -1.730   0.0844 .  
StateAlabama              71.70224    8.95049   8.011 1.27e-14 ***
StateAlaska               67.19365    6.55143  10.256  < 2e-16 ***
StateArizona              75.15194    6.40554  11.732  < 2e-16 ***
StateArkansas             83.98529    8.70096   9.652  < 2e-16 ***
StateCalifornia           57.82413    5.30550  10.899  < 2e-16 ***
StateColorado             44.79577    5.39026   8.310 1.52e-15 ***
StateConnecticut          43.86947    5.03529   8.712  < 2e-16 ***
StateDelaware             61.23843    6.81103   8.991  < 2e-16 ***
StateDistrict of Columbia 52.99859    8.57215   6.183 1.56e-09 ***
StateFlorida              66.70330    6.64209  10.043  < 2e-16 ***
StateGeorgia              71.50239    7.12835  10.031  < 2e-16 ***
StateHawaii               60.90255    5.41698  11.243  < 2e-16 ***
StateIdaho                56.54526    5.71158   9.900  < 2e-16 ***
StateIllinois             61.34318    5.96558  10.283  < 2e-16 ***
StateIndiana              71.00012    7.06515  10.049  < 2e-16 ***
StateIowa                 59.82338    5.69027  10.513  < 2e-16 ***
StateKansas               67.82926    6.30296  10.761  < 2e-16 ***
StateKentucky             78.43464    8.48873   9.240  < 2e-16 ***
StateLouisiana            81.97043    8.68705   9.436  < 2e-16 ***
StateMaine                52.32121    5.82335   8.985  < 2e-16 ***
StateMaryland             54.42860    6.11795   8.897  < 2e-16 ***
StateMassachusetts        48.95533    5.14625   9.513  < 2e-16 ***
StateMichigan             59.71917    6.76453   8.828  < 2e-16 ***
StateMinnesota            51.41812    4.78074  10.755  < 2e-16 ***
StateMississippi          85.64897    9.49646   9.019  < 2e-16 ***
StateMissouri             67.85859    7.25183   9.357  < 2e-16 ***
StateMontana              60.18766    6.51041   9.245  < 2e-16 ***
StateNebraska             60.20992    5.54600  10.856  < 2e-16 ***
StateNevada               73.14422    6.94182  10.537  < 2e-16 ***
StateNew Hampshire        43.48029    5.20907   8.347 1.17e-15 ***
StateNew Jersey           47.42426    5.33608   8.887  < 2e-16 ***
StateNew Mexico           74.69745    7.48625   9.978  < 2e-16 ***
StateNew York             52.72729    5.31940   9.912  < 2e-16 ***
StateNorth Carolina       64.54916    6.88210   9.379  < 2e-16 ***
StateOhio                 68.23749    7.06095   9.664  < 2e-16 ***
StateOklahoma             87.26194    8.75702   9.965  < 2e-16 ***
StateOregon               53.04865    5.90462   8.984  < 2e-16 ***
StatePennsylvania         56.43706    6.41290   8.801  < 2e-16 ***
StateRhode Island         48.30325    5.70388   8.468 4.85e-16 ***
StateSouth Carolina       72.55703    7.99764   9.072  < 2e-16 ***
StateSouth Dakota         68.75584    5.89176  11.670  < 2e-16 ***
StateTennessee            74.92001    8.34874   8.974  < 2e-16 ***
StateTexas                77.22170    6.44752  11.977  < 2e-16 ***
StateUtah                 46.78073    5.51589   8.481 4.42e-16 ***
StateVermont              45.71110    5.23746   8.728  < 2e-16 ***
StateVirginia             59.39787    5.84352  10.165  < 2e-16 ***
StateWashington           52.92652    5.40225   9.797  < 2e-16 ***
StateWest Virginia        75.05049    9.06817   8.276 1.94e-15 ***
StateWisconsin            55.10783    5.49464  10.029  < 2e-16 ***
StateWyoming              62.93449    6.62355   9.502  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 4.59 on 398 degrees of freedom
Multiple R-squared:  0.9933,    Adjusted R-squared:  0.9924 
F-statistic:  1156 on 51 and 398 DF,  p-value: < 2.2e-16
Dmodel3 <- lm(nmfr ~ DDR + State -1, data=threeyeartestmerge)
summary(Dmodel3)

Call:
lm(formula = nmfr ~ DDR + State - 1, data = threeyeartestmerge)

Residuals:
    Min      1Q  Median      3Q     Max 
-48.416  -1.580  -0.170   1.329  15.213 

Coefficients:
                          Estimate Std. Error t value Pr(>|t|)    
DDR                       -0.50662    0.04334  -11.69   <2e-16 ***
StateAlabama              72.34527    1.89910   38.09   <2e-16 ***
StateAlaska               84.09702    2.73194   30.78   <2e-16 ***
StateArizona              87.87937    2.40713   36.51   <2e-16 ***
StateArkansas             85.81539    1.94549   44.11   <2e-16 ***
StateCalifornia           64.59280    1.93278   33.42   <2e-16 ***
StateColorado             58.01428    2.31309   25.08   <2e-16 ***
StateConnecticut          49.42763    1.77806   27.80   <2e-16 ***
StateDelaware             66.99072    1.98246   33.79   <2e-16 ***
StateDistrict of Columbia 52.94426    1.81743   29.13   <2e-16 ***
StateFlorida              73.52134    2.03165   36.19   <2e-16 ***
StateGeorgia              73.32006    1.77838   41.23   <2e-16 ***
StateHawaii               65.75871    1.77742   37.00   <2e-16 ***
StateIdaho                67.29400    2.18243   30.83   <2e-16 ***
StateIllinois             64.22300    1.72208   37.29   <2e-16 ***
StateIndiana              76.38604    1.98784   38.43   <2e-16 ***
StateIowa                 64.21576    1.77902   36.10   <2e-16 ***
StateKansas               72.99396    1.88946   38.63   <2e-16 ***
StateKentucky             85.97994    2.30127   37.36   <2e-16 ***
StateLouisiana            83.65611    1.93494   43.23   <2e-16 ***
StateMaine                60.15051    2.00260   30.04   <2e-16 ***
StateMaryland             57.77892    1.76336   32.77   <2e-16 ***
StateMassachusetts        55.12841    1.82536   30.20   <2e-16 ***
StateMichigan             65.70603    1.99215   32.98   <2e-16 ***
StateMinnesota            57.19779    1.76432   32.42   <2e-16 ***
StateMississippi          84.12378    1.82636   46.06   <2e-16 ***
StateMissouri             73.41484    2.01999   36.34   <2e-16 ***
StateMontana              73.34751    2.45153   29.92   <2e-16 ***
StateNebraska             63.39254    1.69774   37.34   <2e-16 ***
StateNevada               85.43616    2.44424   34.95   <2e-16 ***
StateNew Hampshire        53.88525    2.09849   25.68   <2e-16 ***
StateNew Jersey           50.05096    1.64894   30.35   <2e-16 ***
StateNew Mexico           94.76736    3.09932   30.58   <2e-16 ***
StateNew York             55.41789    1.65066   33.57   <2e-16 ***
StateNorth Carolina       68.60477    1.88466   36.40   <2e-16 ***
StateOhio                 74.63846    2.05290   36.36   <2e-16 ***
StateOklahoma             95.70338    2.39789   39.91   <2e-16 ***
StateOregon               64.55444    2.25816   28.59   <2e-16 ***
StatePennsylvania         62.99316    1.98856   31.68   <2e-16 ***
StateRhode Island         57.55159    2.08099   27.66   <2e-16 ***
StateSouth Carolina       75.74892    1.95326   38.78   <2e-16 ***
StateSouth Dakota         76.79463    2.02399   37.94   <2e-16 ***
StateTennessee            80.17290    2.12737   37.69   <2e-16 ***
StateTexas                79.70260    1.74757   45.61   <2e-16 ***
StateUtah                 60.34694    2.35352   25.64   <2e-16 ***
StateVermont              54.73057    2.01128   27.21   <2e-16 ***
StateVirginia             62.63146    1.72949   36.21   <2e-16 ***
StateWashington           63.30324    2.11985   29.86   <2e-16 ***
StateWest Virginia        85.63051    2.59245   33.03   <2e-16 ***
StateWisconsin            62.29516    1.92479   32.37   <2e-16 ***
StateWyoming              77.95891    2.60198   29.96   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 3.975 on 398 degrees of freedom
Multiple R-squared:  0.995, Adjusted R-squared:  0.9943 
F-statistic:  1544 on 51 and 398 DF,  p-value: < 2.2e-16
OPmodel3 <- lm(nmfr ~ OPDR + State -1, data=threeyeartestmerge)
summary(OPmodel3)

Call:
lm(formula = nmfr ~ OPDR + State - 1, data = threeyeartestmerge)

Residuals:
    Min      1Q  Median      3Q     Max 
-48.884  -1.824  -0.302   1.709  15.988 

Coefficients:
                          Estimate Std. Error t value Pr(>|t|)    
OPDR                      -0.55151    0.07562  -7.293 1.65e-12 ***
StateAlabama              58.82685    1.47894  39.776  < 2e-16 ***
StateAlaska               61.45335    1.61399  38.075  < 2e-16 ***
StateArizona              69.27311    1.59024  43.562  < 2e-16 ***
StateArkansas             72.71259    1.52220  47.768  < 2e-16 ***
StateCalifornia           51.75878    1.57322  32.900  < 2e-16 ***
StateColorado             40.10531    1.55578  25.778  < 2e-16 ***
StateConnecticut          40.74074    1.60726  25.348  < 2e-16 ***
StateDelaware             55.72301    1.65835  33.601  < 2e-16 ***
StateDistrict of Columbia 42.45485    1.54560  27.468  < 2e-16 ***
StateFlorida              59.97449    1.56638  38.289  < 2e-16 ***
StateGeorgia              62.53182    1.50278  41.611  < 2e-16 ***
StateHawaii               54.46035    1.48412  36.695  < 2e-16 ***
StateIdaho                49.68317    1.48776  33.395  < 2e-16 ***
StateIllinois             55.67406    1.55863  35.720  < 2e-16 ***
StateIndiana              62.21507    1.50564  41.321  < 2e-16 ***
StateIowa                 53.22017    1.49546  35.588  < 2e-16 ***
StateKansas               60.00082    1.49089  40.245  < 2e-16 ***
StateKentucky             71.68983    1.78769  40.102  < 2e-16 ***
StateLouisiana            69.47210    1.47639  47.055  < 2e-16 ***
StateMaine                48.08959    1.62701  29.557  < 2e-16 ***
StateMaryland             50.46624    1.68034  30.033  < 2e-16 ***
StateMassachusetts        47.23080    1.71579  27.527  < 2e-16 ***
StateMichigan             52.88917    1.57267  33.630  < 2e-16 ***
StateMinnesota            46.38147    1.49261  31.074  < 2e-16 ***
StateMississippi          71.46019    1.46894  48.647  < 2e-16 ***
StateMissouri             60.99180    1.62122  37.621  < 2e-16 ***
StateMontana              52.85972    1.52546  34.652  < 2e-16 ***
StateNebraska             52.54865    1.45820  36.037  < 2e-16 ***
StateNevada               69.57205    1.82408  38.141  < 2e-16 ***
StateNew Hampshire        42.51215    1.78323  23.840  < 2e-16 ***
StateNew Jersey           41.64894    1.50254  27.719  < 2e-16 ***
StateNew Mexico           70.10001    1.81894  38.539  < 2e-16 ***
StateNew York             47.81549    1.53847  31.080  < 2e-16 ***
StateNorth Carolina       57.98226    1.59956  36.249  < 2e-16 ***
StateOhio                 63.12435    1.71853  36.732  < 2e-16 ***
StateOklahoma             79.66548    1.75741  45.331  < 2e-16 ***
StateOregon               48.04633    1.58918  30.233  < 2e-16 ***
StatePennsylvania         49.35019    1.52849  32.287  < 2e-16 ***
StateRhode Island         46.73106    1.80673  25.865  < 2e-16 ***
StateSouth Carolina       62.54680    1.52328  41.061  < 2e-16 ***
StateSouth Dakota         61.08030    1.47272  41.474  < 2e-16 ***
StateTennessee            66.65056    1.65587  40.251  < 2e-16 ***
StateTexas                68.78631    1.47950  46.493  < 2e-16 ***
StateUtah                 45.91432    1.83753  24.987  < 2e-16 ***
StateVermont              42.18527    1.60541  26.277  < 2e-16 ***
StateVirginia             53.53073    1.53789  34.808  < 2e-16 ***
StateWashington           49.22554    1.61286  30.521  < 2e-16 ***
StateWest Virginia        73.67881    2.41137  30.555  < 2e-16 ***
StateWisconsin            50.71328    1.58185  32.059  < 2e-16 ***
StateWyoming              55.91386    1.54956  36.084  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 4.327 on 398 degrees of freedom
Multiple R-squared:  0.994, Adjusted R-squared:  0.9933 
F-statistic:  1302 on 51 and 398 DF,  p-value: < 2.2e-16

46. fixed and random effect models with three year lags and Hausman test

MLfixed3 <- plm(nmfr ~ MLDR, data=threeyeartestmerge, index=c("State", "year"), model="within")
MLrandom3 <- plm(nmfr ~ MLDR, data=threeyeartestmerge, index=c("State", "year"), model="random")

summary(MLfixed3)
Oneway (individual) effect Within Model

Call:
plm(formula = nmfr ~ MLDR, data = threeyeartestmerge, model = "within", 
    index = c("State", "year"))

Unbalanced Panel: n = 50, T = 8-9, N = 449

Residuals:
     Min.   1st Qu.    Median   3rd Qu.      Max. 
-49.25410  -2.19056  -0.16943   2.12793  16.37356 

Coefficients:
      Estimate Std. Error t-value Pr(>|t|)  
MLDR -0.031897   0.018434 -1.7303  0.08435 .
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    8448.2
Residual Sum of Squares: 8385.1
R-Squared:      0.0074663
Adj. R-Squared: -0.11722
F-statistic: 2.99395 on 1 and 398 DF, p-value: 0.084351
summary(MLrandom3)
Oneway (individual) effect Random Effect Model 
   (Swamy-Arora's transformation)

Call:
plm(formula = nmfr ~ MLDR, data = threeyeartestmerge, model = "random", 
    index = c("State", "year"))

Unbalanced Panel: n = 50, T = 8-9, N = 449

Effects:
                 var std.dev share
idiosyncratic 21.068   4.590 0.316
individual    45.534   6.748 0.684
theta:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.7662  0.7789  0.7789  0.7786  0.7789  0.7789 

Residuals:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 -48.17   -2.64   -0.26    0.00    2.35   18.76 

Coefficients:
             Estimate Std. Error z-value  Pr(>|z|)    
(Intercept) 33.083769   4.148339  7.9752 1.522e-15 ***
MLDR         0.053539   0.011594  4.6178 3.879e-06 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    10591
Residual Sum of Squares: 10112
R-Squared:      0.045268
Adj. R-Squared: 0.043132
Chisq: 21.3239 on 1 DF, p-value: 3.8786e-06
phtest(MLfixed3, MLrandom3)

    Hausman Test

data:  nmfr ~ MLDR
chisq = 35.536, df = 1, p-value = 2.503e-09
alternative hypothesis: one model is inconsistent
Dfixed3 <- plm(nmfr ~ DDR, data=threeyeartestmerge, index=c("State", "year"), model="within")
Drandom3 <- plm(nmfr ~ DDR, data=threeyeartestmerge, index=c("State", "year"), model="random")

summary(Dfixed3)
Oneway (individual) effect Within Model

Call:
plm(formula = nmfr ~ DDR, data = threeyeartestmerge, model = "within", 
    index = c("State", "year"))

Unbalanced Panel: n = 50, T = 8-9, N = 449

Residuals:
     Min.   1st Qu.    Median   3rd Qu.      Max. 
-48.41568  -1.57989  -0.17032   1.32913  15.21348 

Coefficients:
     Estimate Std. Error t-value  Pr(>|t|)    
DDR -0.506617   0.043342 -11.689 < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    8448.2
Residual Sum of Squares: 6289.2
R-Squared:      0.25556
Adj. R-Squared: 0.16204
F-statistic: 136.632 on 1 and 398 DF, p-value: < 2.22e-16
summary(Drandom3)
Oneway (individual) effect Random Effect Model 
   (Swamy-Arora's transformation)

Call:
plm(formula = nmfr ~ DDR, data = threeyeartestmerge, model = "random", 
    index = c("State", "year"))

Unbalanced Panel: n = 50, T = 8-9, N = 449

Effects:
                 var std.dev share
idiosyncratic 15.802   3.975 0.143
individual    94.954   9.744 0.857
theta:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.8572  0.8653  0.8653  0.8651  0.8653  0.8653 

Residuals:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
-49.159  -2.110  -0.509   0.001   1.528  16.721 

Coefficients:
             Estimate Std. Error z-value  Pr(>|z|)    
(Intercept) 67.731188   2.079657  32.568 < 2.2e-16 ***
DDR         -0.452522   0.042712 -10.595 < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    9244
Residual Sum of Squares: 7389.5
R-Squared:      0.20062
Adj. R-Squared: 0.19883
Chisq: 112.247 on 1 DF, p-value: < 2.22e-16
phtest(Dfixed3, Drandom3)

    Hausman Test

data:  nmfr ~ DDR
chisq = 54.037, df = 1, p-value = 1.968e-13
alternative hypothesis: one model is inconsistent
OPfixed3 <- plm(nmfr ~ OPDR, data=threeyeartestmerge, index=c("State", "year"), model="within")
OPrandom3 <- plm(nmfr ~ OPDR, data=threeyeartestmerge, index=c("State", "year"), model="random")

summary(OPfixed3)
Oneway (individual) effect Within Model

Call:
plm(formula = nmfr ~ OPDR, data = threeyeartestmerge, model = "within", 
    index = c("State", "year"))

Unbalanced Panel: n = 50, T = 8-9, N = 449

Residuals:
     Min.   1st Qu.    Median   3rd Qu.      Max. 
-48.88390  -1.82448  -0.30185   1.70882  15.98780 

Coefficients:
      Estimate Std. Error t-value  Pr(>|t|)    
OPDR -0.551507   0.075616 -7.2935 1.646e-12 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    8448.2
Residual Sum of Squares: 7452.2
R-Squared:      0.1179
Adj. R-Squared: 0.0070815
F-statistic: 53.1951 on 1 and 398 DF, p-value: 1.6459e-12
summary(OPrandom3)
Oneway (individual) effect Random Effect Model 
   (Swamy-Arora's transformation)

Call:
plm(formula = nmfr ~ OPDR, data = threeyeartestmerge, model = "random", 
    index = c("State", "year"))

Unbalanced Panel: n = 50, T = 8-9, N = 449

Effects:
                 var std.dev share
idiosyncratic 18.724   4.327 0.159
individual    99.345   9.967 0.841
theta:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
 0.8483  0.8568  0.8568  0.8566  0.8568  0.8568 

Residuals:
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
-49.585  -2.181  -0.499   0.001   1.836  17.769 

Coefficients:
            Estimate Std. Error z-value  Pr(>|z|)    
(Intercept) 56.27540    1.56173 36.0340 < 2.2e-16 ***
OPDR        -0.53325    0.07391 -7.2148 5.401e-13 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    9347.3
Residual Sum of Squares: 8373.4
R-Squared:      0.10419
Adj. R-Squared: 0.10218
Chisq: 52.0533 on 1 DF, p-value: 5.4014e-13
phtest(OPfixed3, OPrandom3)

    Hausman Test

data:  nmfr ~ OPDR
chisq = 1.307, df = 1, p-value = 0.2529
alternative hypothesis: one model is inconsistent

47. fixed effect models with states included with two year lags

MLmodel2 <- lm(nmfr ~ MLDR + State -1, data=twoyeartestmerge)
summary(MLmodel2)

Call:
lm(formula = nmfr ~ MLDR + State - 1, data = twoyeartestmerge)

Residuals:
    Min      1Q  Median      3Q     Max 
-49.149  -1.895  -0.331   1.662  15.232 

Coefficients:
                           Estimate Std. Error t value Pr(>|t|)    
MLDR                       -0.06063    0.01970  -3.078  0.00225 ** 
StateAlabama               85.41663    9.56219   8.933  < 2e-16 ***
StateAlaska                77.93943    6.98305  11.161  < 2e-16 ***
StateArizona               85.75406    6.80738  12.597  < 2e-16 ***
StateArkansas              98.52175    9.29987  10.594  < 2e-16 ***
StateCalifornia            65.50307    5.55125  11.800  < 2e-16 ***
StateColorado              53.41756    5.72961   9.323  < 2e-16 ***
StateConnecticut           51.56976    5.34012   9.657  < 2e-16 ***
StateDelaware              71.92989    7.25948   9.908  < 2e-16 ***
StateDistrict of Columbia  66.38210    8.95309   7.414 9.34e-13 ***
StateFlorida               77.38273    7.04166  10.989  < 2e-16 ***
StateGeorgia               83.10657    7.56992  10.979  < 2e-16 ***
StateHawaii                69.61216    5.76210  12.081  < 2e-16 ***
StateIdaho                 66.25850    6.10806  10.848  < 2e-16 ***
StateIllinois              70.95797    6.32441  11.220  < 2e-16 ***
StateIndiana               82.35330    7.56630  10.884  < 2e-16 ***
StateIowa                  68.91410    6.07090  11.352  < 2e-16 ***
StateKansas                78.06886    6.72514  11.609  < 2e-16 ***
StateKentucky              92.21942    9.11272  10.120  < 2e-16 ***
StateLouisiana             96.04384    9.23092  10.405  < 2e-16 ***
StateMaine                 61.32946    6.21081   9.875  < 2e-16 ***
StateMaryland              63.84398    6.45774   9.886  < 2e-16 ***
StateMassachusetts         56.99461    5.45103  10.456  < 2e-16 ***
StateMichigan              70.54678    7.20896   9.786  < 2e-16 ***
StateMinnesota             58.87329    5.08444  11.579  < 2e-16 ***
StateMississippi          100.75007   10.13705   9.939  < 2e-16 ***
StateMissouri              79.20370    7.76528  10.200  < 2e-16 ***
StateMontana               70.72769    6.95880  10.164  < 2e-16 ***
StateNebraska              69.08573    5.90792  11.694  < 2e-16 ***
StateNevada                83.86752    7.36273  11.391  < 2e-16 ***
StateNew Hampshire         51.62781    5.54936   9.303  < 2e-16 ***
StateNew Jersey            55.62928    5.65139   9.843  < 2e-16 ***
StateNew Mexico            87.37512    8.00892  10.910  < 2e-16 ***
StateNew York              61.01103    5.61752  10.861  < 2e-16 ***
StateNorth Carolina        75.63109    7.30207  10.357  < 2e-16 ***
StateOhio                  79.63190    7.55112  10.546  < 2e-16 ***
StateOklahoma             101.91837    9.37587  10.870  < 2e-16 ***
StateOregon                62.61335    6.26759   9.990  < 2e-16 ***
StatePennsylvania          66.44041    6.82632   9.733  < 2e-16 ***
StateRhode Island          57.42058    6.06566   9.467  < 2e-16 ***
StateSouth Carolina        85.20383    8.49436  10.031  < 2e-16 ***
StateSouth Dakota          78.87424    6.31008  12.500  < 2e-16 ***
StateTennessee             88.38217    8.91914   9.909  < 2e-16 ***
StateTexas                 88.34205    6.83976  12.916  < 2e-16 ***
StateUtah                  55.72185    5.84400   9.535  < 2e-16 ***
StateVermont               54.18258    5.56710   9.733  < 2e-16 ***
StateVirginia              68.39231    6.19149  11.046  < 2e-16 ***
StateWashington            61.59014    5.73482  10.740  < 2e-16 ***
StateWest Virginia         89.75427    9.70145   9.252  < 2e-16 ***
StateWisconsin             63.72174    5.83593  10.919  < 2e-16 ***
StateWyoming               74.01335    7.03565  10.520  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 4.352 on 349 degrees of freedom
Multiple R-squared:  0.9942,    Adjusted R-squared:  0.9934 
F-statistic:  1173 on 51 and 349 DF,  p-value: < 2.2e-16
Dmodel2 <- lm(nmfr ~ DDR + State -1, data=twoyeartestmerge)
summary(Dmodel2)

Call:
lm(formula = nmfr ~ DDR + State - 1, data = twoyeartestmerge)

Residuals:
    Min      1Q  Median      3Q     Max 
-48.103  -1.555  -0.286   1.432  14.069 

Coefficients:
                          Estimate Std. Error t value Pr(>|t|)    
DDR                        -0.4488     0.0460  -9.756   <2e-16 ***
StateAlabama               70.6469     2.0133  35.091   <2e-16 ***
StateAlaska                81.8729     2.9025  28.208   <2e-16 ***
StateArizona               86.4165     2.5645  33.697   <2e-16 ***
StateArkansas              85.2380     2.0636  41.307   <2e-16 ***
StateCalifornia            62.9847     1.9850  31.730   <2e-16 ***
StateColorado              56.2411     2.4565  22.895   <2e-16 ***
StateConnecticut           48.2984     1.8825  25.656   <2e-16 ***
StateDelaware              65.7864     2.1210  31.017   <2e-16 ***
StateDistrict of Columbia  52.2909     1.9240  27.178   <2e-16 ***
StateFlorida               72.1895     2.1415  33.709   <2e-16 ***
StateGeorgia               72.6877     1.8775  38.716   <2e-16 ***
StateHawaii                64.9383     1.8790  34.559   <2e-16 ***
StateIdaho                 66.4562     2.3377  28.428   <2e-16 ***
StateIllinois              63.6638     1.8225  34.933   <2e-16 ***
StateIndiana               75.2386     2.1205  35.481   <2e-16 ***
StateIowa                  63.4241     1.8908  33.544   <2e-16 ***
StateKansas                71.9904     1.9978  36.034   <2e-16 ***
StateKentucky              84.4453     2.4617  34.303   <2e-16 ***
StateLouisiana             82.5154     2.0288  40.672   <2e-16 ***
StateMaine                 58.4967     2.1205  27.586   <2e-16 ***
StateMaryland              56.5757     1.8528  30.536   <2e-16 ***
StateMassachusetts         54.0178     1.9284  28.011   <2e-16 ***
StateMichigan              64.5568     2.1205  30.444   <2e-16 ***
StateMinnesota             56.2743     1.8720  30.060   <2e-16 ***
StateMississippi           82.9153     1.9204  43.175   <2e-16 ***
StateMissouri              71.8957     2.1543  33.373   <2e-16 ***
StateMontana               71.4953     2.6151  27.340   <2e-16 ***
StateNebraska              62.7741     1.7998  34.879   <2e-16 ***
StateNevada                83.2105     2.6019  31.981   <2e-16 ***
StateNew Hampshire         52.4364     2.2419  23.389   <2e-16 ***
StateNew Jersey            49.2731     1.7444  28.246   <2e-16 ***
StateNew Mexico            92.4459     3.3028  27.991   <2e-16 ***
StateNew York              54.7071     1.7409  31.425   <2e-16 ***
StateNorth Carolina        67.6649     1.9929  33.954   <2e-16 ***
StateOhio                  73.4625     2.1911  33.528   <2e-16 ***
StateOklahoma              94.3549     2.5500  37.002   <2e-16 ***
StateOregon                62.9716     2.3932  26.313   <2e-16 ***
StatePennsylvania          61.6913     2.1231  29.057   <2e-16 ***
StateRhode Island          56.4911     2.2347  25.280   <2e-16 ***
StateSouth Carolina        74.5331     2.0708  35.992   <2e-16 ***
StateSouth Dakota          76.4106     2.1742  35.144   <2e-16 ***
StateTennessee             78.7726     2.2591  34.868   <2e-16 ***
StateTexas                 79.7135     1.8425  43.265   <2e-16 ***
StateUtah                  58.7074     2.5014  23.470   <2e-16 ***
StateVermont               53.6553     2.1402  25.070   <2e-16 ***
StateVirginia              61.5596     1.8251  33.730   <2e-16 ***
StateWashington            61.8390     2.2446  27.550   <2e-16 ***
StateWest Virginia         83.7164     2.7725  30.196   <2e-16 ***
StateWisconsin             60.9719     2.0355  29.954   <2e-16 ***
StateWyoming               76.4569     2.7839  27.464   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 3.909 on 349 degrees of freedom
Multiple R-squared:  0.9953,    Adjusted R-squared:  0.9946 
F-statistic:  1455 on 51 and 349 DF,  p-value: < 2.2e-16
OPmodel2 <- lm(nmfr ~ OPDR + State -1, data=twoyeartestmerge)
summary(OPmodel2)

Call:
lm(formula = nmfr ~ OPDR + State - 1, data = twoyeartestmerge)

Residuals:
    Min      1Q  Median      3Q     Max 
-48.967  -1.685  -0.291   1.469  14.370 

Coefficients:
                          Estimate Std. Error t value Pr(>|t|)    
OPDR                      -0.47350    0.07831  -6.046 3.82e-09 ***
StateAlabama              58.45401    1.52320  38.376  < 2e-16 ***
StateAlaska               61.94334    1.69615  36.520  < 2e-16 ***
StateArizona              69.60248    1.64241  42.378  < 2e-16 ***
StateArkansas             73.39564    1.56999  46.749  < 2e-16 ***
StateCalifornia           51.40410    1.53232  33.547  < 2e-16 ***
StateColorado             40.12106    1.60433  25.008  < 2e-16 ***
StateConnecticut          40.40925    1.66578  24.258  < 2e-16 ***
StateDelaware             55.55351    1.73700  31.983  < 2e-16 ***
StateDistrict of Columbia 42.83615    1.59880  26.793  < 2e-16 ***
StateFlorida              60.04757    1.61227  37.244  < 2e-16 ***
StateGeorgia              63.01887    1.55061  40.641  < 2e-16 ***
StateHawaii               54.64338    1.52455  35.842  < 2e-16 ***
StateIdaho                50.37642    1.53207  32.881  < 2e-16 ***
StateIllinois             55.90962    1.61342  34.653  < 2e-16 ***
StateIndiana              62.35983    1.55466  40.112  < 2e-16 ***
StateIowa                 53.40475    1.54313  34.608  < 2e-16 ***
StateKansas               60.31284    1.53555  39.278  < 2e-16 ***
StateKentucky             71.53069    1.87778  38.093  < 2e-16 ***
StateLouisiana            69.95514    1.51743  46.101  < 2e-16 ***
StateMaine                47.63027    1.68442  28.277  < 2e-16 ***
StateMaryland             50.00037    1.73700  28.786  < 2e-16 ***
StateMassachusetts        46.85697    1.78116  26.307  < 2e-16 ***
StateMichigan             52.98008    1.63206  32.462  < 2e-16 ***
StateMinnesota            46.45912    1.54020  30.164  < 2e-16 ***
StateMississippi          71.67033    1.51190  47.404  < 2e-16 ***
StateMissouri             60.59142    1.68396  35.982  < 2e-16 ***
StateMontana              52.96151    1.57095  33.713  < 2e-16 ***
StateNebraska             52.89402    1.50062  35.248  < 2e-16 ***
StateNevada               68.72855    1.88440  36.472  < 2e-16 ***
StateNew Hampshire        41.95616    1.85580  22.608  < 2e-16 ***
StateNew Jersey           41.62404    1.55090  26.839  < 2e-16 ***
StateNew Mexico           70.18808    1.88259  37.283  < 2e-16 ***
StateNew York             47.84217    1.59019  30.086  < 2e-16 ***
StateNorth Carolina       58.04336    1.65134  35.149  < 2e-16 ***
StateOhio                 63.08942    1.80479  34.957  < 2e-16 ***
StateOklahoma             79.69787    1.80814  44.077  < 2e-16 ***
StateOregon               48.05313    1.63411  29.406  < 2e-16 ***
StatePennsylvania         49.29380    1.58222  31.155  < 2e-16 ***
StateRhode Island         46.55040    1.90143  24.482  < 2e-16 ***
StateSouth Carolina       62.67228    1.57420  39.812  < 2e-16 ***
StateSouth Dakota         61.98329    1.51805  40.831  < 2e-16 ***
StateTennessee            66.60547    1.72041  38.715  < 2e-16 ***
StateTexas                69.89233    1.52232  45.912  < 2e-16 ***
StateUtah                 45.51657    1.89715  23.992  < 2e-16 ***
StateVermont              42.15764    1.65566  25.463  < 2e-16 ***
StateVirginia             53.31035    1.58530  33.628  < 2e-16 ***
StateWashington           49.09374    1.66047  29.566  < 2e-16 ***
StateWest Virginia        72.75654    2.54308  28.610  < 2e-16 ***
StateWisconsin            50.57104    1.63658  30.900  < 2e-16 ***
StateWyoming              56.59652    1.60583  35.244  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 4.196 on 349 degrees of freedom
Multiple R-squared:  0.9946,    Adjusted R-squared:  0.9938 
F-statistic:  1262 on 51 and 349 DF,  p-value: < 2.2e-16

48. fixed and random effect models with two year lags and Hausman test

MLfixed2 <- plm(nmfr ~ MLDR, data=twoyeartestmerge, index=c("State", "year"), model="within")
MLrandom2 <- plm(nmfr ~ MLDR, data=twoyeartestmerge, index=c("State", "year"), model="random")

summary(MLfixed2)
Oneway (individual) effect Within Model

Call:
plm(formula = nmfr ~ MLDR, data = twoyeartestmerge, model = "within", 
    index = c("State", "year"))

Balanced Panel: n = 50, T = 8, N = 400

Residuals:
     Min.   1st Qu.    Median   3rd Qu.      Max. 
-49.14927  -1.89474  -0.33096   1.66208  15.23224 

Coefficients:
      Estimate Std. Error t-value Pr(>|t|)   
MLDR -0.060629   0.019696 -3.0783 0.002247 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    6788
Residual Sum of Squares: 6608.6
R-Squared:      0.026434
Adj. R-Squared: -0.11305
F-statistic: 9.476 on 1 and 349 DF, p-value: 0.0022466
summary(MLrandom2)
Oneway (individual) effect Random Effect Model 
   (Swamy-Arora's transformation)

Call:
plm(formula = nmfr ~ MLDR, data = twoyeartestmerge, model = "random", 
    index = c("State", "year"))

Balanced Panel: n = 50, T = 8, N = 400

Effects:
                 var std.dev share
idiosyncratic 18.936   4.352 0.291
individual    46.148   6.793 0.709
theta: 0.7791

Residuals:
    Min.  1st Qu.   Median  3rd Qu.     Max. 
-48.7064  -2.4366  -0.2995   2.3147  17.5751 

Coefficients:
             Estimate Std. Error z-value  Pr(>|z|)    
(Intercept) 35.378015   4.330693  8.1691 3.106e-16 ***
MLDR         0.048713   0.012128  4.0168 5.900e-05 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    8742.5
Residual Sum of Squares: 8401.9
R-Squared:      0.038959
Adj. R-Squared: 0.036545
Chisq: 16.1343 on 1 DF, p-value: 5.9004e-05
phtest(MLfixed2, MLrandom2)

    Hausman Test

data:  nmfr ~ MLDR
chisq = 49.642, df = 1, p-value = 1.845e-12
alternative hypothesis: one model is inconsistent
Dfixed2 <- plm(nmfr ~ DDR, data=twoyeartestmerge, index=c("State", "year"), model="within")
Drandom2 <- plm(nmfr ~ DDR, data=twoyeartestmerge, index=c("State", "year"), model="random")

summary(Dfixed2)
Oneway (individual) effect Within Model

Call:
plm(formula = nmfr ~ DDR, data = twoyeartestmerge, model = "within", 
    index = c("State", "year"))

Balanced Panel: n = 50, T = 8, N = 400

Residuals:
     Min.   1st Qu.    Median   3rd Qu.      Max. 
-48.10274  -1.55544  -0.28595   1.43194  14.06921 

Coefficients:
     Estimate Std. Error t-value  Pr(>|t|)    
DDR -0.448772   0.045998 -9.7563 < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    6788
Residual Sum of Squares: 5333.4
R-Squared:      0.21429
Adj. R-Squared: 0.10173
F-statistic: 95.1858 on 1 and 349 DF, p-value: < 2.22e-16
summary(Drandom2)
Oneway (individual) effect Random Effect Model 
   (Swamy-Arora's transformation)

Call:
plm(formula = nmfr ~ DDR, data = twoyeartestmerge, model = "random", 
    index = c("State", "year"))

Balanced Panel: n = 50, T = 8, N = 400

Effects:
                 var std.dev share
idiosyncratic 15.282   3.909 0.136
individual    97.086   9.853 0.864
theta: 0.8611

Residuals:
    Min.  1st Qu.   Median  3rd Qu.     Max. 
-48.9272  -1.9749  -0.6160   1.5994  15.2403 

Coefficients:
             Estimate Std. Error z-value  Pr(>|z|)    
(Intercept) 66.414709   2.168685 30.6244 < 2.2e-16 ***
DDR         -0.392888   0.045081 -8.7151 < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    7561
Residual Sum of Squares: 6349.3
R-Squared:      0.16025
Adj. R-Squared: 0.15814
Chisq: 75.953 on 1 DF, p-value: < 2.22e-16
phtest(Dfixed2, Drandom2)

    Hausman Test

data:  nmfr ~ DDR
chisq = 37.401, df = 1, p-value = 9.616e-10
alternative hypothesis: one model is inconsistent
OPfixed2 <- plm(nmfr ~ OPDR, data=twoyeartestmerge, index=c("State", "year"), model="within")
OPrandom2 <- plm(nmfr ~ OPDR, data=twoyeartestmerge, index=c("State", "year"), model="random")

summary(OPfixed2)
Oneway (individual) effect Within Model

Call:
plm(formula = nmfr ~ OPDR, data = twoyeartestmerge, model = "within", 
    index = c("State", "year"))

Balanced Panel: n = 50, T = 8, N = 400

Residuals:
     Min.   1st Qu.    Median   3rd Qu.      Max. 
-48.96663  -1.68497  -0.29063   1.46926  14.36966 

Coefficients:
      Estimate Std. Error t-value  Pr(>|t|)    
OPDR -0.473496   0.078315  -6.046 3.817e-09 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    6788
Residual Sum of Squares: 6144.5
R-Squared:      0.094811
Adj. R-Squared: -0.034873
F-statistic: 36.5547 on 1 and 349 DF, p-value: 3.817e-09
summary(OPrandom2)
Oneway (individual) effect Random Effect Model 
   (Swamy-Arora's transformation)

Call:
plm(formula = nmfr ~ OPDR, data = twoyeartestmerge, model = "random", 
    index = c("State", "year"))

Balanced Panel: n = 50, T = 8, N = 400

Effects:
                  var std.dev share
idiosyncratic  17.606   4.196 0.148
individual    101.725  10.086 0.852
theta: 0.8545

Residuals:
     Min.   1st Qu.    Median   3rd Qu.      Max. 
-49.69446  -2.05139  -0.62305   1.55192  16.32835 

Coefficients:
             Estimate Std. Error z-value  Pr(>|z|)    
(Intercept) 56.325594   1.592988 35.3585 < 2.2e-16 ***
OPDR        -0.457139   0.076321 -5.9897 2.102e-09 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    7636.3
Residual Sum of Squares: 7004.9
R-Squared:      0.082688
Adj. R-Squared: 0.080383
Chisq: 35.8763 on 1 DF, p-value: 2.1025e-09
phtest(OPfixed2, OPrandom2)

    Hausman Test

data:  nmfr ~ OPDR
chisq = 0.86772, df = 1, p-value = 0.3516
alternative hypothesis: one model is inconsistent

49. fixed effect models with states included with one year lags

MLmodel1 <- lm(nmfr ~ MLDR + State -1, data=oneyeartestmerge)
summary(MLmodel1)

Call:
lm(formula = nmfr ~ MLDR + State - 1, data = oneyeartestmerge)

Residuals:
    Min      1Q  Median      3Q     Max 
-7.0089 -1.7219 -0.4339  1.2604 13.6883 

Coefficients:
                           Estimate Std. Error t value Pr(>|t|)    
MLDR                       -0.09416    0.01619  -5.816 1.55e-08 ***
StateAlabama              101.59729    7.84140  12.957  < 2e-16 ***
StateAlaska                90.58841    5.73615  15.793  < 2e-16 ***
StateArizona               98.12316    5.57436  17.603  < 2e-16 ***
StateArkansas             114.58654    7.60529  15.067  < 2e-16 ***
StateCalifornia            81.40994    4.49992  18.091  < 2e-16 ***
StateColorado              63.27919    4.66801  13.556  < 2e-16 ***
StateConnecticut           60.68468    4.34900  13.954  < 2e-16 ***
StateDelaware              84.44474    5.90812  14.293  < 2e-16 ***
StateDistrict of Columbia  80.59649    7.12857  11.306  < 2e-16 ***
StateFlorida               89.45518    5.72731  15.619  < 2e-16 ***
StateGeorgia               96.35219    6.18325  15.583  < 2e-16 ***
StateHawaii                79.37662    4.71178  16.846  < 2e-16 ***
StateIdaho                 76.78002    5.01633  15.306  < 2e-16 ***
StateIllinois              81.96931    5.13379  15.967  < 2e-16 ***
StateIndiana               95.66966    6.21531  15.393  < 2e-16 ***
StateIowa                  79.12240    4.95214  15.977  < 2e-16 ***
StateKansas                90.19659    5.51866  16.344  < 2e-16 ***
StateKentucky             108.33021    7.52914  14.388  < 2e-16 ***
StateLouisiana            112.27426    7.54423  14.882  < 2e-16 ***
StateMaine                 72.14438    5.08575  14.186  < 2e-16 ***
StateMaryland              74.66603    5.24981  14.223  < 2e-16 ***
StateMassachusetts         66.28542    4.44756  14.904  < 2e-16 ***
StateMichigan              82.99105    5.90108  14.064  < 2e-16 ***
StateMinnesota             67.53884    4.13814  16.321  < 2e-16 ***
StateMississippi          118.39074    8.31497  14.238  < 2e-16 ***
StateMissouri              92.54272    6.35614  14.560  < 2e-16 ***
StateMontana               83.10605    5.71756  14.535  < 2e-16 ***
StateNebraska              78.96201    4.82142  16.377  < 2e-16 ***
StateNevada                96.24353    6.00622  16.024  < 2e-16 ***
StateNew Hampshire         61.31299    4.54829  13.480  < 2e-16 ***
StateNew Jersey            65.19093    4.58885  14.206  < 2e-16 ***
StateNew Mexico           101.95220    6.56426  15.531  < 2e-16 ***
StateNew York              70.70534    4.55501  15.523  < 2e-16 ***
StateNorth Carolina        88.30275    5.96057  14.814  < 2e-16 ***
StateOhio                  92.84848    6.19644  14.984  < 2e-16 ***
StateOklahoma             118.84206    7.67871  15.477  < 2e-16 ***
StateOregon                73.57615    5.11936  14.372  < 2e-16 ***
StatePennsylvania          77.97971    5.58251  13.969  < 2e-16 ***
StateRhode Island          67.75749    4.94043  13.715  < 2e-16 ***
StateSouth Carolina       100.09794    6.96033  14.381  < 2e-16 ***
StateSouth Dakota          89.99210    5.19653  17.318  < 2e-16 ***
StateTennessee            104.13442    7.33576  14.195  < 2e-16 ***
StateTexas                100.94570    5.56938  18.125  < 2e-16 ***
StateUtah                  66.28520    4.78298  13.859  < 2e-16 ***
StateVermont               63.68725    4.54269  14.020  < 2e-16 ***
StateVirginia              78.98087    5.04225  15.664  < 2e-16 ***
StateWashington            71.45334    4.66711  15.310  < 2e-16 ***
StateWest Virginia        107.03932    8.01354  13.357  < 2e-16 ***
StateWisconsin             73.70766    4.77107  15.449  < 2e-16 ***
StateWyoming               86.09606    5.75611  14.957  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 2.994 on 299 degrees of freedom
Multiple R-squared:  0.9974,    Adjusted R-squared:  0.9969 
F-statistic:  2226 on 51 and 299 DF,  p-value: < 2.2e-16
Dmodel1 <- lm(nmfr ~ DDR + State -1, data=oneyeartestmerge)
summary(Dmodel1)

Call:
lm(formula = nmfr ~ DDR + State - 1, data = oneyeartestmerge)

Residuals:
    Min      1Q  Median      3Q     Max 
-7.5896 -1.4292 -0.4071  1.1550 12.8086 

Coefficients:
                          Estimate Std. Error t value Pr(>|t|)    
DDR                       -0.38663    0.03351  -11.54   <2e-16 ***
StateAlabama              68.89032    1.46467   47.03   <2e-16 ***
StateAlaska               78.97004    2.07993   37.97   <2e-16 ***
StateArizona              84.97976    1.89348   44.88   <2e-16 ***
StateArkansas             83.75382    1.49590   55.99   <2e-16 ***
StateCalifornia           68.09786    1.43918   47.32   <2e-16 ***
StateColorado             54.16669    1.79310   30.21   <2e-16 ***
StateConnecticut          47.20907    1.37347   34.37   <2e-16 ***
StateDelaware             64.38897    1.54591   41.65   <2e-16 ***
StateDistrict of Columbia 50.97908    1.39582   36.52   <2e-16 ***
StateFlorida              70.52121    1.54922   45.52   <2e-16 ***
StateGeorgia              71.87264    1.36918   52.49   <2e-16 ***
StateHawaii               63.72185    1.37347   46.40   <2e-16 ***
StateIdaho                64.51235    1.71656   37.58   <2e-16 ***
StateIllinois             62.93073    1.32300   47.57   <2e-16 ***
StateIndiana              73.91675    1.55400   47.57   <2e-16 ***
StateIowa                 62.14011    1.38010   45.03   <2e-16 ***
StateKansas               71.19802    1.46431   48.62   <2e-16 ***
StateKentucky             82.64022    1.82029   45.40   <2e-16 ***
StateLouisiana            81.46931    1.47454   55.25   <2e-16 ***
StateMaine                57.12053    1.55547   36.72   <2e-16 ***
StateMaryland             55.37238    1.34828   41.07   <2e-16 ***
StateMassachusetts        52.82968    1.41069   37.45   <2e-16 ***
StateMichigan             63.05431    1.55105   40.65   <2e-16 ***
StateMinnesota            55.17557    1.36392   40.45   <2e-16 ***
StateMississippi          81.67029    1.38810   58.84   <2e-16 ***
StateMissouri             70.34930    1.58028   44.52   <2e-16 ***
StateMontana              69.22849    1.90204   36.40   <2e-16 ***
StateNebraska             61.54062    1.30887   47.02   <2e-16 ***
StateNevada               80.58865    1.89715   42.48   <2e-16 ***
StateNew Hampshire        51.06851    1.66197   30.73   <2e-16 ***
StateNew Jersey           48.48376    1.27131   38.14   <2e-16 ***
StateNew Mexico           89.61452    2.40452   37.27   <2e-16 ***
StateNew York             54.07978    1.26477   42.76   <2e-16 ***
StateNorth Carolina       66.38421    1.44543   45.93   <2e-16 ***
StateOhio                 71.96390    1.60498   44.84   <2e-16 ***
StateOklahoma             93.03455    1.87599   49.59   <2e-16 ***
StateOregon               61.21293    1.75345   34.91   <2e-16 ***
StatePennsylvania         60.03786    1.55805   38.53   <2e-16 ***
StateRhode Island         54.88819    1.64284   33.41   <2e-16 ***
StateSouth Carolina       73.33326    1.51351   48.45   <2e-16 ***
StateSouth Dakota         74.74964    1.58513   47.16   <2e-16 ***
StateTennessee            77.22400    1.65277   46.72   <2e-16 ***
StateTexas                79.60773    1.33990   59.41   <2e-16 ***
StateUtah                 57.09154    1.83717   31.08   <2e-16 ***
StateVermont              52.00721    1.56174   33.30   <2e-16 ***
StateVirginia             60.49947    1.32363   45.71   <2e-16 ***
StateWashington           60.06511    1.63219   36.80   <2e-16 ***
StateWest Virginia        81.56153    2.04763   39.83   <2e-16 ***
StateWisconsin            59.52044    1.48697   40.03   <2e-16 ***
StateWyoming              73.74622    2.03341   36.27   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 2.628 on 299 degrees of freedom
Multiple R-squared:  0.998, Adjusted R-squared:  0.9976 
F-statistic:  2892 on 51 and 299 DF,  p-value: < 2.2e-16
OPmodel1 <- lm(nmfr ~ OPDR + State -1, data=oneyeartestmerge)
summary(OPmodel1)

Call:
lm(formula = nmfr ~ OPDR + State - 1, data = oneyeartestmerge)

Residuals:
    Min      1Q  Median      3Q     Max 
-7.0476 -1.6341 -0.3391  1.2784 13.2370 

Coefficients:
                          Estimate Std. Error t value Pr(>|t|)    
OPDR                       -0.3726     0.0588  -6.336 8.65e-10 ***
StateAlabama               58.1291     1.1514  50.487  < 2e-16 ***
StateAlaska                61.6877     1.2719  48.501  < 2e-16 ***
StateArizona               69.7784     1.2430  56.137  < 2e-16 ***
StateArkansas              73.2570     1.1840  61.875  < 2e-16 ***
StateCalifornia            57.9101     1.1578  50.018  < 2e-16 ***
StateColorado              39.8882     1.2139  32.860  < 2e-16 ***
StateConnecticut           40.0356     1.2695  31.536  < 2e-16 ***
StateDelaware              55.2216     1.3274  41.601  < 2e-16 ***
StateDistrict of Columbia  42.6318     1.2152  35.083  < 2e-16 ***
StateFlorida               59.7979     1.2168  49.143  < 2e-16 ***
StateGeorgia               63.2274     1.1751  53.806  < 2e-16 ***
StateHawaii                54.4779     1.1529  47.252  < 2e-16 ***
StateIdaho                 50.1824     1.1576  43.351  < 2e-16 ***
StateIllinois              55.9376     1.2228  45.747  < 2e-16 ***
StateIndiana               62.3872     1.1766  53.023  < 2e-16 ***
StateIowa                  53.1583     1.1680  45.511  < 2e-16 ***
StateKansas                60.7510     1.1634  52.217  < 2e-16 ***
StateKentucky              70.8337     1.4470  48.952  < 2e-16 ***
StateLouisiana             70.4736     1.1486  61.358  < 2e-16 ***
StateMaine                 47.2082     1.2791  36.907  < 2e-16 ***
StateMaryland              49.3001     1.3229  37.266  < 2e-16 ***
StateMassachusetts         46.1448     1.3598  33.935  < 2e-16 ***
StateMichigan              52.6600     1.2398  42.476  < 2e-16 ***
StateMinnesota             46.4111     1.1657  39.814  < 2e-16 ***
StateMississippi           71.8693     1.1424  62.912  < 2e-16 ***
StateMissouri              60.0616     1.2787  46.971  < 2e-16 ***
StateMontana               52.9158     1.1837  44.704  < 2e-16 ***
StateNebraska              52.8427     1.1355  46.539  < 2e-16 ***
StateNevada                67.4719     1.4213  47.471  < 2e-16 ***
StateNew Hampshire         41.3814     1.4364  28.809  < 2e-16 ***
StateNew Jersey            41.5829     1.1764  35.349  < 2e-16 ***
StateNew Mexico            69.7638     1.4100  49.476  < 2e-16 ***
StateNew York              47.8593     1.2060  39.685  < 2e-16 ***
StateNorth Carolina        57.7257     1.2470  46.291  < 2e-16 ***
StateOhio                  62.6209     1.3899  45.054  < 2e-16 ***
StateOklahoma              79.6834     1.3723  58.067  < 2e-16 ***
StateOregon                47.7848     1.2327  38.765  < 2e-16 ***
StatePennsylvania          48.9159     1.2011  40.726  < 2e-16 ***
StateRhode Island          45.5890     1.4475  31.495  < 2e-16 ***
StateSouth Carolina        62.7627     1.1943  52.551  < 2e-16 ***
StateSouth Dakota          62.0216     1.1468  54.084  < 2e-16 ***
StateTennessee             66.3069     1.3128  50.509  < 2e-16 ***
StateTexas                 70.8794     1.1510  61.582  < 2e-16 ***
StateUtah                  44.9413     1.4359  31.298  < 2e-16 ***
StateVermont               41.6390     1.2526  33.242  < 2e-16 ***
StateVirginia              53.1120     1.1999  44.264  < 2e-16 ***
StateWashington            48.6373     1.2511  38.875  < 2e-16 ***
StateWest Virginia         71.0116     1.9505  36.408  < 2e-16 ***
StateWisconsin             50.1570     1.2434  40.339  < 2e-16 ***
StateWyoming               56.2094     1.2132  46.330  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 2.966 on 299 degrees of freedom
Multiple R-squared:  0.9974,    Adjusted R-squared:  0.997 
F-statistic:  2268 on 51 and 299 DF,  p-value: < 2.2e-16

50. fixed and random effect models with one year lags and Hausman test

MLfixed1 <- plm(nmfr ~ MLDR, data=oneyeartestmerge, index=c("State", "year"), model="within")
MLrandom1 <- plm(nmfr ~ MLDR, data=oneyeartestmerge, index=c("State", "year"), model="random")

summary(MLfixed1)
Oneway (individual) effect Within Model

Call:
plm(formula = nmfr ~ MLDR, data = oneyeartestmerge, model = "within", 
    index = c("State", "year"))

Balanced Panel: n = 50, T = 7, N = 350

Residuals:
    Min.  1st Qu.   Median  3rd Qu.     Max. 
-7.00892 -1.72194 -0.43388  1.26043 13.68834 

Coefficients:
      Estimate Std. Error t-value  Pr(>|t|)    
MLDR -0.094161   0.016190 -5.8161 1.547e-08 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    2984
Residual Sum of Squares: 2680.8
R-Squared:      0.10164
Adj. R-Squared: -0.048593
F-statistic: 33.827 on 1 and 299 DF, p-value: 1.5469e-08
summary(MLrandom1)
Oneway (individual) effect Random Effect Model 
   (Swamy-Arora's transformation)

Call:
plm(formula = nmfr ~ MLDR, data = oneyeartestmerge, model = "random", 
    index = c("State", "year"))

Balanced Panel: n = 50, T = 7, N = 350

Effects:
                 var std.dev share
idiosyncratic  8.966   2.994 0.152
individual    49.937   7.067 0.848
theta: 0.8419

Residuals:
    Min.  1st Qu.   Median  3rd Qu.     Max. 
-6.20990 -2.32082 -0.48372  1.66189 15.68283 

Coefficients:
             Estimate Std. Error z-value Pr(>|z|)    
(Intercept) 47.370355   4.318366 10.9695   <2e-16 ***
MLDR         0.016124   0.012035  1.3397   0.1803    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    3882.6
Residual Sum of Squares: 3862.6
R-Squared:      0.005131
Adj. R-Squared: 0.0022722
Chisq: 1.79481 on 1 DF, p-value: 0.18034
phtest(MLfixed1, MLrandom1)

    Hausman Test

data:  nmfr ~ MLDR
chisq = 103.73, df = 1, p-value < 2.2e-16
alternative hypothesis: one model is inconsistent
Dfixed1 <- plm(nmfr ~ DDR, data=oneyeartestmerge, index=c("State", "year"), model="within")
Drandom1 <- plm(nmfr ~ DDR, data=oneyeartestmerge, index=c("State", "year"), model="random")

summary(Dfixed1)
Oneway (individual) effect Within Model

Call:
plm(formula = nmfr ~ DDR, data = oneyeartestmerge, model = "within", 
    index = c("State", "year"))

Balanced Panel: n = 50, T = 7, N = 350

Residuals:
    Min.  1st Qu.   Median  3rd Qu.     Max. 
-7.58959 -1.42918 -0.40709  1.15496 12.80861 

Coefficients:
     Estimate Std. Error t-value  Pr(>|t|)    
DDR -0.386630   0.033505 -11.539 < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    2984
Residual Sum of Squares: 2064.6
R-Squared:      0.30812
Adj. R-Squared: 0.19242
F-statistic: 133.156 on 1 and 299 DF, p-value: < 2.22e-16
summary(Drandom1)
Oneway (individual) effect Random Effect Model 
   (Swamy-Arora's transformation)

Call:
plm(formula = nmfr ~ DDR, data = oneyeartestmerge, model = "random", 
    index = c("State", "year"))

Balanced Panel: n = 50, T = 7, N = 350

Effects:
                  var std.dev share
idiosyncratic   6.905   2.628 0.064
individual    100.860  10.043 0.936
theta: 0.9016

Residuals:
    Min.  1st Qu.   Median  3rd Qu.     Max. 
-5.60097 -1.78912 -0.39454  1.25752 14.09409 

Coefficients:
             Estimate Std. Error z-value  Pr(>|z|)    
(Intercept) 66.076374   1.900229  34.773 < 2.2e-16 ***
DDR         -0.359431   0.033442 -10.748 < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    3332.1
Residual Sum of Squares: 2501.6
R-Squared:      0.24922
Adj. R-Squared: 0.24706
Chisq: 115.519 on 1 DF, p-value: < 2.22e-16
phtest(Dfixed1, Drandom1)

    Hausman Test

data:  nmfr ~ DDR
chisq = 173.57, df = 1, p-value < 2.2e-16
alternative hypothesis: one model is inconsistent
OPfixed1 <- plm(nmfr ~ OPDR, data=oneyeartestmerge, index=c("State", "year"), model="within")
OPrandom1 <- plm(nmfr ~ OPDR, data=oneyeartestmerge, index=c("State", "year"), model="random")

summary(OPfixed1)
Oneway (individual) effect Within Model

Call:
plm(formula = nmfr ~ OPDR, data = oneyeartestmerge, model = "within", 
    index = c("State", "year"))

Balanced Panel: n = 50, T = 7, N = 350

Residuals:
    Min.  1st Qu.   Median  3rd Qu.     Max. 
-7.04761 -1.63409 -0.33914  1.27841 13.23702 

Coefficients:
      Estimate Std. Error t-value  Pr(>|t|)    
OPDR -0.372572   0.058801 -6.3361 8.648e-10 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    2984
Residual Sum of Squares: 2630.8
R-Squared:      0.11838
Adj. R-Squared: -0.029054
F-statistic: 40.1465 on 1 and 299 DF, p-value: 8.6476e-10
summary(OPrandom1)
Oneway (individual) effect Random Effect Model 
   (Swamy-Arora's transformation)

Call:
plm(formula = nmfr ~ OPDR, data = oneyeartestmerge, model = "random", 
    index = c("State", "year"))

Balanced Panel: n = 50, T = 7, N = 350

Effects:
                  var std.dev share
idiosyncratic   8.799   2.966 0.077
individual    104.991  10.247 0.923
theta: 0.8912

Residuals:
    Min.  1st Qu.   Median  3rd Qu.     Max. 
-5.33229 -1.97631 -0.50823  1.38051 14.81980 

Coefficients:
             Estimate Std. Error z-value  Pr(>|z|)    
(Intercept) 56.293865   1.548441 36.3552 < 2.2e-16 ***
OPDR        -0.366979   0.057854 -6.3432  2.25e-10 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Total Sum of Squares:    3409.1
Residual Sum of Squares: 3055.8
R-Squared:      0.10364
Adj. R-Squared: 0.10106
Chisq: 40.2363 on 1 DF, p-value: 2.2502e-10
phtest(OPfixed1, OPrandom1)

    Hausman Test

data:  nmfr ~ OPDR
chisq = 0.28305, df = 1, p-value = 0.5947
alternative hypothesis: one model is inconsistent

Works Cited:

Case, A., & Deaton, A. (2017). Mortality and morbidity in the 21st century. Brookings papers on economic activity, 397.

Caudillo, M. L., & Villarreal, A. (2021). The Opioid Epidemic and Nonmarital Childbearing in the United States, 2000–2016. Demography, 58(1), 345-378.

Bachrach, C. A., & Morgan, S. P. (2013). A cognitive–social model of fertility intentions. Population and development review, 39(3), 459-485.

Kearney, M. S., & Levine, P. B. (2011). Income Inequality and Early Non-Marital Childbearing: An Economic Exploration of the” Culture of Despair” (No. w17157). National Bureau of economic research.

Kearney, M. S., & Levine, P. B. (2015). Investigating recent trends in the US teen birth rate. Journal of Health Economics, 41, 15-29.

Lutz, W., Skirbekk, V., & Testa, M. R. (2006). The low-fertility trap hypothesis: Forces that may lead to further postponement and fewer births in Europe. Vienna yearbook of population research, 167-192.

Melchior, M., Berkman, L. F., Kawachi, I., Krieger, N., Zins, M., Bonenfant, S., & Goldberg, M. (2006). Lifelong socioeconomic trajectory and premature mortality (35–65 years) in France: findings from the GAZEL Cohort Study. Journal of Epidemiology & Community Health, 60(11), 937-944.

Merton, Robert K. 1968. “The Matthew Effect in Science.” Science 159(3810):56–63.

Montez, J. K., & Hayward, M. D. (2014). Cumulative childhood adversity, educational attainment, and active life expectancy among US adults. Demography, 51(2), 413-435.

Montez JK,Mehri N,Monnat SM, Beckfield J,Chapman D,Grumbach JM,etal. (2022) U.S.statepolicy contexts andmortality of working-ageadults. PLoS ONE17(10): e0275466. https://doi.org/10.1371/journal.pone.0275466

Schneider, D., & Gemmill, A. (2016). The Surprising Decline in the Non-Marital Fertility Rate in the United States. Population and Development Review, 42(4), 627–649. http://www.jstor.org/stable/44132227

Woolf SH, Schoomaker H. Life Expectancy and Mortality Rates in the United States, 1959-2017. JAMA. 2019;322(20):1996–2016. doi:10.1001/jama.2019.16932

Woolf S H, Chapman D A, Buchanich J M, Bobby K J, Zimmerman E B, Blackburn S M et al. Changes in midlife death rates across racial and ethnic groups in the United States: systematic analysis of vital statistics BMJ 2018; 362 :k3096 doi:10.1136/bmj.k3096