library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   4.0.0     ✔ tibble    3.3.0
## ✔ lubridate 1.9.4     ✔ tidyr     1.3.1
## ✔ purrr     1.1.0     
## ── 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(ggplot2)
library(readxl)
library(readxl)
Diabetes_Data_Cleaned <- read_excel("C:/Users/miche/Downloads/Diabetes_Data_Cleaned.xlsx")
View(Diabetes_Data_Cleaned)
Diabetes_Data_Cleaned<-Diabetes_Data_Cleaned
view(Diabetes_Data_Cleaned)
summary(Diabetes_Data_Cleaned)
##     Tract             Diagnosed          SNAP      
##  Length:375         Min.   : 2.50   Min.   : 2.00  
##  Class :character   1st Qu.:12.70   1st Qu.: 9.90  
##  Mode  :character   Median :15.30   Median :16.70  
##                     Mean   :16.46   Mean   :19.71  
##                     3rd Qu.:20.15   3rd Qu.:27.45  
##                     Max.   :29.50   Max.   :64.70  
##                     NA's   :4       NA's   :4
summary(Diabetes_Data_Cleaned$Tract)
##    Length     Class      Mode 
##       375 character character
hist(Diabetes_Data_Cleaned$SNAP)

modell<-lm(Tract~SNAP+Diagnosed, data=Diabetes_Data_Cleaned)
model1<-lm(Tract~SNAP+Diagnosed, data=Diabetes_Data_Cleaned)
plot(model1,which=1)

summary(model1)
## 
## Call:
## lm(formula = Tract ~ SNAP + Diagnosed, data = Diabetes_Data_Cleaned)
## 
## Residuals:
##    Min     1Q Median     3Q    Max 
## -98981 -29949   1041  19381 772956 
## 
## Coefficients:
##               Estimate Std. Error    t value Pr(>|t|)    
## (Intercept)  4.803e+10  1.410e+04  3.407e+06  < 2e-16 ***
## SNAP         1.472e+03  4.976e+02  2.959e+00  0.00329 ** 
## Diagnosed   -5.493e+03  1.267e+03 -4.335e+00 1.88e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 64060 on 368 degrees of freedom
##   (4 observations deleted due to missingness)
## Multiple R-squared:  0.05245,    Adjusted R-squared:  0.0473 
## F-statistic: 10.18 on 2 and 368 DF,  p-value: 4.956e-05

A one-unit increase in SNAP is associated with a statistically significant change in the diabetes outcome of the magnitude shown above, holding census tract constant. Which does show how they are all related. The association between SNAP and diabetes is not statistically distinguishable from zero at the 0.05 level
There appears to be a statistically significant relationship between SNAP participation and diabetes rates.