library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.2.1 ✔ readr 2.2.0
## ✔ forcats 1.0.1 ✔ stringr 1.6.0
## ✔ ggplot2 4.0.3 ✔ tibble 3.3.1
## ✔ lubridate 1.9.5 ✔ tidyr 1.3.2
## ✔ purrr 1.2.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(readxl)
library(ggplot2)
CountyClean <- read_excel("CountyClean.xlsx")
## New names:
## • `National Z-Score` -> `National Z-Score...11`
## • `National Z-Score` -> `National Z-Score...25`
Dependent Variable = Preventable Hospitalization Rate (PHR) Independent Variables = # Primary Care Physicians (PCP), # of Mental Health Providers (MHP), Uninsured (UIN), Unemployed (UNEM), Food Insecure (FI), Household Severe Housing Cost Burden (HSHCB)
PHS Model<-lm() cars_multiple<-lm(hp~mpg+wt+cyl,data=mtcars)
County_model <-lm(PHR~PCP+MHP+UIN+UNEM+FI+HSHCB,data=CountyClean)
summary(County_model)
##
## Call:
## lm(formula = PHR ~ PCP + MHP + UIN + UNEM + FI + HSHCB, data = CountyClean)
##
## Residuals:
## Min 1Q Median 3Q Max
## -2176.09 -524.18 -37.33 521.06 2441.68
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.085e+03 6.426e+01 48.008 <2e-16 ***
## PCP -1.160e+00 1.463e+00 -0.793 0.429
## MHP -4.948e-03 4.212e-01 -0.012 0.991
## UIN 1.956e-03 7.235e-03 0.270 0.787
## UNEM 7.822e-02 7.850e-02 0.996 0.320
## FI -1.618e-03 5.763e-03 -0.281 0.779
## HSHCB -1.782e-02 3.345e-02 -0.533 0.595
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 865.8 on 180 degrees of freedom
## (34 observations deleted due to missingness)
## Multiple R-squared: 0.01855, Adjusted R-squared: -0.01417
## F-statistic: 0.567 on 6 and 180 DF, p-value: 0.7562
The model shows that the selected independent variables do not necessarily affect the independent variable of Preventable Hospitalization Rates. There are no significant variables listed accourding to the model. Furthermore, all the independent variables listed are shown as insignificant: # Primary Care Physicians (PCP), # of Mental Health Providers (MHP), Uninsured (UIN), Unemployed (UNEM), Food Insecure (FI), Household Severe Housing Cost Burden (HSHCB).
According to the model, no independent variables selected are significant/individually affect the dependent variable of Preventable Hospitalization Rates. However, there is some interpretation that the PCP, MHP, FI, and HSHCB will decrease the number of Preventable Hospitalization Rates slightly but not significantly. For example, for the number of Primary Care Physicians, each increase by one will result in a slight decrease in Preventable Hospitalization Rates by -1.16. Similarly regarding the number of Mental Health Providers, each increase by one will decrease the number of Preventable Hospitalization Rates by -4.94.
plot(County_model, which = 1)
The model slightly meets the assumption of linearity as there are plots following the zero line from the left to the right. However, it somewhat violates the assumption as there is a heavy concentration of data in the center of the model that reflects ‘up-down’ values rather than following the zero line.