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)
additional_data <- read_excel("tx.counties.xlsx", sheet = "Additional Measure Data", skip = 1)
## New names:
## • `95% CI - Low` -> `95% CI - Low...5`
## • `95% CI - High` -> `95% CI - High...6`
## • `# Deaths` -> `# Deaths...28`
## • `95% CI - Low` -> `95% CI - Low...30`
## • `95% CI - High` -> `95% CI - High...31`
## • `# Deaths` -> `# Deaths...53`
## • `95% CI - Low` -> `95% CI - Low...55`
## • `95% CI - High` -> `95% CI - High...56`
## • `# Deaths` -> `# Deaths...78`
## • `95% CI - Low` -> `95% CI - Low...80`
## • `95% CI - High` -> `95% CI - High...81`
## • `95% CI - Low` -> `95% CI - Low...104`
## • `95% CI - High` -> `95% CI - High...105`
## • `95% CI - Low` -> `95% CI - Low...107`
## • `95% CI - High` -> `95% CI - High...108`
## • `95% CI - Low` -> `95% CI - Low...112`
## • `95% CI - High` -> `95% CI - High...113`
## • `95% CI - Low` -> `95% CI - Low...115`
## • `95% CI - High` -> `95% CI - High...116`
## • `# Deaths` -> `# Deaths...117`
## • `95% CI - Low` -> `95% CI - Low...119`
## • `95% CI - High` -> `95% CI - High...120`
## • `95% CI - Low` -> `95% CI - Low...144`
## • `95% CI - High` -> `95% CI - High...145`
## • `95% CI - Low` -> `95% CI - Low...151`
## • `95% CI - High` -> `95% CI - High...152`
## • `95% CI - Low` -> `95% CI - Low...154`
## • `95% CI - High` -> `95% CI - High...155`
## • `95% CI - Low` -> `95% CI - Low...180`
## • `95% CI - High` -> `95% CI - High...181`
## • `95% CI - Low` -> `95% CI - Low...185`
## • `95% CI - High` -> `95% CI - High...186`
## • `95% CI - Low` -> `95% CI - Low...189`
## • `95% CI - High` -> `95% CI - High...190`
## • `95% CI - Low` -> `95% CI - Low...213`
## • `95% CI - High` -> `95% CI - High...214`
## • `95% CI - Low` -> `95% CI - Low...216`
## • `95% CI - High` -> `95% CI - High...217`
## • `95% CI - Low` -> `95% CI - Low...220`
## • `95% CI - High` -> `95% CI - High...221`
## • `95% CI - Low` -> `95% CI - Low...224`
## • `95% CI - High` -> `95% CI - High...225`
## • `95% CI - Low` -> `95% CI - Low...231`
## • `95% CI - High` -> `95% CI - High...232`
## • `95% CI - Low` -> `95% CI - Low...235`
## • `95% CI - High` -> `95% CI - High...236`
## • `Average Grade Performance` -> `Average Grade Performance...246`
## • `Average Grade Performance (AIAN)` -> `Average Grade Performance
##   (AIAN)...247`
## • `Average Grade Performance (Asian)` -> `Average Grade Performance
##   (Asian)...248`
## • `Average Grade Performance (Black)` -> `Average Grade Performance
##   (Black)...249`
## • `Average Grade Performance (Hispanic)` -> `Average Grade Performance
##   (Hispanic)...250`
## • `Average Grade Performance (White)` -> `Average Grade Performance
##   (White)...251`
## • `Average Grade Performance` -> `Average Grade Performance...252`
## • `Average Grade Performance (AIAN)` -> `Average Grade Performance
##   (AIAN)...253`
## • `Average Grade Performance (Asian)` -> `Average Grade Performance
##   (Asian)...254`
## • `Average Grade Performance (Black)` -> `Average Grade Performance
##   (Black)...255`
## • `Average Grade Performance (Hispanic)` -> `Average Grade Performance
##   (Hispanic)...256`
## • `Average Grade Performance (White)` -> `Average Grade Performance
##   (White)...257`
## • `Segregation Index` -> `Segregation Index...258`
## • `95% CI - Low` -> `95% CI - Low...265`
## • `95% CI - High` -> `95% CI - High...266`
## • `95% CI - Low` -> `95% CI - Low...268`
## • `95% CI - High` -> `95% CI - High...269`
## • `Segregation Index` -> `Segregation Index...287`
## • `95% CI - Low` -> `95% CI - Low...289`
## • `95% CI - High` -> `95% CI - High...290`
## • `95% CI - Low` -> `95% CI - Low...314`
## • `95% CI - High` -> `95% CI - High...315`
## • `95% CI - Low` -> `95% CI - Low...339`
## • `95% CI - High` -> `95% CI - High...340`
## • `95% CI - Low` -> `95% CI - Low...363`
## • `95% CI - High` -> `95% CI - High...364`
## • `95% CI - Low` -> `95% CI - Low...366`
## • `95% CI - High` -> `95% CI - High...367`
## • `95% CI - Low` -> `95% CI - Low...386`
## • `95% CI - High` -> `95% CI - High...387`
## • `95% CI - Low` -> `95% CI - Low...391`
## • `95% CI - High` -> `95% CI - High...392`
counties <- additional_data[-1, ]
model <- lm(`% Frequent Mental Distress` ~ `% Food Insecure` + `% Uninsured Adults`, data = counties)
summary(model)
## 
## Call:
## lm(formula = `% Frequent Mental Distress` ~ `% Food Insecure` + 
##     `% Uninsured Adults`, data = counties)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.7798 -0.7364  0.1654  0.6896  3.9187 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)          13.83606    0.47100  29.376  < 2e-16 ***
## `% Food Insecure`     0.24092    0.02831   8.510  1.6e-15 ***
## `% Uninsured Adults`  0.05126    0.01647   3.113  0.00207 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.205 on 251 degrees of freedom
## Multiple R-squared:  0.3481, Adjusted R-squared:  0.3429 
## F-statistic: 67.01 on 2 and 251 DF,  p-value: < 2.2e-16
  1. The multiple linear regression model explains approximately 34.81% of the variation in frequent mental distress across Texas counties, with an adjusted R-squared of 34%. the overall model is statistically significant (p<0.001). Both independent variables are statistically significant becasue their p-values are below 0.05. Food Insecurity has a p-value less than 0.001, while Uninsured Adults has a p-value of 0.00207. this suggests that both variables are associated with frequent mental distress. There are no statistically insignificant variables.

Estimates: Food Insecure: 0.24092 Uninsured Adults: 0.05126

Both of these IV’S are positive, higher percentages of either variable are associated with higher percantages of frequent mental distress. For every 1 percentage-point increase in food insecurity, frequent mental distress is expected to increase by approximately 0.24 percent, holding uninsured adults constant. For every 1 percentage-point increase in uninsured adults, frequent mental distress is expected to increase by approximately 0.05 percentage points, holding food insecurity constant. food insecurity also seems to have the larger effect on frequent mental distress.

plot(model, which = 1)

WELL it looks as though the model is not linear. the red line is not flat, there is an upward curve then a downward.