Basic Set Up and install and load all necessary libraries
options(scipen=999, digits = 2)
library(ggplot2)
library(ggthemes)
library(ggfortify)
library(ggpubr)
library(corrplot)
library(tidyverse)
library(dplyr)
library(RColorBrewer)
library(haven)
library(lcsm)
library(car)
library(psych)
library(plm)
library(stargazer)
library(choroplethr)
library(choroplethrMaps)
library(tidycensus)
library(usdata)
Research Question 1: What are the dominant trajectories of philanthropic capacity observed over a 7-year time span?
Research Question 2: Is philanthropy subject to Matthew effect—Significant disparities exist in the philanthropic capacity between advantaged communities and disadvantaged communities over time?
Research Question 3: If variation in philanthropic capacity exists across communities, to what extent is this variation explained by community-level structural factors (e.g., differences in resources and demand for services based on organizational location), or factors related to the capacity of the local nonprofit sector?
Research Question 4: How do minority population, racial segregation, and ruralness moderate the philanthropic trajectory over time?
## index FIPS year GvrnmntGrntsAmt
## Min. : 126 Length:19059 Min. :2014 Min. : 0
## 1st Qu.: 4890 Class :character 1st Qu.:2015 1st Qu.: 0
## Median : 9655 Mode :character Median :2016 Median : 487606
## Mean : 9655 Mean :2016 Mean : 15594761
## 3rd Qu.:14420 3rd Qu.:2018 3rd Qu.: 4617548
## Max. :19184 Max. :2019 Max. :4873851024
##
## TtlCntrbtnsAmt TtlRvn_TtlRvnClmnAmt TtlPrgrmSrvcRvnAmt
## Min. : 0 Min. : -175569 Min. : -229109
## 1st Qu.: 122428 1st Qu.: 442733 1st Qu.: 90447
## Median : 1367988 Median : 3999608 Median : 1583555
## Mean : 31936229 Mean : 86045011 Mean : 48713719
## 3rd Qu.: 9221397 3rd Qu.: 24882562 3rd Qu.: 13246322
## Max. :7886687938 Max. :14182582618 Max. :8003958358
##
## TtlAssts_EOYAmt TtlLblts_EOYAmt TtlFnctnlExpnss_FndrsngAmt
## Min. : -88626 Min. : -21977 Min. : -120361
## 1st Qu.: 670936 1st Qu.: 33409 1st Qu.: 0
## Median : 5780763 Median : 1133968 Median : 10132
## Mean : 139070379 Mean : 63758853 Mean : 1200143
## 3rd Qu.: 36010289 3rd Qu.: 9561173 3rd Qu.: 207700
## Max. :21151470598 Max. :9531011011 Max. :385501706
##
## EIN_count_all EIN_count_HE EIN_count_HU county_giving
## Min. : 1 Min. : NA Min. : 1 Min. : 0
## 1st Qu.: 14 1st Qu.: NA 1st Qu.: 14 1st Qu.: 32276
## Median : 33 Median : NA Median : 33 Median : 518629
## Mean : 117 Mean :NaN Mean : 116 Mean : 16341469
## 3rd Qu.: 86 3rd Qu.: NA 3rd Qu.: 86 3rd Qu.: 3507468
## Max. :8853 Max. : NA Max. :8829 Max. :6677536401
## NA's :19059
## NAME state county unemployed_int
## Length:19059 Length:19059 Length:19059 Min. : 388
## Class :character Class :character Class :character 1st Qu.: 2611
## Mode :character Mode :character Mode :character Median : 4489
## Mean : 10101
## 3rd Qu.: 9890
## Max. :456214
## NA's :14422
## bachelor_degr_int total_popu_int gini_income_float white_alone
## Min. : 4455 Min. : 62385 Min. :0 Min. : 8544
## 1st Qu.: 17887 1st Qu.: 102144 1st Qu.:0 1st Qu.: 83615
## Median : 34266 Median : 164765 Median :0 Median : 138022
## Mean : 86222 Mean : 348591 Mean :0 Mean : 245741
## 3rd Qu.: 84169 3rd Qu.: 356495 3rd Qu.:0 3rd Qu.: 265422
## Max. :2512048 Max. :10170292 Max. :1 Max. :5313124
## NA's :14422 NA's :14422 NA's :14422 NA's :14422
## black_alone indian_alaska_alone asian_alone hawaiian_alone
## Min. : 0 Min. : 0 Min. : 0 Min. : 0
## 1st Qu.: 3499 1st Qu.: 246 1st Qu.: 1231 1st Qu.: 0
## Median : 11525 Median : 693 Median : 3314 Median : 61
## Mean : 45615 Mean : 2372 Mean : 22343 Mean : 710
## 3rd Qu.: 39502 3rd Qu.: 1887 3rd Qu.: 11816 3rd Qu.: 273
## Max. :1251913 Max. :93358 Max. :1500637 Max. :101448
## NA's :14422 NA's :14422 NA's :14422 NA's :14422
## other_race_alone two_more_race two_other_race two_more_other_race
## Min. : 0 Min. : 215 Min. : 0 Min. : 57
## 1st Qu.: 1023 1st Qu.: 2426 1st Qu.: 154 1st Qu.: 2147
## Median : 3033 Median : 4713 Median : 513 Median : 4179
## Mean : 19746 Mean : 12065 Mean : 1899 Mean : 10166
## 3rd Qu.: 9947 3rd Qu.: 11321 3rd Qu.: 1511 3rd Qu.: 9828
## Max. :2310179 Max. :436362 Max. :135124 Max. :301238
## NA's :14422 NA's :14422 NA's :14422 NA's :14422
## race_total race_hhi poverty_rate mh_income_usd
## Min. : 63580 Min. :0 Min. :0 Min. : 21658
## 1st Qu.: 104243 1st Qu.:0 1st Qu.:0 1st Qu.: 41798
## Median : 169615 Median :0 Median :0 Median : 48759
## Mean : 360656 Mean :0 Mean :0 Mean : 50746
## 3rd Qu.: 366141 3rd Qu.:0 3rd Qu.:0 3rd Qu.: 56741
## Max. :10543419 Max. :1 Max. :1 Max. :151806
## NA's :14422 NA's :14422 NA's :573 NA's :573
## GvrnmntGrntsAmt_log1p TtlCntrbtnsAmt_log1p TtlRvn_TtlRvnClmnAmt_log1p
## Min. : 0.0 Min. : 0.0 Min. : 0.0
## 1st Qu.: 0.0 1st Qu.:11.7 1st Qu.:13.0
## Median :13.1 Median :14.1 Median :15.2
## Mean :10.5 Mean :12.3 Mean :13.5
## 3rd Qu.:15.3 3rd Qu.:16.0 3rd Qu.:17.0
## Max. :22.3 Max. :22.8 Max. :23.4
## NA's :22
## TtlPrgrmSrvcRvnAmt_log1p TtlAssts_EOYAmt_log1p TtlLblts_EOYAmt_log1p
## Min. : 0.0 Min. : 0.0 Min. : 0.0
## 1st Qu.:11.4 1st Qu.:13.4 1st Qu.:10.4
## Median :14.3 Median :15.6 Median :13.9
## Mean :12.2 Mean :13.8 Mean :12.0
## 3rd Qu.:16.4 3rd Qu.:17.4 3rd Qu.:16.1
## Max. :22.8 Max. :23.8 Max. :23.0
## NA's :2 NA's :12 NA's :10
## TtlFnctnlExpnss_FndrsngAmt_log1p county_giving_log1p mh_income_usd_log1p
## Min. : 0.0 Min. : 0.0 Min. :10
## 1st Qu.: 0.0 1st Qu.:10.4 1st Qu.:11
## Median : 9.2 Median :13.2 Median :11
## Mean : 7.0 Mean :11.3 Mean :11
## 3rd Qu.:12.2 3rd Qu.:15.1 3rd Qu.:11
## Max. :19.8 Max. :22.6 Max. :12
## NA's :3 NA's :573
## unemployed_int_log1p bachelor_degr_int_log1p total_popu_int_log1p
## Min. : 6 Min. : 8 Min. :11
## 1st Qu.: 8 1st Qu.:10 1st Qu.:12
## Median : 8 Median :10 Median :12
## Mean : 9 Mean :11 Mean :12
## 3rd Qu.: 9 3rd Qu.:11 3rd Qu.:13
## Max. :13 Max. :15 Max. :16
## NA's :14422 NA's :14422 NA's :14422
## npo_per_capita_all npo_per_capita_HU npo_per_capita_HE
## Min. :0 Min. :0 Min. : NA
## 1st Qu.:0 1st Qu.:0 1st Qu.: NA
## Median :0 Median :0 Median : NA
## Mean :0 Mean :0 Mean :NaN
## 3rd Qu.:0 3rd Qu.:0 3rd Qu.: NA
## Max. :0 Max. :0 Max. : NA
## NA's :14422 NA's :14422 NA's :19059
## index FIPS year GvrnmntGrntsAmt
## Min. : 126 Length:19059 Min. :2014 Min. : 0
## 1st Qu.: 4890 Class :character 1st Qu.:2015 1st Qu.: 0
## Median : 9655 Mode :character Median :2016 Median : 487606
## Mean : 9655 Mean :2016 Mean : 15594761
## 3rd Qu.:14420 3rd Qu.:2018 3rd Qu.: 4617548
## Max. :19184 Max. :2019 Max. :4873851024
##
## TtlCntrbtnsAmt TtlRvn_TtlRvnClmnAmt TtlPrgrmSrvcRvnAmt
## Min. : 0 Min. : -175569 Min. : -229109
## 1st Qu.: 122428 1st Qu.: 442733 1st Qu.: 90447
## Median : 1367988 Median : 3999608 Median : 1583555
## Mean : 31936229 Mean : 86045011 Mean : 48713719
## 3rd Qu.: 9221397 3rd Qu.: 24882562 3rd Qu.: 13246322
## Max. :7886687938 Max. :14182582618 Max. :8003958358
##
## TtlAssts_EOYAmt TtlLblts_EOYAmt TtlFnctnlExpnss_FndrsngAmt
## Min. : -88626 Min. : -21977 Min. : -120361
## 1st Qu.: 670936 1st Qu.: 33409 1st Qu.: 0
## Median : 5780763 Median : 1133968 Median : 10132
## Mean : 139070379 Mean : 63758853 Mean : 1200143
## 3rd Qu.: 36010289 3rd Qu.: 9561173 3rd Qu.: 207700
## Max. :21151470598 Max. :9531011011 Max. :385501706
##
## EIN_count_all EIN_count_HE EIN_count_HU NAME
## Min. : 1 Min. : NA Min. : 1 Length:19059
## 1st Qu.: 14 1st Qu.: NA 1st Qu.: 14 Class :character
## Median : 33 Median : NA Median : 33 Mode :character
## Mean : 117 Mean :NaN Mean : 116
## 3rd Qu.: 86 3rd Qu.: NA 3rd Qu.: 86
## Max. :8853 Max. : NA Max. :8829
## NA's :19059
## state county unemployed_int bachelor_degr_int
## Length:19059 Length:19059 Min. : 0 Min. : 4
## Class :character Class :character 1st Qu.: 308 1st Qu.: 1275
## Mode :character Mode :character Median : 823 Median : 3355
## Mean : 3633 Mean : 22464
## 3rd Qu.: 2306 3rd Qu.: 10540
## Max. :564669 Max. :2396090
## NA's :230 NA's :230
## total_popu_int gini_income_float white_alone black_alone
## Min. : 228 Min. :0 Min. : 226 Min. : 0
## 1st Qu.: 11295 1st Qu.:0 1st Qu.: 9277 1st Qu.: 107
## Median : 26297 Median :0 Median : 22329 Median : 810
## Mean : 101519 Mean :0 Mean : 74477 Mean : 12539
## 3rd Qu.: 66972 3rd Qu.:0 3rd Qu.: 57375 3rd Qu.: 5466
## Max. :10105722 Max. :1 Max. :5346316 Max. :1264466
## NA's :230 NA's :230 NA's :230 NA's :230
## indian_alaska_alone asian_alone hawaiian_alone other_race_alone
## Min. : 0 Min. : 0 Min. : 0 Min. : 0
## 1st Qu.: 30 1st Qu.: 30 1st Qu.: 0 1st Qu.: 48
## Median : 112 Median : 132 Median : 3 Median : 241
## Mean : 809 Mean : 5329 Mean : 177 Mean : 5006
## 3rd Qu.: 417 3rd Qu.: 685 3rd Qu.: 33 3rd Qu.: 1129
## Max. :85876 Max. :1473221 Max. :93980 Max. :2121102
## NA's :230 NA's :230 NA's :230 NA's :230
## two_more_race two_other_race two_more_other_race race_total
## Min. : 0 Min. : 0 Min. : 0 Min. : 228
## 1st Qu.: 166 1st Qu.: 6 1st Qu.: 143 1st Qu.: 11597
## Median : 467 Median : 41 Median : 417 Median : 26847
## Mean : 3182 Mean : 498 Mean : 2685 Mean : 104702
## 3rd Qu.: 1666 3rd Qu.: 170 3rd Qu.: 1487 3rd Qu.: 68660
## Max. :402767 Max. :115953 Max. :286814 Max. :10495732
## NA's :230 NA's :230 NA's :230 NA's :230
## race_hhi poverty_rate mh_income_usd urban_rural
## Min. :0 Min. :0 Min. : 21658 Min. :1
## 1st Qu.:0 1st Qu.:0 1st Qu.: 41798 1st Qu.:2
## Median :0 Median :0 Median : 48759 Median :6
## Mean :0 Mean :0 Mean : 50746 Mean :5
## 3rd Qu.:0 3rd Qu.:0 3rd Qu.: 56741 3rd Qu.:7
## Max. :1 Max. :1 Max. :151806 Max. :9
## NA's :230 NA's :573 NA's :573 NA's :567
## county_giving npo_per1kcapita_all npo_per1kcapita_HU npo_per1kcapita_HE
## Min. : 0 Min. : 0 Min. : 0 Min. : NA
## 1st Qu.: 32276 1st Qu.: 1 1st Qu.: 1 1st Qu.: NA
## Median : 518629 Median : 1 Median : 1 Median : NA
## Mean : 16341469 Mean : 2 Mean : 2 Mean :NaN
## 3rd Qu.: 3507468 3rd Qu.: 2 3rd Qu.: 2 3rd Qu.: NA
## Max. :6677536401 Max. :14 Max. :14 Max. : NA
## NA's :230 NA's :230 NA's :19059
## county_giving_per1kcapital GvrnmntGrntsAmt_log1p TtlCntrbtnsAmt_log1p
## Min. : 0 Min. : 0.0 Min. : 0.0
## 1st Qu.: 2179 1st Qu.: 0.0 1st Qu.:11.7
## Median : 20329 Median :13.1 Median :14.1
## Mean : 61607 Mean :10.5 Mean :12.3
## 3rd Qu.: 60217 3rd Qu.:15.3 3rd Qu.:16.0
## Max. :10055065 Max. :22.3 Max. :22.8
## NA's :230
## TtlRvn_TtlRvnClmnAmt_log1p TtlPrgrmSrvcRvnAmt_log1p TtlAssts_EOYAmt_log1p
## Min. : 0.0 Min. : 0.0 Min. : 0.0
## 1st Qu.:13.0 1st Qu.:11.4 1st Qu.:13.4
## Median :15.2 Median :14.3 Median :15.6
## Mean :13.5 Mean :12.2 Mean :13.8
## 3rd Qu.:17.0 3rd Qu.:16.4 3rd Qu.:17.4
## Max. :23.4 Max. :22.8 Max. :23.8
## NA's :22 NA's :2 NA's :12
## TtlLblts_EOYAmt_log1p TtlFnctnlExpnss_FndrsngAmt_log1p EIN_count_all_log1p
## Min. : 0.0 Min. : 0.0 Min. :0.7
## 1st Qu.:10.4 1st Qu.: 0.0 1st Qu.:2.7
## Median :13.9 Median : 9.2 Median :3.5
## Mean :12.0 Mean : 7.0 Mean :3.7
## 3rd Qu.:16.1 3rd Qu.:12.2 3rd Qu.:4.5
## Max. :23.0 Max. :19.8 Max. :9.1
## NA's :10 NA's :3
## EIN_count_HE_log1p EIN_count_HU_log1p unemployed_int_log1p
## Min. : NA Min. :0.7 Min. : 0
## 1st Qu.: NA 1st Qu.:2.7 1st Qu.: 6
## Median : NA Median :3.5 Median : 7
## Mean :NaN Mean :3.7 Mean : 7
## 3rd Qu.: NA 3rd Qu.:4.5 3rd Qu.: 8
## Max. : NA Max. :9.1 Max. :13
## NA's :19059 NA's :230
## bachelor_degr_int_log1p total_popu_int_log1p gini_income_float_log1p
## Min. : 2 Min. : 5 Min. :0
## 1st Qu.: 7 1st Qu.: 9 1st Qu.:0
## Median : 8 Median :10 Median :0
## Mean : 8 Mean :10 Mean :0
## 3rd Qu.: 9 3rd Qu.:11 3rd Qu.:0
## Max. :15 Max. :16 Max. :1
## NA's :230 NA's :230 NA's :230
## white_alone_log1p black_alone_log1p indian_alaska_alone_log1p
## Min. : 5 Min. : 0 Min. : 0
## 1st Qu.: 9 1st Qu.: 5 1st Qu.: 3
## Median :10 Median : 7 Median : 5
## Mean :10 Mean : 7 Mean : 5
## 3rd Qu.:11 3rd Qu.: 9 3rd Qu.: 6
## Max. :15 Max. :14 Max. :11
## NA's :230 NA's :230 NA's :230
## asian_alone_log1p hawaiian_alone_log1p other_race_alone_log1p
## Min. : 0 Min. : 0 Min. : 0
## 1st Qu.: 3 1st Qu.: 0 1st Qu.: 4
## Median : 5 Median : 1 Median : 5
## Mean : 5 Mean : 2 Mean : 5
## 3rd Qu.: 7 3rd Qu.: 4 3rd Qu.: 7
## Max. :14 Max. :11 Max. :15
## NA's :230 NA's :230 NA's :230
## two_more_race_log1p two_other_race_log1p two_more_other_race_log1p
## Min. : 0 Min. : 0 Min. : 0
## 1st Qu.: 5 1st Qu.: 2 1st Qu.: 5
## Median : 6 Median : 4 Median : 6
## Mean : 6 Mean : 4 Mean : 6
## 3rd Qu.: 7 3rd Qu.: 5 3rd Qu.: 7
## Max. :13 Max. :12 Max. :13
## NA's :230 NA's :230 NA's :230
## race_total_log1p race_hhi_log1p poverty_rate_log1p mh_income_usd_log1p
## Min. : 5 Min. :0 Min. :0 Min. :10
## 1st Qu.: 9 1st Qu.:0 1st Qu.:0 1st Qu.:11
## Median :10 Median :0 Median :0 Median :11
## Mean :10 Mean :0 Mean :0 Mean :11
## 3rd Qu.:11 3rd Qu.:0 3rd Qu.:0 3rd Qu.:11
## Max. :16 Max. :1 Max. :0 Max. :12
## NA's :230 NA's :230 NA's :573 NA's :573
## urban_rural_log1p county_giving_log1p npo_per1kcapita_all_log1p
## Min. :1 Min. : 0.0 Min. :0
## 1st Qu.:1 1st Qu.:10.4 1st Qu.:1
## Median :2 Median :13.2 Median :1
## Mean :2 Mean :11.3 Mean :1
## 3rd Qu.:2 3rd Qu.:15.1 3rd Qu.:1
## Max. :2 Max. :22.6 Max. :3
## NA's :567 NA's :230
## npo_per1kcapita_HU_log1p npo_per1kcapita_HE_log1p
## Min. :0 Min. : NA
## 1st Qu.:1 1st Qu.: NA
## Median :1 Median : NA
## Mean :1 Mean :NaN
## 3rd Qu.:1 3rd Qu.: NA
## Max. :3 Max. : NA
## NA's :230 NA's :19059
## county_giving_per1kcapital_log1p
## Min. : 0
## 1st Qu.: 8
## Median :10
## Mean : 8
## 3rd Qu.:11
## Max. :16
## NA's :230
# create pct variables for unemployed, bachelor, nonwhite
summary(hs_5yr$unemployed_pct <- hs_5yr$unemployed_int/hs_5yr$total_popu_int*100)
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0 2 3 3 4 14 230
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 1 11 14 15 18 62 230
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0 5 10 17 23 92 230
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 18829 3.1 1.5 3 3 1.3 0 14 14 1.3 4.2 0.01
hs_5yr$unemployed_pct1 <- ifelse(hs_5yr$unemployed_pct <= 1, 1, hs_5yr$unemployed_pct)
hs_5yr$unemployed_pct_log1p <- log(hs_5yr$unemployed_pct1)
hist(hs_5yr$unemployed_pct_log1p)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 18829 15 6.7 14 14 5.4 0.7 62 62 1.5 3.4 0.05
hs_5yr$bachelor_pct1 <- ifelse(hs_5yr$bachelor_pct <= 1, 1, hs_5yr$bachelor_pct)
hs_5yr$bachelor_pct_log1p <- log(hs_5yr$bachelor_pct1)
hist(hs_5yr$bachelor_pct_log1p)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 18829 17 16 10 14 9.9 0 92 92 1.7 2.6 0.12
hs_5yr$nonwhite_pct1 <- ifelse(hs_5yr$nonwhite_pct <= 1, 1, hs_5yr$nonwhite_pct)
hs_5yr$nonwhite_pct_log1p <- log(hs_5yr$nonwhite_pct1)
hist(hs_5yr$nonwhite_pct_log1p)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 18829 0.27 0.17 0.23 0.26 0.19 0 0.8 0.8 0.57 -0.81 0
hs_5yr$race_hhi1 <- ifelse(hs_5yr$race_hhi <= 0.1, 0.1, hs_5yr$race_hhi)
hs_5yr$race_hhi_log1p <- log(hs_5yr$race_hhi1)
hist(hs_5yr$race_hhi_log1p)
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 18829 0.45 0.04 0.44 0.44 0.03 0.32 0.71 0.39 0.56 1.2 0
## vars n mean sd median trimmed mad min max range skew kurtosis se
## X1 1 18486 0.16 0.06 0.15 0.15 0.06 0.03 0.57 0.54 1.1 2 0
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## -4 -2 -2 -2 -2 -1 573
urbanity <- read.csv("Rural.Urban2013.csv")
urbanity$urban <- ifelse(urbanity$urban_rural <=3, 1, 0)
urbanity$urban <- factor(urbanity$urban,
levels = c(0,1),
labels = c("Rural", "Urban"))
hs_5yr$FIPS <- as.numeric(hs_5yr$FIPS)
hs_1yr <- merge(hs_1yr, urbanity[c("FIPS", "urban")], by = "FIPS", all.x = TRUE)
hs_5yr <- merge(hs_5yr, urbanity[c("FIPS", "urban","State")], by = "FIPS", all.x = TRUE)
table(hs_5yr$urban, hs_5yr$year)
##
## 2014 2015 2016 2017 2018 2019
## Rural 1950 1950 1950 1947 1948 1945
## Urban 1134 1133 1134 1134 1134 1133
##
## 2014 2015 2016 2017 2018 2019
## 3179 3177 3180 3178 3173 3172
##
## 2014 2015 2016 2017 2018 2019
## 3179 3177 3180 3178 3173 3172
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 0 32276 518629 16341469 3507468 6677536401
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0 2179 20329 61607 60217 10055065 230
## [1] "Alabama" "Alaska"
## [3] "Arizona" "Arkansas"
## [5] "California" "Colorado"
## [7] "Connecticut" "Delaware"
## [9] "District of Columbia" "Florida"
## [11] "Georgia" "Hawaii"
## [13] "Idaho" "Illinois"
## [15] "Indiana" "Iowa"
## [17] "Kansas" "Kentucky"
## [19] "Louisiana" "Maine"
## [21] "Maryland" "Massachusetts"
## [23] "Michigan" "Minnesota"
## [25] "Mississippi" "Missouri"
## [27] "Montana" "Nebraska"
## [29] "Nevada" "New Hampshire"
## [31] "New Jersey" "New Mexico"
## [33] "New York" "North Carolina"
## [35] "North Dakota" "Ohio"
## [37] "Oklahoma" "Oregon"
## [39] "Pennsylvania" "Rhode Island"
## [41] "South Carolina" "South Dakota"
## [43] "Tennessee" "Texas"
## [45] "Utah" "Vermont"
## [47] "Virginia" "Washington"
## [49] "West Virginia" "Wisconsin"
## [51] "Wyoming" "American Samoa"
## [53] "Guam" "Northern Mariana Islands"
## [55] "Puerto Rico" "U.S. Minor Outlying Islands"
## [57] "U.S. Virgin Islands"
fips_codes1 <- fips_codes[!duplicated(fips_codes$state_name),]
hs_5yr$state_code <- hs_5yr$state
hs_5yr <- merge(hs_5yr, fips_codes1[c("state_code","state_name")], by = "state_code", all.x = TRUE)
sum <- hs_5yr %>%
group_by(year, state_name) %>%
summarise(state_giving = sum(county_giving))
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
sum_per1000 <- hs_5yr %>%
group_by(year, state_name) %>%
summarise(state_giving = sum(county_giving_per1kcapital))
## `summarise()` has grouped output by 'year'. You can override using the
## `.groups` argument.
# aggregate data by state
hs_5yr_2014 <- subset(hs_5yr, hs_5yr$year=="2014") # 3179 obs
hs_5yr_2019 <- subset(hs_5yr, hs_5yr$year=="2019") # 3172 obs
hs_5yr_2014$region <- tolower(hs_5yr_2014$state_name)
unique(unlist(hs_5yr_2014$region))
## [1] NA "alabama" "alaska"
## [4] "arizona" "arkansas" "california"
## [7] "colorado" "connecticut" "delaware"
## [10] "district of columbia" "florida" "georgia"
## [13] "hawaii" "idaho" "illinois"
## [16] "indiana" "iowa" "kansas"
## [19] "kentucky" "louisiana" "maine"
## [22] "maryland" "massachusetts" "michigan"
## [25] "minnesota" "mississippi" "missouri"
## [28] "montana" "nebraska" "nevada"
## [31] "new hampshire" "new jersey" "new mexico"
## [34] "new york" "north carolina" "north dakota"
## [37] "ohio" "oklahoma" "oregon"
## [40] "pennsylvania" "rhode island" "south carolina"
## [43] "south dakota" "tennessee" "texas"
## [46] "utah" "vermont" "virginia"
## [49] "washington" "west virginia" "wisconsin"
## [52] "wyoming" "puerto rico"
## [1] NA "alabama" "alaska"
## [4] "arizona" "arkansas" "california"
## [7] "colorado" "connecticut" "delaware"
## [10] "district of columbia" "florida" "georgia"
## [13] "hawaii" "idaho" "illinois"
## [16] "indiana" "iowa" "kansas"
## [19] "kentucky" "louisiana" "maine"
## [22] "maryland" "massachusetts" "michigan"
## [25] "minnesota" "mississippi" "missouri"
## [28] "montana" "nebraska" "nevada"
## [31] "new hampshire" "new jersey" "new mexico"
## [34] "new york" "north carolina" "north dakota"
## [37] "ohio" "oklahoma" "oregon"
## [40] "pennsylvania" "rhode island" "south carolina"
## [43] "south dakota" "tennessee" "texas"
## [46] "utah" "vermont" "virginia"
## [49] "washington" "west virginia" "wisconsin"
## [52] "wyoming" "puerto rico"
map_2014 <- hs_5yr_2014 %>%
select(county_giving_per1kcapital, region) %>%
group_by(region) %>%
summarise(value = sum(county_giving_per1kcapital)/1000000)
# create the map
state_choropleth(map_2014,
num_colors=9) +
scale_fill_brewer(palette="YlOrBr") +
labs(title = "Total State Giving per 1,000 population",
subtitle = "Year: 2014",
fill = "Dollors in million")
## Warning in super$initialize(map.df, user.df): Your data.frame contains the
## following regions which are not mappable: puerto rico, NA
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
ggsave("map_2014.jpg", width = 7, height = 7)
# 2019
map_2019 <- hs_5yr_2019 %>%
select(county_giving_per1kcapital, region) %>%
group_by(region) %>%
summarise(value = sum(county_giving_per1kcapital)/1000000)
# create the map
state_choropleth(map_2019,
num_colors=9) +
scale_fill_brewer(palette="BuPu") +
labs(title = "Total State Giving per 1,000 population",
subtitle = "Year: 2019",
fill = "Dollors in million")
## Warning in super$initialize(map.df, user.df): Your data.frame contains the
## following regions which are not mappable: puerto rico, NA
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
# Scatterplot by year
hs_year <- hs_5yr[!is.na(hs_5yr$county_giving_per1kcapital),] %>%
select(year, county_giving_per1kcapital, FIPS) %>%
group_by(year) %>%
summarise(year_giving = sum(county_giving_per1kcapital)/1000000)
plot <- ggplot(hs_year, aes(x=year, y=year_giving)) + geom_point() +
stat_smooth(method="lm", se=TRUE,colour="darkred", size=0.5) +
labs(title = "Total County Giving by Year, 2014-2019",
x = "Year", y = "Total County Giving (in million)") +
theme_pubclean(base_size = 10, base_family = "sans")
plot
## `geom_smooth()` using formula 'y ~ x'
## `geom_smooth()` using formula 'y ~ x'
# Boxplot of County Giving by Year
boxplot_year <- ggboxplot(hs_5yr, x = "year", y = "county_giving_per1kcapital",
color = "year",
ylab = "County Giving", xlab = "Year")
boxplot_year
## Warning: Removed 230 rows containing non-finite values (stat_boxplot).
boxplot_urban <- ggboxplot(hs_5yr, x = "urban", y = "county_giving_per1kcapital",
color = "year",
ylab = "County Giving", xlab = "Urbanity")
boxplot_urban
## Warning: Removed 230 rows containing non-finite values (stat_boxplot).
hs_small <- hs_5yr %>%
select(year, county_giving, FIPS, urban) %>%
group_by(year, FIPS)
hs_small <- subset(hs_small, !is.na(hs_small$urban))
p <- ggplot(data = hs_small, aes(x = year, y = county_giving, group = FIPS, color = year)) + geom_line()
p + geom_line() + facet_grid(. ~ urban) +
theme_minimal()
hs_year_urban <- hs_5yr[!is.na(hs_5yr$county_giving_per1kcapital),] %>%
select(year, county_giving_per1kcapital, urban) %>%
group_by(urban, year) %>%
summarise(year_giving = sum(county_giving_per1kcapital)/1000000)
hs_year_urban <- subset(hs_year_urban, !is.na(hs_year_urban$urban))
p1 <- ggplot(data = hs_year_urban, aes(x = year, y = year_giving, group = urban, color = urban)) +
geom_line() +
labs(title = "Total County Giving by Year and Urbanity, 2014-2019",
x = "Year", y = "Total County Giving (in million)") +
theme_pubclean(base_size = 10, base_family = "sans")
p1 + geom_line() + coord_cartesian(ylim = c(70,120)) +
geom_text(aes(label= as.character(round(year_giving),2)),hjust=0,vjust=-1)
We notice a consistent postive relationship between race hhi and county giving across the years.
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0 0 0 0 0 1 14422
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0 0 0 0 0 1 230
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0 0 0 0 0 1 230
plot_race <- ggplot(hs_5yr, aes(x=race_hhi, y= (county_giving_per1kcapital)/1000000, color = race_hhi)) + geom_point() +
stat_smooth(span = 0.5, colour = "black", method="lm", se=FALSE) +
theme_pubclean() + theme(legend.position = "none") +
labs(title = "Total County Giving and Race HHI",
x = "Race HHI", y = "Total County Giving (in million)")
plot_race
ggsave("plot_race.jpg", width = 7, height = 5)
plot_nonwhite <- ggplot(hs_5yr, aes(x=nonwhite_pct, y= (county_giving_per1kcapital)/1000000, color = nonwhite_pct)) + geom_point() +
stat_smooth(span = 0.5, colour = "black", method="lm", se=FALSE) + theme_pubclean()
plot_nonwhite
ggsave("plot_nonwhite.jpg", width = 7, height = 5)
# by year and race measures
plot_race_yr <- ggplot(hs_5yr, aes(x=race_hhi, y= (county_giving_per1kcapital)/1000000, color = year)) + geom_point() +
stat_smooth(span = 0.5, colour = "black", method="lm", se=FALSE) +
labs(title = "Total County Giving by Year and Race HHI, 2014-2019",
x = "Year", y = "Total County Giving (in million)") +
theme_pubclean(base_size = 10, base_family = "sans") + theme(legend.position = "none") + facet_grid(. ~ year)
plot_race_yr
## Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
## 0 5 10 17 23 92 230
plot_nonwhite_yr <- ggplot(hs_5yr, aes(x=nonwhite_pct, y= (county_giving_per1kcapital)/1000000, color = year)) + geom_point() +
stat_smooth(span = 0.5, colour = "black", method="lm", se=FALSE) + theme_minimal() + facet_grid(. ~ year)
plot_nonwhite_yr
Statistic | N | Mean | St. Dev. | Min | Pctl(25) | Median | Pctl(75) | Max |
county_giving | 19,059 | 16,341,469.000 | 114,601,455.000 | 0 | 32,276.0 | 518,629 | 3,507,468 | 6,677,536,401 |
GvrnmntGrntsAmt | 19,059 | 15,594,761.000 | 103,874,096.000 | 0 | 0 | 487,606 | 4,617,548 | 4,873,851,024 |
TtlPrgrmSrvcRvnAmt | 19,059 | 48,713,719.000 | 257,488,899.000 | -229,109 | 90,447 | 1,583,555 | 13,246,322 | 8,003,958,358 |
TtlFnctnlExpnss_FndrsngAmt | 19,059 | 1,200,143.000 | 8,762,056.000 | -120,361 | 0 | 10,132 | 207,700.0 | 385,501,706 |
TtlAssts_EOYAmt | 19,059 | 139,070,379.000 | 741,085,420.000 | -88,626 | 670,936.0 | 5,780,763 | 36,010,289 | 21,151,470,598 |
npo_per1kcapita_all | 18,829 | 1.500 | 1.100 | 0.012 | 0.850 | 1.300 | 1.900 | 14.000 |
mh_income_usd | 18,486 | 50,746.000 | 13,393.000 | 21,658 | 41,798 | 48,759 | 56,741.0 | 151,806 |
poverty_rate | 18,486 | 0.160 | 0.062 | 0.026 | 0.110 | 0.150 | 0.190 | 0.570 |
gini_income_float | 18,829 | 0.440 | 0.036 | 0.320 | 0.420 | 0.440 | 0.470 | 0.710 |
unemployed_pct | 18,829 | 3.100 | 1.500 | 0.000 | 2.200 | 3.000 | 3.900 | 14.000 |
bachelor_pct | 18,829 | 15.000 | 6.700 | 0.700 | 11.000 | 14.000 | 18.000 | 62.000 |
race_hhi | 18,829 | 0.270 | 0.170 | 0.000 | 0.120 | 0.230 | 0.410 | 0.800 |
nonwhite_pct | 18,829 | 17.000 | 16.000 | 0.000 | 4.700 | 10.000 | 23.000 | 92.000 |
total_popu_int | 18,829 | 101,519.000 | 326,155.000 | 228 | 11,295 | 26,297 | 66,972 | 10,105,722 |
Statistic | N | Mean | St. Dev. | Min | Median | Max |
county_giving | 6,802 | 42,447,403.000 | 188,368,817.000 | 0 | 4,157,605 | 6,677,536,401 |
GvrnmntGrntsAmt | 6,802 | 39,497,712.000 | 170,768,223.000 | 0 | 4,259,406.0 | 4,873,851,024 |
TtlPrgrmSrvcRvnAmt | 6,802 | 125,850,624.000 | 418,923,097.000 | 0 | 14,388,168 | 8,003,958,358 |
TtlFnctnlExpnss_FndrsngAmt | 6,802 | 3,099,808.000 | 14,367,947.000 | -120,361 | 247,300.0 | 385,501,706 |
TtlAssts_EOYAmt | 6,802 | 359,973,778.000 | 1,206,203,684.000 | -86,345 | 41,721,525 | 21,151,470,598 |
npo_per1kcapita_all | 6,801 | 1.200 | 0.560 | 0.059 | 1.100 | 6.300 |
mh_income_usd | 6,801 | 58,180.000 | 15,313.000 | 30,241 | 55,299 | 151,806 |
poverty_rate | 6,801 | 0.140 | 0.052 | 0.026 | 0.130 | 0.400 |
gini_income_float | 6,801 | 0.440 | 0.034 | 0.340 | 0.440 | 0.600 |
unemployed_pct | 6,801 | 3.300 | 1.200 | 0.460 | 3.100 | 8.300 |
bachelor_pct | 6,801 | 19.000 | 7.700 | 4.700 | 17.000 | 62.000 |
race_hhi | 6,801 | 0.320 | 0.170 | 0.011 | 0.300 | 0.790 |
nonwhite_pct | 6,801 | 19.000 | 15.000 | 0.410 | 14.000 | 87.000 |
total_popu_int | 6,801 | 237,900.000 | 514,185.000 | 724 | 98,320 | 10,105,722 |
Statistic | N | Mean | St. Dev. | Min | Median | Max |
county_giving | 11,690 | 1,373,573.000 | 6,518,508.000 | 0 | 207,290 | 305,191,328 |
GvrnmntGrntsAmt | 11,690 | 2,053,912.000 | 6,666,152.000 | 0 | 189,451.0 | 180,333,472 |
TtlPrgrmSrvcRvnAmt | 11,690 | 5,015,779.000 | 13,208,750.000 | -229,109 | 613,341 | 279,006,315 |
TtlFnctnlExpnss_FndrsngAmt | 11,690 | 108,299.000 | 1,056,994.000 | -5,776 | 0 | 51,195,479 |
TtlAssts_EOYAmt | 11,690 | 13,629,055.000 | 33,373,585.000 | -88,626 | 2,661,670.0 | 683,460,399 |
npo_per1kcapita_all | 11,683 | 1.800 | 1.200 | 0.070 | 1.500 | 14.000 |
mh_income_usd | 11,685 | 46,419.000 | 9,818.000 | 21,658 | 45,718 | 124,947 |
poverty_rate | 11,685 | 0.170 | 0.065 | 0.035 | 0.150 | 0.570 |
gini_income_float | 11,683 | 0.440 | 0.036 | 0.320 | 0.440 | 0.710 |
unemployed_pct | 11,683 | 3.000 | 1.500 | 0.000 | 2.800 | 14.000 |
bachelor_pct | 11,683 | 13.000 | 5.300 | 0.700 | 13.000 | 53.000 |
race_hhi | 11,683 | 0.240 | 0.160 | 0.000 | 0.180 | 0.800 |
nonwhite_pct | 11,683 | 15.000 | 17.000 | 0.000 | 7.500 | 92.000 |
total_popu_int | 11,683 | 23,572.000 | 22,103.000 | 228 | 16,723 | 199,459 |
county_giving | GvrnmntGrntsAmt | TtlAssts_EOYAmt | TtlPrgrmSrvcRvnAmt | TtlFnctnlExpnss_FndrsngAmt | race_hhi | poverty_rate | mh_income_usd | unemployed_pct | bachelor_pct | nonwhite_pct | total_popu_int | |
county_giving | 1 | 0.690 | 0.860 | 0.830 | 0.860 | 0.190 | -0.039 | 0.170 | 0.058 | 0.260 | 0.150 | 0.640 |
GvrnmntGrntsAmt | 0.690 | 1 | 0.810 | 0.740 | 0.700 | 0.200 | -0.030 | 0.160 | 0.071 | 0.240 | 0.150 | 0.790 |
TtlAssts_EOYAmt | 0.860 | 0.810 | 1 | 0.950 | 0.900 | 0.230 | -0.072 | 0.240 | 0.062 | 0.350 | 0.170 | 0.710 |
TtlPrgrmSrvcRvnAmt | 0.830 | 0.740 | 0.950 | 1 | 0.890 | 0.220 | -0.075 | 0.240 | 0.066 | 0.350 | 0.160 | 0.660 |
TtlFnctnlExpnss_FndrsngAmt | 0.860 | 0.700 | 0.900 | 0.890 | 1 | 0.190 | -0.038 | 0.180 | 0.058 | 0.280 | 0.150 | 0.540 |
race_hhi | 0.190 | 0.200 | 0.230 | 0.220 | 0.190 | 1 | 0.340 | -0.014 | 0.350 | 0.056 | 0.870 | 0.290 |
poverty_rate | -0.039 | -0.030 | -0.072 | -0.075 | -0.038 | 0.340 | 1 | -0.780 | 0.480 | -0.520 | 0.500 | -0.088 |
mh_income_usd | 0.170 | 0.160 | 0.240 | 0.240 | 0.180 | -0.014 | -0.780 | 1 | -0.320 | 0.700 | -0.150 | 0.260 |
unemployed_pct | 0.058 | 0.071 | 0.062 | 0.066 | 0.058 | 0.350 | 0.480 | -0.320 | 1 | -0.180 | 0.420 | 0.110 |
bachelor_pct | 0.260 | 0.240 | 0.350 | 0.350 | 0.280 | 0.056 | -0.520 | 0.700 | -0.180 | 1 | -0.059 | 0.320 |
nonwhite_pct | 0.150 | 0.150 | 0.170 | 0.160 | 0.150 | 0.870 | 0.500 | -0.150 | 0.420 | -0.059 | 1 | 0.200 |
total_popu_int | 0.640 | 0.790 | 0.710 | 0.660 | 0.540 | 0.290 | -0.088 | 0.260 | 0.110 | 0.320 | 0.200 | 1 |
## The following object is masked from package:usdata:
##
## county
lm1 <- lm(county_giving_per1kcapital_log1p ~ GvrnmntGrntsAmt_log1p + TtlPrgrmSrvcRvnAmt_log1p +
TtlFnctnlExpnss_FndrsngAmt_log1p +
TtlAssts_EOYAmt_log1p + npo_per1kcapita_all +
mh_income_usd_log1p + poverty_log + gini_log +
unemployed_pct_log1p + bachelor_pct_log1p +
race_hhi_log1p +
total_popu_int_log1p + factor(year), data = hs_5yr)
summary(lm1)
## GVIF Df GVIF^(1/(2*Df))
## GvrnmntGrntsAmt_log1p 3.1 1 1.8
## TtlPrgrmSrvcRvnAmt_log1p 6.0 1 2.4
## TtlFnctnlExpnss_FndrsngAmt_log1p 3.1 1 1.8
## TtlAssts_EOYAmt_log1p 6.3 1 2.5
## npo_per1kcapita_all 1.8 1 1.3
## mh_income_usd_log1p 8.4 1 2.9
## poverty_log 8.9 1 3.0
## gini_log 1.7 1 1.3
## unemployed_pct_log1p 1.9 1 1.4
## bachelor_pct_log1p 2.8 1 1.7
## race_hhi_log1p 1.7 1 1.3
## total_popu_int_log1p 4.7 1 2.2
## factor(year) 1.3 5 1.0
# using ggplot and ggfortify for residual plots
autoplot(lm1, which = 1:6, ncol = 3, label.size = 3)
Further reading on state vs. county fixed effects: https://www.statalist.org/forums/forum/general-stata-discussion/general/1564591-panel-data-county-level-data-but-state-level-intercept
# can only do FIPS county level fixed effects
is.pbalanced(hs_5yr) # FALSE since same state for multiple FIPS
## Warning in pdata.frame(x, index): duplicate couples (id-time) in resulting pdata.frame
## to find out which, use, e.g., table(index(your_pdataframe), useNA = "ifany")
hs_5yr$year <- factor(hs_5yr$year)
lm2 <- plm(county_giving_per1kcapital_log1p ~ GvrnmntGrntsAmt_log1p + TtlPrgrmSrvcRvnAmt_log1p +
TtlFnctnlExpnss_FndrsngAmt_log1p +
TtlAssts_EOYAmt_log1p + npo_per1kcapita_all+
mh_income_usd_log1p + poverty_log + gini_log +
unemployed_pct_log1p + bachelor_pct_log1p + race_hhi_log1p +
total_popu_int_log1p,
index = c("FIPS","year"),
model = "within",
effect = "twoways",
data = hs_5yr)
summary(lm2)
lm2_urban <- plm(county_giving_per1kcapital_log1p ~ GvrnmntGrntsAmt_log1p + TtlPrgrmSrvcRvnAmt_log1p +
TtlFnctnlExpnss_FndrsngAmt_log1p +
TtlAssts_EOYAmt_log1p + npo_per1kcapita_all+
mh_income_usd_log1p + poverty_log + gini_log +
unemployed_pct_log1p + bachelor_pct_log1p + race_hhi_log1p +
total_popu_int_log1p,
index = c("FIPS","year"),
model = "within",
effect = "twoways",
data = hs_5yr_urban)
summary(lm2_urban)
lm2_rural <- plm(county_giving_per1kcapital_log1p ~ GvrnmntGrntsAmt_log1p + TtlPrgrmSrvcRvnAmt_log1p +
TtlFnctnlExpnss_FndrsngAmt_log1p +
TtlAssts_EOYAmt_log1p + npo_per1kcapita_all+
mh_income_usd_log1p + poverty_log + gini_log +
unemployed_pct_log1p + bachelor_pct_log1p + race_hhi_log1p +
total_popu_int_log1p,
index = c("FIPS","year"),
model = "within",
effect = "twoways",
data = hs_5yr_rural)
summary(lm2_rural)
lm3 <- plm(county_giving_per1kcapital_log1p ~ GvrnmntGrntsAmt_log1p + TtlPrgrmSrvcRvnAmt_log1p +
TtlFnctnlExpnss_FndrsngAmt_log1p +
TtlAssts_EOYAmt_log1p + npo_per1kcapita_all+
mh_income_usd_log1p + poverty_log + gini_log +
unemployed_pct_log1p + bachelor_pct_log1p + nonwhite_pct_log1p +
total_popu_int_log1p,
index = c("FIPS","year"),
model = "within",
effect = "twoways",
data = hs_5yr)
summary(lm3)
lm3_urban <- plm(county_giving_per1kcapital_log1p ~ GvrnmntGrntsAmt_log1p + TtlPrgrmSrvcRvnAmt_log1p +
TtlFnctnlExpnss_FndrsngAmt_log1p +
TtlAssts_EOYAmt_log1p + npo_per1kcapita_all+
mh_income_usd_log1p + poverty_log + gini_log +
unemployed_pct_log1p + bachelor_pct_log1p + nonwhite_pct_log1p +
total_popu_int_log1p,
index = c("FIPS","year"),
model = "within",
effect = "twoways",
data = hs_5yr_urban)
summary(lm3_urban)
lm3_rural <- plm(county_giving_per1kcapital_log1p ~ GvrnmntGrntsAmt_log1p + TtlPrgrmSrvcRvnAmt_log1p +
TtlFnctnlExpnss_FndrsngAmt_log1p +
TtlAssts_EOYAmt_log1p + npo_per1kcapita_all+
mh_income_usd_log1p + poverty_log + gini_log +
unemployed_pct_log1p + bachelor_pct_log1p + nonwhite_pct_log1p +
total_popu_int_log1p,
index = c("FIPS","year"),
model = "within",
effect = "twoways",
data = hs_5yr_rural)
summary(lm3_rural)
# the set of observations on all variables for 2014 and 2019 for the last model
hs_5yr_2014_2019 <- hs_5yr[with(hs_5yr, year == 2014 | year == 2019), ]
lm4 <- plm(county_giving_per1kcapital_log1p ~ GvrnmntGrntsAmt_log1p + TtlPrgrmSrvcRvnAmt_log1p +
TtlFnctnlExpnss_FndrsngAmt_log1p +
TtlAssts_EOYAmt_log1p + npo_per1kcapita_all+
mh_income_usd_log1p + poverty_log + gini_log +
unemployed_pct_log1p + bachelor_pct_log1p + race_hhi_log1p +
total_popu_int_log1p,
index = c("FIPS","year"),
model = "within",
effect = "twoways",
data = hs_5yr_2014_2019)
summary(lm4)
lm4_nonwhite <- plm(county_giving_per1kcapital_log1p ~ GvrnmntGrntsAmt_log1p + TtlPrgrmSrvcRvnAmt_log1p +
TtlFnctnlExpnss_FndrsngAmt_log1p +
TtlAssts_EOYAmt_log1p + npo_per1kcapita_all+
mh_income_usd_log1p + poverty_log + gini_log +
unemployed_pct_log1p + bachelor_pct_log1p + nonwhite_pct_log1p +
total_popu_int_log1p,
index = c("FIPS","year"),
model = "within",
effect = "twoways",
data = hs_5yr_2014_2019)
summary(lm4_nonwhite)
Dependent Variable: County Giving | |||||||||
county_giving_per1kcapital_log1p | |||||||||
OLS | panel | ||||||||
linear | |||||||||
OLS HS | Panel HS | Urban | Rural | NonWhite | NWUrban | NWRural | 2014&2019 | NW 2014&2019 | |
(1) | (2) | (3) | (4) | (5) | (6) | (7) | (8) | (9) | |
GvrnmntGrntsAmt_log1p | 0.034*** | 0.024* | 0.008 | 0.027* | 0.024* | 0.008 | 0.026* | 0.044** | 0.044** |
(0.006) | (0.012) | (0.023) | (0.013) | (0.012) | (0.023) | (0.013) | (0.017) | (0.017) | |
TtlPrgrmSrvcRvnAmt_log1p | -0.074*** | -0.023 | -0.027 | -0.023 | -0.023 | -0.027 | -0.023 | -0.023 | -0.023 |
(0.009) | (0.018) | (0.034) | (0.021) | (0.018) | (0.034) | (0.021) | (0.025) | (0.025) | |
TtlFnctnlExpnss_FndrsngAmt_log1p | 0.170*** | 0.110*** | 0.120*** | 0.110*** | 0.110*** | 0.120*** | 0.110*** | 0.130*** | 0.130*** |
(0.005) | (0.009) | (0.018) | (0.011) | (0.009) | (0.018) | (0.011) | (0.013) | (0.013) | |
TtlAssts_EOYAmt_log1p | 0.590*** | 0.500*** | 0.470*** | 0.500*** | 0.500*** | 0.470*** | 0.500*** | 0.470*** | 0.470*** |
(0.009) | (0.022) | (0.046) | (0.025) | (0.022) | (0.046) | (0.025) | (0.029) | (0.029) | |
npo_per1kcapita_all | 0.150*** | 0.180** | 0.150 | 0.190** | 0.180** | 0.140 | 0.180** | 0.270** | 0.260** |
(0.020) | (0.059) | (0.180) | (0.062) | (0.059) | (0.180) | (0.062) | (0.096) | (0.094) | |
mh_income_usd_log1p | -0.310 | 0.140 | 0.930* | -0.190 | 0.150 | 0.950* | -0.180 | 0.920 | 1.000 |
(0.200) | (0.290) | (0.370) | (0.380) | (0.290) | (0.370) | (0.380) | (0.640) | (0.650) | |
poverty_log | -0.470*** | -0.200 | 0.096 | -0.390+ | -0.200 | 0.100 | -0.390+ | 0.036 | 0.040 |
(0.120) | (0.140) | (0.160) | (0.200) | (0.140) | (0.160) | (0.200) | (0.330) | (0.330) | |
gini_log | 1.200*** | 0.660 | 0.470 | 0.680 | 0.660 | 0.480 | 0.670 | 1.900** | 1.900** |
(0.280) | (0.430) | (1.200) | (0.460) | (0.430) | (1.200) | (0.460) | (0.610) | (0.620) | |
unemployed_pct_log1p | 0.130* | -0.120 | 0.042 | -0.160+ | -0.120 | 0.047 | -0.160+ | -0.058 | -0.056 |
(0.052) | (0.085) | (0.180) | (0.097) | (0.086) | (0.180) | (0.097) | (0.130) | (0.130) | |
bachelor_pct_log1p | -0.140* | -0.063 | 0.420 | -0.120 | -0.070 | 0.420 | -0.130 | -0.190 | -0.220 |
(0.060) | (0.260) | (0.710) | (0.280) | (0.260) | (0.720) | (0.280) | (0.410) | (0.400) | |
race_hhi_log1p | -0.066* | 0.370* | 0.450 | 0.340+ | 0.790** | ||||
(0.033) | (0.170) | (0.350) | (0.190) | (0.250) | |||||
nonwhite_pct_log1p | 0.170* | 0.190 | 0.160+ | 0.360* | |||||
(0.085) | (0.230) | (0.092) | (0.150) | ||||||
total_popu_int_log1p | -0.360*** | -0.550 | -1.300 | 0.130 | -0.450 | -1.100 | 0.230 | -0.800 | -0.590 |
(0.024) | (0.640) | (0.820) | (0.970) | (0.640) | (0.830) | (0.960) | (0.750) | (0.740) | |
factor(year)2015 | 0.072 | ||||||||
(0.049) | |||||||||
factor(year)2016 | 0.069 | ||||||||
(0.050) | |||||||||
factor(year)2017 | 0.110* | ||||||||
(0.052) | |||||||||
factor(year)2018 | 0.140* | ||||||||
(0.055) | |||||||||
factor(year)2019 | 0.200*** | ||||||||
(0.057) | |||||||||
Constant | 6.500*** | ||||||||
(1.900) | |||||||||
Observations | 18,467 | 18,467 | 6,797 | 11,670 | 18,467 | 6,797 | 11,670 | 6,156 | 6,156 |
R2 | 0.780 | 0.410 | 0.370 | 0.430 | 0.410 | 0.370 | 0.430 | 0.440 | 0.440 |
Adjusted R2 | 0.780 | 0.300 | 0.240 | 0.310 | 0.300 | 0.240 | 0.310 | -0.120 | -0.130 |
Note: | (+ p<0.1; * p<0.05; ** p<0.01; *** p<0.001) |