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(ggplot2)
library(readxl)
load("NSDUH_2023.Rdata")
model1<-lm(AMDEYR~BNGDRMDAYS,data = data)
summary(model1)
## 
## Call:
## lm(formula = AMDEYR ~ BNGDRMDAYS, data = data)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -0.8891  0.1109  0.1109  0.1109  0.1262 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept) 1.8699574  0.0044005 424.940  < 2e-16 ***
## BNGDRMDAYS  0.0038314  0.0009982   3.838 0.000124 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.318 on 43696 degrees of freedom
##   (13007 observations deleted due to missingness)
## Multiple R-squared:  0.0003371,  Adjusted R-squared:  0.0003142 
## F-statistic: 14.73 on 1 and 43696 DF,  p-value: 0.000124

5.The linear regression model examines the relationship between binge drinking frequency and depression. The model has an R squared value of 0.0003371, meaning that binge drinking frequency explains approximately 0.034% of the variation is depression. This indicates that the overall model explains very little of the variation in the dependent variable. However, the overall model is statistically significant, with p value of 0.000124, which is less than 0.05. Binge drinking frequency is also statistically significant, with p-value of 0.000124,suggesting a significant but very weak relationship with depression. There are no insignificant independent variables in this model because binge drinking frequency is the only independent variable included.

  1. Binge drinking frequency was a statistically significant predictor of depression, with a beta coefficient of 0.0038314 and p-value of 0.000124. The positive coefficient indicates that for every one unit increase in the binge drinking variable, the predicted value of the depression variable increases by approximately 0.0038 units. However the, effect is very small suggesting that binge drinking frequency has a weak relationship with depression in this model.
plot(model1, which=1)

  1. To assess the assumption of iinearity, I examined the Residuals vs Fitted plot by running “plot(model1,which=1). The plot shows that the residuals are fairly evenly distributed across the range of fitted values and the red line is relatively flat, which suggests there is no clear curvilinear pattern. However the residuals form two distinct horizontal bands, which is expected because the dependent variable, depression. This pattern indicated that the relationship between binge drinking frequency and depression appears to be approximately linear, but the use of linear regression is not ideal given the categorical nature of the dependent variable.