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.2
## ✔ 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(readxl)
library(car)
## Loading required package: carData
##
## Attaching package: 'car'
##
## The following object is masked from 'package:dplyr':
##
## recode
##
## The following object is masked from 'package:purrr':
##
## some
district <- read_excel("district.xls")
model1 <- lm(DPSTURNR~DZCAMPUS+DPETALLC,data = district)
plot(model1)
summary(model1)
##
## Call:
## lm(formula = DPSTURNR ~ DZCAMPUS + DPETALLC, data = district)
##
## Residuals:
## Min 1Q Median 3Q Max
## -21.979 -6.533 -1.668 4.394 78.095
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.186e+01 3.531e-01 61.902 <2e-16 ***
## DZCAMPUS 8.477e-02 7.151e-02 1.186 0.2360
## DPETALLC -2.188e-04 9.649e-05 -2.268 0.0235 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 10.89 on 1197 degrees of freedom
## (7 observations deleted due to missingness)
## Multiple R-squared: 0.01645, Adjusted R-squared: 0.01481
## F-statistic: 10.01 on 2 and 1197 DF, p-value: 4.869e-05
vif(model1)
## DZCAMPUS DPETALLC
## 14.75806 14.75806
5, The model violates the term of homosscedasticity, and that means the variance of the residuals isnt conatsnt across the values on the graph.
6,I would apply a transformation to the dependent variable because it would stablize the variance an make the residuals more easier to look at.