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)
district <-read_excel("district (2).xls")
My dependent Variable I am selecting is the SAT Average Score (DA0CSA21R) The independent variables I am selecting are: teacher turnover rate, attendance rate, % of economically disadvantaged
district_multiple<-lm(DA0CSA21R~DA0AT21R+DPETECOP,data=district)
summary(district_multiple)
##
## Call:
## lm(formula = DA0CSA21R ~ DA0AT21R + DPETECOP, data = district)
##
## Residuals:
## Min 1Q Median 3Q Max
## -984.53 76.88 147.79 203.35 443.09
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 218.0867 501.6097 0.435 0.6638
## DA0AT21R 8.4676 5.1159 1.655 0.0982 .
## DPETECOP -3.3484 0.6494 -5.156 3.08e-07 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 380.1 on 941 degrees of freedom
## (263 observations deleted due to missingness)
## Multiple R-squared: 0.0426, Adjusted R-squared: 0.04057
## F-statistic: 20.94 on 2 and 941 DF, p-value: 1.269e-09
So this means that the model only explains about 4.26 percent of variance of the dependent variable. A significant value would be the percent of disadvantaged because that has a strong negative relationship with the dependent variable. The coefficient for this strong relationship is -3.3484. So when the independent variable does up, the dependent variable goes down by 3.3484. Then the insignificant variable would be the attendance rate because its positive but its very weak and not close to the p value.
plot(district_multiple, which=1)
The model violates the assumption of linearity and the red line is not
completely horizontally.