y1 单项,总分 and 医联体总分

## 
## Attaching package: 'gridExtra'
## The following object is masked from 'package:dplyr':
## 
##     combine
## Warning: Removed 1168 rows containing non-finite values (`stat_bin()`).

hospital <- read.csv("1-街道医联体得分.csv", skip = 1) %>%
  clean_names %>%
  select(hospital, total)
hist(hospital$total, main = "hosptial sum distribution")

street <- read.csv("2-街道医院.csv") %>%
  clean_names
street <- left_join(street, hospital, by="hospital")
library(dplyr)

street_scores <- street %>%
  group_by(`town_name`) %>%
  summarise(street_score = ifelse(n() == 1, 
                                  first(total), 
                                  mean(total, na.rm = TRUE)))

street<-left_join(street, street_scores, by="town_name")
residents<-left_join(residents, street_scores, by="town_name")
lm_model <- lm(street_score ~ factor(m33_cleaned), data = residents)
summary(lm_model)
## 
## Call:
## lm(formula = street_score ~ factor(m33_cleaned), data = residents)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -39.54  -9.83   4.17  10.46  18.17 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           79.5409     0.1427 557.217   <2e-16 ***
## factor(m33_cleaned)1  -1.7104     0.1865  -9.172   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 14.48 on 24850 degrees of freedom
## Multiple R-squared:  0.003374,   Adjusted R-squared:  0.003334 
## F-statistic: 84.13 on 1 and 24850 DF,  p-value: < 2.2e-16
boxplot(street_score ~ m33_cleaned, data = residents, 
        main = "Street Score by m33_cleaned Category")

lm_model <- lm(street_score ~ factor(m34_cleaned), data = residents)
summary(lm_model)
## 
## Call:
## lm(formula = street_score ~ factor(m34_cleaned), data = residents)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -39.768  -9.534   4.466  10.466  18.466 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           79.7677     0.1368  583.20   <2e-16 ***
## factor(m34_cleaned)1  -2.2340     0.1844  -12.12   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 14.46 on 24850 degrees of freedom
## Multiple R-squared:  0.005872,   Adjusted R-squared:  0.005832 
## F-statistic: 146.8 on 1 and 24850 DF,  p-value: < 2.2e-16
boxplot(street_score ~ m34_cleaned, data = residents, 
        main = "Street Score by m34_cleaned Category")

lm_model <- lm(street_score ~ factor(m70_cleaned), data = residents)
summary(lm_model)
## 
## Call:
## lm(formula = street_score ~ factor(m70_cleaned), data = residents)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -39.209 -10.200   4.791  10.800  17.800 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           79.2094     0.2809 282.025  < 2e-16 ***
## factor(m70_cleaned)1  -1.0095     0.3661  -2.757  0.00584 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 14.83 on 6776 degrees of freedom
##   (18074 observations deleted due to missingness)
## Multiple R-squared:  0.001121,   Adjusted R-squared:  0.0009734 
## F-statistic: 7.603 on 1 and 6776 DF,  p-value: 0.005842
boxplot(street_score ~ m70_cleaned, data = residents, 
        main = "Street Score by m70_cleaned Category")

lm_model <- lm(street_score ~ factor(m80_cleaned), data = residents)
summary(lm_model)
## 
## Call:
## lm(formula = street_score ~ factor(m80_cleaned), data = residents)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -39.161 -10.429   4.839  10.571  17.571 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           79.1612     0.4361 181.519   <2e-16 ***
## factor(m80_cleaned)1  -0.7324     0.5687  -1.288    0.198    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 14.64 on 2734 degrees of freedom
##   (22116 observations deleted due to missingness)
## Multiple R-squared:  0.0006062,  Adjusted R-squared:  0.0002407 
## F-statistic: 1.658 on 1 and 2734 DF,  p-value: 0.1979
boxplot(street_score ~ m80_cleaned, data = residents, 
        main = "Street Score by m80_cleaned Category")

lm_model <- lm(street_score ~ factor(lz112_cleaned), data = residents)
summary(lm_model)
## 
## Call:
## lm(formula = street_score ~ factor(lz112_cleaned), data = residents)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -39.294  -5.294   4.706  10.706  17.146 
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)             78.8541     0.1686 467.687   <2e-16 ***
## factor(lz112_cleaned)1   0.4397     0.3129   1.405     0.16    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 14.57 on 10524 degrees of freedom
##   (14326 observations deleted due to missingness)
## Multiple R-squared:  0.0001876,  Adjusted R-squared:  9.258e-05 
## F-statistic: 1.975 on 1 and 10524 DF,  p-value: 0.16
boxplot(street_score ~ lz112_cleaned, data = residents, 
        main = "Street Score by lz112_cleaned Category")

