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.
plot(model1, which=1)