library(tidyr)
library(dplyr)
Attaching package: ‘dplyr’
The following objects are masked from ‘package:stats’:
filter, lag
The following objects are masked from ‘package:base’:
intersect, setdiff, setequal, union
library(ggplot2)
library(estimatr)
library(readxl)
Warning: package ‘readxl’ was built under R version 4.3.1
#Download Data
aca <- read_excel("C:/Users/abact/Downloads/Impact Final ACA Data.xlsx", na = "..")
View(aca)
long_df <- pivot_longer(aca, cols = matches("^\\d{4}$"), names_to = "Year", values_to = "Value")
aca <- pivot_wider(long_df, names_from = "Series Name", values_from = "Value")
print(aca)
#EDA
aca_2000 <- aca %>%
filter(across(starts_with("Year"), ~ as.numeric(.) >= 2000))
Warning: Using `across()` in `filter()` was deprecated in dplyr 1.0.8.
Please use `if_any()` or `if_all()` instead.
aca_2000$Year <- as.numeric(aca_2000$Year)
aca_2000$Post <- ifelse(aca_2000$Year >= 2010, 1, 0)
aca_2000$Treat <- ifelse(aca_2000$`Country Name` == 'United States', 1, 0)
print(aca_2000)
na_counts <- colSums(is.na(aca_2000))
print(na_counts)
Country Name
0
Year
0
Adolescent fertility rate (births per 1,000 women ages 15-19)
0
Births attended by skilled health staff (% of total)
24
Current health expenditure per capita (current US$)
0
Domestic general government health expenditure per capita (current US$)
0
Domestic private health expenditure per capita (current US$)
0
Fertility rate, total (births per woman)
0
GDP (current US$)
0
Immunization, DPT (% of children ages 12-23 months)
0
Immunization, measles (% of children ages 12-23 months)
0
Imports of goods and services (% of GDP)
0
Life expectancy at birth, total (years)
0
Mortality from CVD, cancer, diabetes or CRD between exact ages 30 and 70 (%)
0
Number of infant deaths
0
Number of maternal deaths
0
Out-of-pocket expenditure per capita (current US$)
0
Population, total
0
Tax revenue (% of GDP)
20
Post
0
Treat
0
aca_2000 <- subset(aca_2000, select = -`Births attended by skilled health staff (% of total)`)
#Control Selection
ggplot(aca_2000, aes(x = Year, y = `Out-of-pocket expenditure per capita (current US$)`, color = `Country Name`)) +
geom_line() +
labs(x = "Year", y = "Out-of-pocket expenditure per capita (current US$)", color = "Country") +
theme_minimal()
#Testing Parallel Trend Assumption
aca_2000_2009 <- subset(aca_2000, Year >= 2000 & Year <= 2009)
australia <- lm(`Out-of-pocket expenditure per capita (current US$)` ~ Year, data = subset(aca_2000_2009, `Country Name` == 'Australia'))
australia.coefficient <- coef(australia)
france <- lm(`Out-of-pocket expenditure per capita (current US$)` ~ Year, data = subset(aca_2000_2009, `Country Name` == 'France'))
france.coefficient <- coef(france)
germany <- lm(`Out-of-pocket expenditure per capita (current US$)` ~ Year, data = subset(aca_2000_2009, `Country Name` == 'Germany'))
germany.coefficient <- coef(germany)
japan <- lm(`Out-of-pocket expenditure per capita (current US$)` ~ Year, data = subset(aca_2000_2009, `Country Name` == 'Japan'))
japan.coefficient <- coef(japan)
uk <- lm(`Out-of-pocket expenditure per capita (current US$)` ~ Year, data = subset(aca_2000_2009, `Country Name` == 'United Kingdom'))
uk.coefficient <- coef(uk)
us <- lm(`Out-of-pocket expenditure per capita (current US$)` ~ Year, data = subset(aca_2000_2009, `Country Name` == 'United States'))
us.coefficient <- coef(us)
canada <- lm(`Out-of-pocket expenditure per capita (current US$)` ~ Year, data = subset(aca_2000_2009, `Country Name` == 'Canada'))
canada.coefficient <- coef(canada)
# Create a data frame to store the coefficients
coefficients_table <- data.frame(
Country = c("Australia", "France", "Germany", "Japan", "United Kingdom", "United States", "Canada"),
Intercept = c(australia.coefficient[1],france.coefficient[1], germany.coefficient[1], japan.coefficient[1],
uk.coefficient[1], us.coefficient[1], canada.coefficient[1]),
Year_Coefficient = c(australia.coefficient[2], france.coefficient[2], germany.coefficient[2], japan.coefficient[2],
uk.coefficient[2], us.coefficient[2], canada.coefficient[2])
)
# Print the coefficients table
print(coefficients_table)
aca_2000 <- aca_2000 %>%
filter(`Country Name` != 'Australia')
#Simple DiD
diff_in_diff <- aggregate(`Out-of-pocket expenditure per capita (current US$)` ~ Post + Treat, data = aca_2000, FUN = mean)
print(diff_in_diff)
#OLS DiD
model1 <- lm_robust(`Out-of-pocket expenditure per capita (current US$)` ~ Post + Treat + Post:Treat, data = aca_2000, clusters = `Country Name`)
summary(model1)
Call:
lm_robust(formula = `Out-of-pocket expenditure per capita (current US$)` ~
Post + Treat + Post:Treat, data = aca_2000, clusters = `Country Name`)
Standard error type: CR2
Coefficients:
Estimate Std. Error t value Pr(>|t|) CI Lower CI Upper DF
(Intercept) 440.34 36.73 11.990 0.0002774 338.4 542.3 4
Post 185.85 25.51 7.287 0.0018853 115.0 256.7 4
Treat 412.65 36.73 11.236 0.0003574 310.7 514.6 4
Post:Treat 38.51 25.51 1.510 0.2055453 -32.3 109.3 4
Multiple R-squared: 0.7093 , Adjusted R-squared: 0.7018
F-statistic: NA on 3 and 5 DF, p-value: NA
#Time Trend
model2 <- lm_robust(`Out-of-pocket expenditure per capita (current US$)` ~ Post + Treat + Post:Treat + as.factor(Year), data = aca_2000, clusters = `Country Name`)
summary(model2)
1 coefficient not defined because the design matrix is rank deficient
Call:
lm_robust(formula = `Out-of-pocket expenditure per capita (current US$)` ~
Post + Treat + Post:Treat + as.factor(Year), data = aca_2000,
clusters = `Country Name`)
Standard error type: CR2
Coefficients: (1 not defined because the design matrix is rank deficient)
Estimate Std. Error t value Pr(>|t|) CI Lower CI Upper DF
(Intercept) 308.973 44.197 6.9909 0.0009354 195.24 422.70 4.983
Post 340.934 55.804 6.1094 0.0017233 197.33 484.53 4.983
Treat 412.653 36.727 11.2358 0.0003574 310.68 514.62 4.000
as.factor(Year)2001 -9.561 9.524 -1.0039 0.3614937 -34.04 14.92 5.000
as.factor(Year)2002 10.918 17.856 0.6114 0.5676449 -34.98 56.82 5.000
as.factor(Year)2003 77.249 17.352 4.4518 0.0066913 32.64 121.85 5.000
as.factor(Year)2004 124.061 22.307 5.5614 0.0025858 66.72 181.40 5.000
as.factor(Year)2005 140.270 30.479 4.6021 0.0058291 61.92 218.62 5.000
as.factor(Year)2006 190.984 37.964 5.0307 0.0039985 93.39 288.57 5.000
as.factor(Year)2007 233.776 50.318 4.6460 0.0056025 104.43 363.12 5.000
as.factor(Year)2008 273.939 48.602 5.6364 0.0024375 149.00 398.87 5.000
as.factor(Year)2009 272.005 36.635 7.4247 0.0006982 177.83 366.18 5.000
as.factor(Year)2010 -48.670 37.740 -1.2896 0.2536145 -145.68 48.34 5.000
as.factor(Year)2011 -5.739 42.484 -0.1351 0.8978119 -114.95 103.47 5.000
as.factor(Year)2012 -5.755 38.083 -0.1511 0.8857931 -103.65 92.14 5.000
as.factor(Year)2013 -20.987 25.694 -0.8168 0.4511882 -87.03 45.06 5.000
as.factor(Year)2014 -13.078 23.967 -0.5457 0.6087350 -74.69 48.53 5.000
as.factor(Year)2015 -62.818 18.410 -3.4122 0.0189977 -110.14 -15.49 5.000
as.factor(Year)2016 -51.122 13.258 -3.8560 0.0119284 -85.20 -17.04 5.000
as.factor(Year)2017 -37.504 9.511 -3.9431 0.0109260 -61.95 -13.05 5.000
as.factor(Year)2018 NA NA NA NA NA NA NA
as.factor(Year)2019 8.465 8.321 1.0173 0.3556950 -12.93 29.86 5.000
Post:Treat 38.514 25.505 1.5100 0.2055453 -32.30 109.33 4.000
Multiple R-squared: 0.8245 , Adjusted R-squared: 0.7869
F-statistic: NA on 21 and 5 DF, p-value: NA
#Variable Time Trend
countries <- c("France", "Germany", "Japan", "United Kingdom", "United States", "Canada")
for (country in countries) {
column_name <- gsub(" ", "_", country) # Replace spaces with underscores in column name
aca_2000[, column_name] <- as.integer(aca_2000$`Country Name` == country)
}
model2 <- lm_robust(`Out-of-pocket expenditure per capita (current US$)` ~ Post + Treat + Post:Treat + France:Year + Germany:Year + Japan:Year + United_Kingdom:Year + United_States:Year + Canada:Year, data = aca_2000)
summary(model2)
Call:
lm_robust(formula = `Out-of-pocket expenditure per capita (current US$)` ~
Post + Treat + Post:Treat + France:Year + Germany:Year +
Japan:Year + United_Kingdom:Year + United_States:Year +
Canada:Year, data = aca_2000)
Standard error type: HC2
Coefficients:
Estimate Std. Error t value Pr(>|t|) CI Lower CI Upper DF
(Intercept) -32198.51 6219.663 -5.1769 1.027e-06 -44524.42 -19872.59 110
Post 23.02 34.654 0.6643 5.079e-01 -45.66 91.70 110
Treat -28249.37 7668.891 -3.6836 3.583e-04 -43447.31 -13051.43 110
Post:Treat -104.47 43.042 -2.4272 1.684e-02 -189.77 -19.17 110
France:Year 16.20 3.105 5.2196 8.536e-07 10.05 22.36 110
Year:Germany 16.30 3.102 5.2559 7.295e-07 10.16 22.45 110
Year:Japan 16.27 3.103 5.2440 7.682e-07 10.12 22.42 110
Year:United_Kingdom 16.30 3.103 5.2540 7.354e-07 10.15 22.45 110
Year:United_States 30.58 2.238 13.6643 1.891e-25 26.15 35.02 110
Year:Canada 16.33 3.099 5.2708 6.836e-07 10.19 22.47 110
Multiple R-squared: 0.8998 , Adjusted R-squared: 0.8915
F-statistic: 457.3 on 9 and 110 DF, p-value: < 2.2e-16
#Simple Event Study
model3 <- lm(`Out-of-pocket expenditure per capita (current US$)` ~ Treat:as.factor(Year) + France + Germany + Japan + United_Kingdom + United_States + Canada + as.factor(Year) + `Adolescent fertility rate (births per 1,000 women ages 15-19)` + `Current health expenditure per capita (current US$)` + `Domestic general government health expenditure per capita (current US$)` + `Domestic private health expenditure per capita (current US$)` + `Fertility rate, total (births per woman)` + `GDP (current US$)` + `Immunization, DPT (% of children ages 12-23 months)` + `Immunization, measles (% of children ages 12-23 months)` + `Life expectancy at birth, total (years)` + `Mortality from CVD, cancer, diabetes or CRD between exact ages 30 and 70 (%)` + `Number of infant deaths` + `Number of maternal deaths` + `Population, total` + `Tax revenue (% of GDP)`, data = aca_2000)
summary(model3)
Call:
lm(formula = `Out-of-pocket expenditure per capita (current US$)` ~
Treat:as.factor(Year) + France + Germany + Japan + United_Kingdom +
United_States + Canada + as.factor(Year) + `Adolescent fertility rate (births per 1,000 women ages 15-19)` +
`Current health expenditure per capita (current US$)` +
`Domestic general government health expenditure per capita (current US$)` +
`Domestic private health expenditure per capita (current US$)` +
`Fertility rate, total (births per woman)` + `GDP (current US$)` +
`Immunization, DPT (% of children ages 12-23 months)` +
`Immunization, measles (% of children ages 12-23 months)` +
`Life expectancy at birth, total (years)` + `Mortality from CVD, cancer, diabetes or CRD between exact ages 30 and 70 (%)` +
`Number of infant deaths` + `Number of maternal deaths` +
`Population, total` + `Tax revenue (% of GDP)`, data = aca_2000)
Residuals:
Min 1Q Median 3Q Max
-35.070 -6.449 0.000 4.107 28.458
Coefficients: (3 not defined because of singularities)
Estimate Std. Error
(Intercept) -1.105e+02 1.348e+03
France 4.100e+01 1.831e+02
Germany 1.488e+02 2.436e+02
Japan NA NA
United_Kingdom 2.522e+02 1.641e+02
United_States 5.335e+02 1.657e+03
Canada NA NA
as.factor(Year)2001 -6.498e+00 1.549e+01
as.factor(Year)2002 -8.330e+00 1.893e+01
as.factor(Year)2003 1.060e-02 2.472e+01
as.factor(Year)2004 1.313e+00 3.450e+01
as.factor(Year)2005 4.536e+00 4.049e+01
as.factor(Year)2006 3.016e+01 5.015e+01
as.factor(Year)2007 3.024e+01 5.665e+01
as.factor(Year)2008 5.528e+01 6.393e+01
as.factor(Year)2009 6.111e+01 6.818e+01
as.factor(Year)2010 7.160e+01 7.432e+01
as.factor(Year)2011 5.951e+01 8.285e+01
as.factor(Year)2012 5.666e+01 8.294e+01
as.factor(Year)2013 4.089e+01 8.630e+01
as.factor(Year)2014 3.772e+01 9.230e+01
as.factor(Year)2015 3.963e+01 8.581e+01
as.factor(Year)2016 5.827e+01 8.920e+01
as.factor(Year)2017 5.389e+01 9.264e+01
as.factor(Year)2018 5.680e+01 9.594e+01
as.factor(Year)2019 5.565e+01 9.949e+01
`Adolescent fertility rate (births per 1,000 women ages 15-19)` -4.324e+00 3.986e+00
`Current health expenditure per capita (current US$)` 2.096e+02 1.250e+02
`Domestic general government health expenditure per capita (current US$)` -2.096e+02 1.250e+02
`Domestic private health expenditure per capita (current US$)` -2.093e+02 1.250e+02
`Fertility rate, total (births per woman)` -1.261e+02 7.473e+01
`GDP (current US$)` 4.106e-11 4.033e-11
`Immunization, DPT (% of children ages 12-23 months)` 3.437e+00 2.796e+00
`Immunization, measles (% of children ages 12-23 months)` 6.342e-01 2.616e+00
`Life expectancy at birth, total (years)` 4.698e+00 1.783e+01
`Mortality from CVD, cancer, diabetes or CRD between exact ages 30 and 70 (%)` -6.358e-01 1.480e+01
`Number of infant deaths` 9.281e-02 5.367e-02
`Number of maternal deaths` -2.173e+00 9.452e-01
`Population, total` -7.439e-06 4.661e-06
`Tax revenue (% of GDP)` -8.397e+00 6.977e+00
Treat:as.factor(Year)2000 -5.964e+02 4.602e+02
Treat:as.factor(Year)2001 -5.588e+02 4.414e+02
Treat:as.factor(Year)2002 -5.356e+02 4.250e+02
Treat:as.factor(Year)2003 -5.349e+02 4.131e+02
Treat:as.factor(Year)2004 -5.656e+02 4.067e+02
Treat:as.factor(Year)2005 -5.581e+02 3.931e+02
Treat:as.factor(Year)2006 -5.880e+02 3.868e+02
Treat:as.factor(Year)2007 -5.961e+02 3.835e+02
Treat:as.factor(Year)2008 -5.232e+02 3.513e+02
Treat:as.factor(Year)2009 -3.922e+02 2.959e+02
Treat:as.factor(Year)2010 -4.920e+02 2.814e+02
Treat:as.factor(Year)2011 -3.337e+02 2.261e+02
Treat:as.factor(Year)2012 -2.579e+02 1.931e+02
Treat:as.factor(Year)2013 -1.746e+02 1.644e+02
Treat:as.factor(Year)2014 -1.410e+02 1.389e+02
Treat:as.factor(Year)2015 -1.208e+02 1.197e+02
Treat:as.factor(Year)2016 -5.931e+01 9.366e+01
Treat:as.factor(Year)2017 -3.137e+01 6.601e+01
Treat:as.factor(Year)2018 -4.144e+01 4.152e+01
Treat:as.factor(Year)2019 NA NA
t value Pr(>|t|)
(Intercept) -0.082 0.9351
France 0.224 0.8238
Germany 0.611 0.5446
Japan NA NA
United_Kingdom 1.537 0.1316
United_States 0.322 0.7490
Canada NA NA
as.factor(Year)2001 -0.419 0.6770
as.factor(Year)2002 -0.440 0.6621
as.factor(Year)2003 0.000 0.9997
as.factor(Year)2004 0.038 0.9698
as.factor(Year)2005 0.112 0.9113
as.factor(Year)2006 0.601 0.5507
as.factor(Year)2007 0.534 0.5963
as.factor(Year)2008 0.865 0.3920
as.factor(Year)2009 0.896 0.3750
as.factor(Year)2010 0.963 0.3408
as.factor(Year)2011 0.718 0.4765
as.factor(Year)2012 0.683 0.4982
as.factor(Year)2013 0.474 0.6380
as.factor(Year)2014 0.409 0.6848
as.factor(Year)2015 0.462 0.6465
as.factor(Year)2016 0.653 0.5170
as.factor(Year)2017 0.582 0.5638
as.factor(Year)2018 0.592 0.5570
as.factor(Year)2019 0.559 0.5788
`Adolescent fertility rate (births per 1,000 women ages 15-19)` -1.085 0.2841
`Current health expenditure per capita (current US$)` 1.677 0.1008
`Domestic general government health expenditure per capita (current US$)` -1.677 0.1009
`Domestic private health expenditure per capita (current US$)` -1.675 0.1012
`Fertility rate, total (births per woman)` -1.688 0.0987 .
`GDP (current US$)` 1.018 0.3143
`Immunization, DPT (% of children ages 12-23 months)` 1.229 0.2256
`Immunization, measles (% of children ages 12-23 months)` 0.242 0.8096
`Life expectancy at birth, total (years)` 0.264 0.7934
`Mortality from CVD, cancer, diabetes or CRD between exact ages 30 and 70 (%)` -0.043 0.9659
`Number of infant deaths` 1.729 0.0909 .
`Number of maternal deaths` -2.299 0.0264 *
`Population, total` -1.596 0.1179
`Tax revenue (% of GDP)` -1.204 0.2354
Treat:as.factor(Year)2000 -1.296 0.2019
Treat:as.factor(Year)2001 -1.266 0.2124
Treat:as.factor(Year)2002 -1.260 0.2144
Treat:as.factor(Year)2003 -1.295 0.2023
Treat:as.factor(Year)2004 -1.391 0.1715
Treat:as.factor(Year)2005 -1.420 0.1629
Treat:as.factor(Year)2006 -1.520 0.1357
Treat:as.factor(Year)2007 -1.554 0.1275
Treat:as.factor(Year)2008 -1.489 0.1437
Treat:as.factor(Year)2009 -1.325 0.1921
Treat:as.factor(Year)2010 -1.749 0.0875 .
Treat:as.factor(Year)2011 -1.476 0.1473
Treat:as.factor(Year)2012 -1.335 0.1888
Treat:as.factor(Year)2013 -1.062 0.2941
Treat:as.factor(Year)2014 -1.015 0.3157
Treat:as.factor(Year)2015 -1.009 0.3186
Treat:as.factor(Year)2016 -0.633 0.5299
Treat:as.factor(Year)2017 -0.475 0.6370
Treat:as.factor(Year)2018 -0.998 0.3238
Treat:as.factor(Year)2019 NA NA
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 17.53 on 43 degrees of freedom
(20 observations deleted due to missingness)
Multiple R-squared: 0.9976, Adjusted R-squared: 0.9946
F-statistic: 325.8 on 56 and 43 DF, p-value: < 2.2e-16
# Extract the coefficient estimates
coefficients <- coef(model3)
# Subset the last 20 coefficients
subset_coefficients <- coefficients[(length(coefficients) - 19):length(coefficients)]
# Print the subset of coefficients
print(subset_coefficients)
Treat:as.factor(Year)2000 Treat:as.factor(Year)2001 Treat:as.factor(Year)2002
-596.38179 -558.77817 -535.64775
Treat:as.factor(Year)2003 Treat:as.factor(Year)2004 Treat:as.factor(Year)2005
-534.90461 -565.62475 -558.11852
Treat:as.factor(Year)2006 Treat:as.factor(Year)2007 Treat:as.factor(Year)2008
-588.04144 -596.07738 -523.22768
Treat:as.factor(Year)2009 Treat:as.factor(Year)2010 Treat:as.factor(Year)2011
-392.18809 -492.01365 -333.73486
Treat:as.factor(Year)2012 Treat:as.factor(Year)2013 Treat:as.factor(Year)2014
-257.92879 -174.59791 -141.00139
Treat:as.factor(Year)2015 Treat:as.factor(Year)2016 Treat:as.factor(Year)2017
-120.78735 -59.31360 -31.37434
Treat:as.factor(Year)2018 Treat:as.factor(Year)2019
-41.44294 NA
# Create a data frame with 'Year' and subset of coefficients
coefficients_df <- data.frame(Year = aca_2000$Year, Coefficients = subset_coefficients)
Warning: row names were found from a short variable and have been discarded
# Print the data frame
plot(coefficients_df)
model3 <- lm(`Out-of-pocket expenditure per capita (current US$)` ~ Treat:relevel(as.factor(Year), ref = "2009") + relevel(as.factor(Year), ref = "2009") + Treat + France + Germany + Japan + United_Kingdom + United_States + Canada + `Adolescent fertility rate (births per 1,000 women ages 15-19)` + `Current health expenditure per capita (current US$)` + `Domestic general government health expenditure per capita (current US$)` + `Domestic private health expenditure per capita (current US$)` + `Fertility rate, total (births per woman)` + `GDP (current US$)` + `Immunization, DPT (% of children ages 12-23 months)` + `Immunization, measles (% of children ages 12-23 months)` + `Life expectancy at birth, total (years)` + `Mortality from CVD, cancer, diabetes or CRD between exact ages 30 and 70 (%)` + `Number of infant deaths` + `Number of maternal deaths` + `Population, total` + `Tax revenue (% of GDP)`, data = aca_2000)
summary(model3)
Call:
lm(formula = `Out-of-pocket expenditure per capita (current US$)` ~
Treat:relevel(as.factor(Year), ref = "2009") + relevel(as.factor(Year),
ref = "2009") + Treat + France + Germany + Japan + United_Kingdom +
United_States + Canada + `Adolescent fertility rate (births per 1,000 women ages 15-19)` +
`Current health expenditure per capita (current US$)` +
`Domestic general government health expenditure per capita (current US$)` +
`Domestic private health expenditure per capita (current US$)` +
`Fertility rate, total (births per woman)` + `GDP (current US$)` +
`Immunization, DPT (% of children ages 12-23 months)` +
`Immunization, measles (% of children ages 12-23 months)` +
`Life expectancy at birth, total (years)` + `Mortality from CVD, cancer, diabetes or CRD between exact ages 30 and 70 (%)` +
`Number of infant deaths` + `Number of maternal deaths` +
`Population, total` + `Tax revenue (% of GDP)`, data = aca_2000)
Residuals:
Min 1Q Median 3Q Max
-35.070 -6.449 0.000 4.107 28.458
Coefficients: (3 not defined because of singularities)
Estimate Std. Error
(Intercept) -4.934e+01 1.383e+03
relevel(as.factor(Year), ref = "2009")2000 -6.111e+01 6.818e+01
relevel(as.factor(Year), ref = "2009")2001 -6.761e+01 6.104e+01
relevel(as.factor(Year), ref = "2009")2002 -6.944e+01 5.761e+01
relevel(as.factor(Year), ref = "2009")2003 -6.110e+01 5.090e+01
relevel(as.factor(Year), ref = "2009")2004 -5.980e+01 3.867e+01
relevel(as.factor(Year), ref = "2009")2005 -5.658e+01 3.259e+01
relevel(as.factor(Year), ref = "2009")2006 -3.095e+01 2.377e+01
relevel(as.factor(Year), ref = "2009")2007 -3.087e+01 2.166e+01
relevel(as.factor(Year), ref = "2009")2008 -5.831e+00 1.753e+01
relevel(as.factor(Year), ref = "2009")2010 1.049e+01 1.464e+01
relevel(as.factor(Year), ref = "2009")2011 -1.605e+00 2.256e+01
relevel(as.factor(Year), ref = "2009")2012 -4.452e+00 2.239e+01
relevel(as.factor(Year), ref = "2009")2013 -2.022e+01 2.680e+01
relevel(as.factor(Year), ref = "2009")2014 -2.339e+01 3.292e+01
relevel(as.factor(Year), ref = "2009")2015 -2.148e+01 2.896e+01
relevel(as.factor(Year), ref = "2009")2016 -2.837e+00 3.299e+01
relevel(as.factor(Year), ref = "2009")2017 -7.226e+00 3.679e+01
relevel(as.factor(Year), ref = "2009")2018 -4.317e+00 3.982e+01
relevel(as.factor(Year), ref = "2009")2019 -5.457e+00 4.234e+01
Treat 1.413e+02 1.589e+03
France 4.100e+01 1.831e+02
Germany 1.488e+02 2.436e+02
Japan NA NA
United_Kingdom 2.522e+02 1.641e+02
United_States NA NA
Canada NA NA
`Adolescent fertility rate (births per 1,000 women ages 15-19)` -4.324e+00 3.986e+00
`Current health expenditure per capita (current US$)` 2.096e+02 1.250e+02
`Domestic general government health expenditure per capita (current US$)` -2.096e+02 1.250e+02
`Domestic private health expenditure per capita (current US$)` -2.093e+02 1.250e+02
`Fertility rate, total (births per woman)` -1.261e+02 7.473e+01
`GDP (current US$)` 4.106e-11 4.033e-11
`Immunization, DPT (% of children ages 12-23 months)` 3.437e+00 2.796e+00
`Immunization, measles (% of children ages 12-23 months)` 6.342e-01 2.616e+00
`Life expectancy at birth, total (years)` 4.698e+00 1.783e+01
`Mortality from CVD, cancer, diabetes or CRD between exact ages 30 and 70 (%)` -6.358e-01 1.480e+01
`Number of infant deaths` 9.281e-02 5.367e-02
`Number of maternal deaths` -2.173e+00 9.452e-01
`Population, total` -7.439e-06 4.661e-06
`Tax revenue (% of GDP)` -8.397e+00 6.977e+00
Treat:relevel(as.factor(Year), ref = "2009")2000 -2.042e+02 1.815e+02
Treat:relevel(as.factor(Year), ref = "2009")2001 -1.666e+02 1.595e+02
Treat:relevel(as.factor(Year), ref = "2009")2002 -1.435e+02 1.454e+02
Treat:relevel(as.factor(Year), ref = "2009")2003 -1.427e+02 1.291e+02
Treat:relevel(as.factor(Year), ref = "2009")2004 -1.734e+02 1.203e+02
Treat:relevel(as.factor(Year), ref = "2009")2005 -1.659e+02 1.099e+02
Treat:relevel(as.factor(Year), ref = "2009")2006 -1.959e+02 1.106e+02
Treat:relevel(as.factor(Year), ref = "2009")2007 -2.039e+02 1.157e+02
Treat:relevel(as.factor(Year), ref = "2009")2008 -1.310e+02 8.174e+01
Treat:relevel(as.factor(Year), ref = "2009")2010 -9.983e+01 7.641e+01
Treat:relevel(as.factor(Year), ref = "2009")2011 5.845e+01 9.867e+01
Treat:relevel(as.factor(Year), ref = "2009")2012 1.343e+02 1.233e+02
Treat:relevel(as.factor(Year), ref = "2009")2013 2.176e+02 1.463e+02
Treat:relevel(as.factor(Year), ref = "2009")2014 2.512e+02 1.682e+02
Treat:relevel(as.factor(Year), ref = "2009")2015 2.714e+02 1.842e+02
Treat:relevel(as.factor(Year), ref = "2009")2016 3.329e+02 2.136e+02
Treat:relevel(as.factor(Year), ref = "2009")2017 3.608e+02 2.444e+02
Treat:relevel(as.factor(Year), ref = "2009")2018 3.507e+02 2.666e+02
Treat:relevel(as.factor(Year), ref = "2009")2019 3.922e+02 2.959e+02
t value Pr(>|t|)
(Intercept) -0.036 0.9717
relevel(as.factor(Year), ref = "2009")2000 -0.896 0.3750
relevel(as.factor(Year), ref = "2009")2001 -1.108 0.2742
relevel(as.factor(Year), ref = "2009")2002 -1.205 0.2347
relevel(as.factor(Year), ref = "2009")2003 -1.200 0.2365
relevel(as.factor(Year), ref = "2009")2004 -1.547 0.1293
relevel(as.factor(Year), ref = "2009")2005 -1.736 0.0898 .
relevel(as.factor(Year), ref = "2009")2006 -1.302 0.1998
relevel(as.factor(Year), ref = "2009")2007 -1.426 0.1612
relevel(as.factor(Year), ref = "2009")2008 -0.333 0.7410
relevel(as.factor(Year), ref = "2009")2010 0.716 0.4778
relevel(as.factor(Year), ref = "2009")2011 -0.071 0.9436
relevel(as.factor(Year), ref = "2009")2012 -0.199 0.8433
relevel(as.factor(Year), ref = "2009")2013 -0.754 0.4547
relevel(as.factor(Year), ref = "2009")2014 -0.711 0.4811
relevel(as.factor(Year), ref = "2009")2015 -0.742 0.4623
relevel(as.factor(Year), ref = "2009")2016 -0.086 0.9319
relevel(as.factor(Year), ref = "2009")2017 -0.196 0.8452
relevel(as.factor(Year), ref = "2009")2018 -0.108 0.9142
relevel(as.factor(Year), ref = "2009")2019 -0.129 0.8981
Treat 0.089 0.9296
France 0.224 0.8238
Germany 0.611 0.5446
Japan NA NA
United_Kingdom 1.537 0.1316
United_States NA NA
Canada NA NA
`Adolescent fertility rate (births per 1,000 women ages 15-19)` -1.085 0.2841
`Current health expenditure per capita (current US$)` 1.677 0.1008
`Domestic general government health expenditure per capita (current US$)` -1.677 0.1009
`Domestic private health expenditure per capita (current US$)` -1.675 0.1012
`Fertility rate, total (births per woman)` -1.688 0.0987 .
`GDP (current US$)` 1.018 0.3143
`Immunization, DPT (% of children ages 12-23 months)` 1.229 0.2256
`Immunization, measles (% of children ages 12-23 months)` 0.242 0.8096
`Life expectancy at birth, total (years)` 0.264 0.7934
`Mortality from CVD, cancer, diabetes or CRD between exact ages 30 and 70 (%)` -0.043 0.9659
`Number of infant deaths` 1.729 0.0909 .
`Number of maternal deaths` -2.299 0.0264 *
`Population, total` -1.596 0.1179
`Tax revenue (% of GDP)` -1.204 0.2354
Treat:relevel(as.factor(Year), ref = "2009")2000 -1.125 0.2667
Treat:relevel(as.factor(Year), ref = "2009")2001 -1.044 0.3022
Treat:relevel(as.factor(Year), ref = "2009")2002 -0.987 0.3293
Treat:relevel(as.factor(Year), ref = "2009")2003 -1.105 0.2751
Treat:relevel(as.factor(Year), ref = "2009")2004 -1.441 0.1567
Treat:relevel(as.factor(Year), ref = "2009")2005 -1.510 0.1383
Treat:relevel(as.factor(Year), ref = "2009")2006 -1.770 0.0838 .
Treat:relevel(as.factor(Year), ref = "2009")2007 -1.762 0.0852 .
Treat:relevel(as.factor(Year), ref = "2009")2008 -1.603 0.1162
Treat:relevel(as.factor(Year), ref = "2009")2010 -1.306 0.1984
Treat:relevel(as.factor(Year), ref = "2009")2011 0.592 0.5567
Treat:relevel(as.factor(Year), ref = "2009")2012 1.089 0.2821
Treat:relevel(as.factor(Year), ref = "2009")2013 1.487 0.1442
Treat:relevel(as.factor(Year), ref = "2009")2014 1.494 0.1425
Treat:relevel(as.factor(Year), ref = "2009")2015 1.474 0.1478
Treat:relevel(as.factor(Year), ref = "2009")2016 1.558 0.1265
Treat:relevel(as.factor(Year), ref = "2009")2017 1.476 0.1471
Treat:relevel(as.factor(Year), ref = "2009")2018 1.316 0.1953
Treat:relevel(as.factor(Year), ref = "2009")2019 1.325 0.1921
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 17.53 on 43 degrees of freedom
(20 observations deleted due to missingness)
Multiple R-squared: 0.9976, Adjusted R-squared: 0.9946
F-statistic: 325.8 on 56 and 43 DF, p-value: < 2.2e-16
# Extract the coefficient estimates
coefficients <- coef(model3)
# Subset the last 20 coefficients
did_coefficients <- coefficients[(length(coefficients) - 18):length(coefficients)]
# Print the subset of coefficients
print(did_coefficients)
Treat:relevel(as.factor(Year), ref = "2009")2000 Treat:relevel(as.factor(Year), ref = "2009")2001
-204.19370 -166.59008
Treat:relevel(as.factor(Year), ref = "2009")2002 Treat:relevel(as.factor(Year), ref = "2009")2003
-143.45966 -142.71652
Treat:relevel(as.factor(Year), ref = "2009")2004 Treat:relevel(as.factor(Year), ref = "2009")2005
-173.43666 -165.93043
Treat:relevel(as.factor(Year), ref = "2009")2006 Treat:relevel(as.factor(Year), ref = "2009")2007
-195.85335 -203.88929
Treat:relevel(as.factor(Year), ref = "2009")2008 Treat:relevel(as.factor(Year), ref = "2009")2010
-131.03959 -99.82556
Treat:relevel(as.factor(Year), ref = "2009")2011 Treat:relevel(as.factor(Year), ref = "2009")2012
58.45323 134.25930
Treat:relevel(as.factor(Year), ref = "2009")2013 Treat:relevel(as.factor(Year), ref = "2009")2014
217.59018 251.18670
Treat:relevel(as.factor(Year), ref = "2009")2015 Treat:relevel(as.factor(Year), ref = "2009")2016
271.40074 332.87449
Treat:relevel(as.factor(Year), ref = "2009")2017 Treat:relevel(as.factor(Year), ref = "2009")2018
360.81375 350.74515
Treat:relevel(as.factor(Year), ref = "2009")2019
392.18809
years <- seq(2000, 2019)
years <- years[years != 2009]
# Exclude the year 2009 from the data frame
coefficients_df <- data.frame(years, did_coefficients)
# Print the data frame
print(coefficients_df)
# Plot the coefficients against the years
plot(coefficients_df)