library(dplyr)
data=left_join(clean_stratified,emission[c(3,4,5)],by="state")
data$test <- factor(data$test)
data$cat_rucc<-factor(data$cat_rucc)
data$act<-factor(data$act)
data[c(6:44)]<-scale(data[c(6:44)])
gini<- read.csv("~/Desktop/Columbia research/Social Capital and EQI/data/2010 gini.csv",stringsAsFactors=F)[c(2,5)]
names(gini)[1]="state"
names(gini)[2]="gini"
data=left_join(data,gini,by="state")
Column `state` joining factor and character vector, coercing into character vector
names(fund)[5]="state"
The `names` must have length 4, not 5.
[90mThis warning is displayed once per session.[39mError in attr(x, "names") <- as.character(value) :
'names' attribute [5] must be the same length as the vector [4]
subdata=data[data$gini!=0,]
summary(lm(site~gini+black,data=subdata))
Call:
lm(formula = site ~ gini + black, data = subdata)
Residuals:
Min 1Q Median 3Q Max
-0.6958 -0.3810 -0.3453 -0.2992 18.7170
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.844452 0.028100 30.05 <2e-16 ***
gini -1.078506 0.062758 -17.18 <2e-16 ***
black 0.047912 0.002269 21.12 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.214 on 302829 degrees of freedom
(355 observations deleted due to missingness)
Multiple R-squared: 0.002053, Adjusted R-squared: 0.002046
F-statistic: 311.4 on 2 and 302829 DF, p-value: < 2.2e-16
summary(lm(score~gini+black,data=subdata))
Call:
lm(formula = score ~ gini + black, data = subdata)
Residuals:
Min 1Q Median 3Q Max
-9.273 -7.660 -7.323 -6.606 65.893
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 14.53881 0.38326 37.935 <2e-16 ***
gini -15.98180 0.85597 -18.671 <2e-16 ***
black 0.03925 0.03094 1.268 0.205
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 16.56 on 302829 degrees of freedom
(355 observations deleted due to missingness)
Multiple R-squared: 0.001169, Adjusted R-squared: 0.001163
F-statistic: 177.3 on 2 and 302829 DF, p-value: < 2.2e-16
Only air EQI is positive.
data$gini=as.numeric(data$gini)
summary(lm(EQI_22July2013~gini,data=data))
Call:
lm(formula = EQI_22July2013 ~ gini, data = data)
Residuals:
Min 1Q Median 3Q Max
-6.0202 -0.5890 0.0468 0.6704 3.3350
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.54023 0.02183 70.55 <2e-16 ***
gini -3.68386 0.04872 -75.61 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.962 on 303050 degrees of freedom
(135 observations deleted due to missingness)
Multiple R-squared: 0.01852, Adjusted R-squared: 0.01851
F-statistic: 5717 on 1 and 303050 DF, p-value: < 2.2e-16
summary(lm(air_EQI_22July2013~gini,data=data))
Call:
lm(formula = air_EQI_22July2013 ~ gini, data = data)
Residuals:
Min 1Q Median 3Q Max
-3.3193 -0.4919 0.1087 0.6532 2.8501
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.40456 0.02161 -18.73 <2e-16 ***
gini 0.86078 0.04822 17.85 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.952 on 303050 degrees of freedom
(135 observations deleted due to missingness)
Multiple R-squared: 0.001051, Adjusted R-squared: 0.001047
F-statistic: 318.7 on 1 and 303050 DF, p-value: < 2.2e-16
summary(lm(land_EQI_22July2013~gini,data=data))
Call:
lm(formula = land_EQI_22July2013 ~ gini, data = data)
Residuals:
Min 1Q Median 3Q Max
-5.6419 -0.3778 0.1495 0.6039 2.6008
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.98617 0.02177 91.23 <2e-16 ***
gini -4.70281 0.04858 -96.80 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.9592 on 303050 degrees of freedom
(135 observations deleted due to missingness)
Multiple R-squared: 0.02999, Adjusted R-squared: 0.02999
F-statistic: 9370 on 1 and 303050 DF, p-value: < 2.2e-16
summary(lm(built_EQI_22July2013~gini,data=data))
Call:
lm(formula = built_EQI_22July2013 ~ gini, data = data)
Residuals:
Min 1Q Median 3Q Max
-6.1911 -0.4996 0.1625 0.6795 4.1154
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.61020 0.02323 26.27 <2e-16 ***
gini -1.53062 0.05183 -29.53 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.023 on 303050 degrees of freedom
(135 observations deleted due to missingness)
Multiple R-squared: 0.002869, Adjusted R-squared: 0.002866
F-statistic: 872 on 1 and 303050 DF, p-value: < 2.2e-16
summary(lm(sociod_EQI_22July2013~gini,data=data))
Call:
lm(formula = sociod_EQI_22July2013 ~ gini, data = data)
Residuals:
Min 1Q Median 3Q Max
-5.2436 -0.6185 -0.0045 0.6083 4.7852
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.18946 0.02273 96.31 <2e-16 ***
gini -5.16419 0.05073 -101.79 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.002 on 303050 degrees of freedom
(135 observations deleted due to missingness)
Multiple R-squared: 0.03306, Adjusted R-squared: 0.03306
F-statistic: 1.036e+04 on 1 and 303050 DF, p-value: < 2.2e-16
summary(lm(water_EQI_22July2013~gini,data=data))
Call:
lm(formula = water_EQI_22July2013 ~ gini, data = data)
Residuals:
Min 1Q Median 3Q Max
-1.7262 -0.4440 0.2416 0.7880 1.5042
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.35847 0.02139 16.75 <2e-16 ***
gini -0.73938 0.04775 -15.49 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.9427 on 303050 degrees of freedom
(135 observations deleted due to missingness)
Multiple R-squared: 0.0007907, Adjusted R-squared: 0.0007874
F-statistic: 239.8 on 1 and 303050 DF, p-value: < 2.2e-16
summary(lm(air_EQI_22July2013 ~ cat_rucc+test+sk09+education+income+black , data = data))
Call:
lm(formula = air_EQI_22July2013 ~ cat_rucc + test + sk09 + education +
income + black, data = data)
Residuals:
Min 1Q Median 3Q Max
-2.48896 -0.38217 0.06161 0.44088 2.83824
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.47218 0.02735 17.263 < 2e-16 ***
cat_rucc2 -0.12609 0.04163 -3.028 0.002479 **
cat_rucc3 -0.67993 0.03221 -21.109 < 2e-16 ***
cat_rucc4 -1.40022 0.03968 -35.288 < 2e-16 ***
test1 0.14187 0.02449 5.793 7.62e-09 ***
sk09 -0.24317 0.01515 -16.049 < 2e-16 ***
education 0.12957 0.01674 7.739 1.35e-14 ***
income 0.05406 0.01567 3.450 0.000568 ***
black 0.19146 0.01250 15.314 < 2e-16 ***
---
Signif. codes:
0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.629 on 3099 degrees of freedom
(33 observations deleted due to missingness)
Multiple R-squared: 0.5908, Adjusted R-squared: 0.5897
F-statistic: 559.2 on 8 and 3099 DF, p-value: < 2.2e-16
summary(lm(air_EQI_22July2013 ~ cat_rucc+test+sk09+education+income+black , data = data))
summary(lm(air_EQI_22July2013 ~cat_rucc+ act+sk09+education+income+black , data = data))
Call:
lm(formula = air_EQI_22July2013 ~ cat_rucc + act + sk09 + education +
income + black, data = data)
Residuals:
Min 1Q Median 3Q Max
-2.4258 -0.3941 0.0540 0.4535 2.9424
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.53957 0.02397 22.509 < 2e-16 ***
cat_rucc2 -0.12205 0.04181 -2.919 0.00354 **
cat_rucc3 -0.68644 0.03232 -21.241 < 2e-16 ***
cat_rucc4 -1.41761 0.03975 -35.666 < 2e-16 ***
act1 0.07139 0.02513 2.840 0.00453 **
sk09 -0.25560 0.01507 -16.964 < 2e-16 ***
education 0.11753 0.01669 7.043 2.31e-12 ***
income 0.06291 0.01570 4.007 6.29e-05 ***
black 0.18435 0.01269 14.525 < 2e-16 ***
---
Signif. codes:
0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.6316 on 3099 degrees of freedom
(33 observations deleted due to missingness)
Multiple R-squared: 0.5874, Adjusted R-squared: 0.5864
F-statistic: 551.5 on 8 and 3099 DF, p-value: < 2.2e-16
summary(lm(water_EQI_22July2013 ~cat_rucc+ act+sk09+education+income+black , data = data))
Call:
lm(formula = water_EQI_22July2013 ~ cat_rucc + act + sk09 + education +
income + black, data = data)
Residuals:
Min 1Q Median 3Q Max
-2.0571 -0.7410 0.2850 0.7749 2.2054
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.075287 0.036142 -2.083 0.03732 *
cat_rucc2 0.083753 0.063041 1.329 0.18409
cat_rucc3 0.114527 0.048726 2.350 0.01881 *
cat_rucc4 -0.137694 0.059927 -2.298 0.02165 *
act1 0.191411 0.037896 5.051 4.65e-07 ***
sk09 -0.182350 0.022717 -8.027 1.40e-15 ***
education 0.080548 0.025162 3.201 0.00138 **
income -0.007867 0.023672 -0.332 0.73966
black -0.250012 0.019135 -13.065 < 2e-16 ***
---
Signif. codes:
0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.9523 on 3099 degrees of freedom
(33 observations deleted due to missingness)
Multiple R-squared: 0.1005, Adjusted R-squared: 0.09815
F-statistic: 43.27 on 8 and 3099 DF, p-value: < 2.2e-16
summary(lm(EQI_22July2013 ~ cat_rucc+act+sk09+education+income+black , data = data))
Call:
lm(formula = EQI_22July2013 ~ cat_rucc + act + sk09 + education +
income + black, data = data)
Residuals:
Min 1Q Median 3Q Max
-3.6559 -0.3370 0.0672 0.4119 1.6004
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.28542 0.02281 12.511 < 2e-16 ***
cat_rucc2 0.10202 0.03979 2.564 0.01040 *
cat_rucc3 -0.28131 0.03076 -9.146 < 2e-16 ***
cat_rucc4 -1.10062 0.03783 -29.095 < 2e-16 ***
act1 0.19954 0.02392 8.341 < 2e-16 ***
sk09 -0.04096 0.01434 -2.857 0.00431 **
education 0.31418 0.01588 19.781 < 2e-16 ***
income 0.25362 0.01494 16.973 < 2e-16 ***
black -0.05970 0.01208 -4.943 8.11e-07 ***
---
Signif. codes:
0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.6011 on 3099 degrees of freedom
(33 observations deleted due to missingness)
Multiple R-squared: 0.6087, Adjusted R-squared: 0.6077
F-statistic: 602.6 on 8 and 3099 DF, p-value: < 2.2e-16
summary(lm(EQI_22July2013 ~ cat_rucc+act+sk09+education+income+black , data = data))