lm_model <- lm(street_score ~ factor(m137_cleaned), data = residents)
summary(lm_model)
## 
## Call:
## lm(formula = street_score ~ factor(m137_cleaned), data = residents)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -40.838 -10.493   3.507  10.507  17.507 
## 
## Coefficients:
##                       Estimate Std. Error t value Pr(>|t|)    
## (Intercept)            80.8379     0.6640 121.748  < 2e-16 ***
## factor(m137_cleaned)1  -2.3449     0.6704  -3.498  0.00047 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 14.5 on 24848 degrees of freedom
##   (2 observations deleted due to missingness)
## Multiple R-squared:  0.0004921,  Adjusted R-squared:  0.0004518 
## F-statistic: 12.23 on 1 and 24848 DF,  p-value: 0.0004704
boxplot(street_score ~ m137_cleaned, data = residents, 
        main = "Street Score by m137_cleaned Category")

lm_model <- lm(street_score ~ factor(lz134_cleaned), data = residents)
summary(lm_model)
## 
## Call:
## lm(formula = street_score ~ factor(lz134_cleaned), data = residents)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -41.306  -4.770   3.694  10.230  17.230 
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)             81.3060     0.5490 148.087  < 2e-16 ***
## factor(lz134_cleaned)1  -2.5357     0.6161  -4.116 3.96e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 13.77 on 3055 degrees of freedom
##   (21795 observations deleted due to missingness)
## Multiple R-squared:  0.005515,   Adjusted R-squared:  0.005189 
## F-statistic: 16.94 on 1 and 3055 DF,  p-value: 3.959e-05
boxplot(street_score ~ lz134_cleaned, data = residents, 
        main = "Street Score by lz134_cleaned Category")

lm_model <- lm(street_score ~ factor(zy168_cleaned), data = residents)
summary(lm_model)
## 
## Call:
## lm(formula = street_score ~ factor(zy168_cleaned), data = residents)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -39.955  -5.377   5.045  10.712  16.623 
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)             79.9546     0.7935 100.757   <2e-16 ***
## factor(zy168_cleaned)1  -0.5779     0.9142  -0.632    0.527    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 14.35 on 1324 degrees of freedom
##   (23526 observations deleted due to missingness)
## Multiple R-squared:  0.0003017,  Adjusted R-squared:  -0.0004533 
## F-statistic: 0.3996 on 1 and 1324 DF,  p-value: 0.5274
boxplot(street_score ~ zy168_cleaned, data = residents, 
        main = "Street Score by zy168_cleaned Category")

lm_model <- lm(street_score ~ m45, data = residents)
summary(lm_model)
## 
## Call:
## lm(formula = street_score ~ m45, data = residents)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -39.120 -10.048   4.167  10.667  20.096 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 75.547071   0.509875 148.168  < 2e-16 ***
## m45          0.035726   0.006085   5.871  4.4e-09 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 14.56 on 23682 degrees of freedom
##   (1168 observations deleted due to missingness)
## Multiple R-squared:  0.001453,   Adjusted R-squared:  0.001411 
## F-statistic: 34.47 on 1 and 23682 DF,  p-value: 4.397e-09
library(dplyr)
residents <- residents %>%
  mutate(y1 = m34 + m33 + m70 + m80 + lz112 + m137 + lz134 + zy168 + m45)
lm_model <- lm(street_score ~ y1, data = residents)
summary(lm_model)
## 
## Call:
## lm(formula = street_score ~ y1, data = residents)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -36.896  -6.359   4.607  10.090  17.740 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 87.89983    7.96081   11.04   <2e-16 ***
## y1          -0.10879    0.09712   -1.12    0.267    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 14.65 on 65 degrees of freedom
##   (24785 observations deleted due to missingness)
## Multiple R-squared:  0.01894,    Adjusted R-squared:  0.003842 
## F-statistic: 1.255 on 1 and 65 DF,  p-value: 0.2668

y2 单项,总分 and 医联体总分

variable n estimate std.error statistic p.value r_squared
w189_cleaned 604 1.806 1.871 0.965 0.335 0.002
old240_cleaned 8968 -3.922 1.688 -2.324 0.020 0.001
old241_cleaned 6790 -0.691 0.370 -1.867 0.062 0.001
ch204_cleaned 2839 -0.100 0.627 -0.160 0.873 0.000
m35_cleaned 13672 -1.569 0.305 -5.154 0.000 0.002

自评健康情况与医联评分,控制变量

## 
## Call:
## lm(formula = street_score ~ zy168 + gender + ethnicity + insurance, 
##     data = analysis_data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -40.445  -5.305   5.031  10.804  16.804 
## 
## Coefficients:
##                  Estimate Std. Error t value Pr(>|t|)    
## (Intercept)       77.9971     2.9388  26.541   <2e-16 ***
## zy168              0.3318     0.7607   0.436    0.663    
## genderFemale       0.1092     0.7945   0.137    0.891    
## ethnicityNon-Han   1.1400     1.0645   1.071    0.284    
## insuranceYes       0.8670     2.7447   0.316    0.752    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 14.36 on 1321 degrees of freedom
## Multiple R-squared:  0.001078,   Adjusted R-squared:  -0.001946 
## F-statistic: 0.3565 on 4 and 1321 DF,  p-value: 0.8396