Homework 6 – Linear Regression

Aliyah Young

2026-11-19

main_data <- read.csv("analytic_data2025_v3.csv")

texas_data <- subset(main_data, State.Abbreviation == "TX")

texas_data <- subset(texas_data, County.FIPS.Code != "000")

dim(texas_data)
## [1] 254 796
regression_data <- texas_data[, c(
  "Poor.or.Fair.Health.raw.value",
  "Uninsured.Adults.raw.value",
  "Adult.Smoking.raw.value",
  "Physical.Inactivity.raw.value"
)]

regression_data[] <- lapply(regression_data, as.numeric)

summary(regression_data)
##  Poor.or.Fair.Health.raw.value Uninsured.Adults.raw.value Adult.Smoking.raw.value
##  Min.   :0.1240                Min.   :0.03226            Min.   :0.0880         
##  1st Qu.:0.2050                1st Qu.:0.20192            1st Qu.:0.1590         
##  Median :0.2280                Median :0.23041            Median :0.1735         
##  Mean   :0.2355                Mean   :0.23303            Mean   :0.1729         
##  3rd Qu.:0.2605                3rd Qu.:0.26161            3rd Qu.:0.1900         
##  Max.   :0.4650                Max.   :0.40732            Max.   :0.2770         
##  Physical.Inactivity.raw.value
##  Min.   :0.1740               
##  1st Qu.:0.2690               
##  Median :0.2945               
##  Mean   :0.2998               
##  3rd Qu.:0.3275               
##  Max.   :0.4730

Question 3 multiple linear regression model to examine the relationship between uninsured adults, adult smoking, physical inactivity, and poor or fair health across Texas counties.

model <- lm(Poor.or.Fair.Health.raw.value ~
              Uninsured.Adults.raw.value +
              Adult.Smoking.raw.value +
              Physical.Inactivity.raw.value,
            data = regression_data)

model
## 
## Call:
## lm(formula = Poor.or.Fair.Health.raw.value ~ Uninsured.Adults.raw.value + 
##     Adult.Smoking.raw.value + Physical.Inactivity.raw.value, 
##     data = regression_data)
## 
## Coefficients:
##                   (Intercept)     Uninsured.Adults.raw.value  
##                      -0.06492                        0.02462  
##       Adult.Smoking.raw.value  Physical.Inactivity.raw.value  
##                      -0.02433                        0.99717
  1. Summary of the Linear Regression Model

I used the summary command to examine the overall performance of my linear regression model and determine which independent variables are statistically significant.

summary(model)
## 
## Call:
## lm(formula = Poor.or.Fair.Health.raw.value ~ Uninsured.Adults.raw.value + 
##     Adult.Smoking.raw.value + Physical.Inactivity.raw.value, 
##     data = regression_data)
## 
## Residuals:
##       Min        1Q    Median        3Q       Max 
## -0.034625 -0.004883 -0.000005  0.004159  0.055372 
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                   -0.064917   0.004292 -15.124   <2e-16 ***
## Uninsured.Adults.raw.value     0.024624   0.015490   1.590    0.113    
## Adult.Smoking.raw.value       -0.024330   0.030491  -0.798    0.426    
## Physical.Inactivity.raw.value  0.997175   0.018611  53.579   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.009619 on 250 degrees of freedom
## Multiple R-squared:  0.9674, Adjusted R-squared:  0.967 
## F-statistic:  2474 on 3 and 250 DF,  p-value: < 2.2e-16
  1. Interpretation of R-Squared and P-Values

Based on my linear regression results, the model produced an R-squared value of 0.9674. This means that approximately 96.74% of the variation in poor or fair health across Texas counties can be explained by the three independent variables: uninsured adults, adult smoking, and physical inactivity. The overall model was statistically significant because its p-value was less than 0.05.

When examining each independent variable individually, physical inactivity was the only statistically significant variable, with a p-value below 0.001. Uninsured adults and adult smoking were not statistically significant because their p-values were 0.113 and 0.426, respectively, which are both above the significance level of 0.05.

What I found particularly interesting was that in my previous correlation analysis, uninsured adults had a statistically significant relationship with poor or fair health. However, after introducing adult smoking and physical inactivity into my regression model, uninsured adults were no longer statistically significant. These findings suggest that other health-related factors may help explain the relationship between health insurance coverage and health outcomes across Texas counties.

  1. Interpretation of Beta Coefficients

After reviewing my regression results, I found that physical inactivity was the only statistically significant independent variable, with a beta coefficient of 0.997175. This means that for every one-percentage-point increase in physical inactivity, the percentage of adults reporting poor or fair health is expected to increase by approximately one percentage point, while holding uninsured adults and adult smoking constant.

These findings suggest that physical inactivity has a strong positive relationship with poor or fair health across Texas counties. From a public health and public administration perspective, these results highlight the potential importance of community health programs, access to recreational spaces, and initiatives that encourage physical activity. However, further research would be needed to determine whether physical inactivity directly causes poorer health outcomes.

  1. Testing the Assumption of Linearity

To determine whether my regression model meets the assumption of linearity, I created a Residuals vs. Fitted plot.

plot(model, which = 1)
plot of chunk unnamed-chunk-5

After examining my Residuals vs. Fitted plot, I found that my regression model slightly violates the assumption of linearity. Although most of the residuals are clustered around zero, the red trend line shows a slight curve rather than remaining completely horizontal. This suggests that the relationship between my independent variables and dependent variable may not be entirely linear. I also noticed a few potential outliers that may affect the model’s performance.