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)
library(dplyr)
district <- read_excel("district.xls")
Dependent Variable: DA0CC23R College Admissions: At/Above Criterion
Independent Variable(s): DPSTKIDR - # Students Per Teacher, DPSTURNR - Teacher Turnover Rate, DPFPAREGP - % of Basic Education Service, DPSTTOSA - Average Teacher Salary
# Clean the original dataset
district_clean <- district[
!is.na(district$DA0CC23R) & district$DA0CC23R >= 0, ]
# Run the regression using the cleaned dataset
district_data <- lm(
DA0CC23R ~ DPSTTOSA + DPSTKIDR +
DPSTURNR + DPFPAREGP,
data = district_clean
)
# View regression results
summary(district_data)
##
## Call:
## lm(formula = DA0CC23R ~ DPSTTOSA + DPSTKIDR + DPSTURNR + DPFPAREGP,
## data = district_clean)
##
## Residuals:
## Min 1Q Median 3Q Max
## -33.394 -10.466 -1.653 8.201 57.137
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -3.876e+00 5.119e+00 -0.757 0.449
## DPSTTOSA 1.168e-04 8.387e-05 1.393 0.164
## DPSTKIDR -1.047e-01 8.196e-02 -1.278 0.202
## DPSTURNR -3.308e-01 5.088e-02 -6.502 1.24e-10 ***
## DPFPAREGP 8.024e-01 6.089e-02 13.176 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 14.44 on 1014 degrees of freedom
## (4 observations deleted due to missingness)
## Multiple R-squared: 0.1959, Adjusted R-squared: 0.1927
## F-statistic: 61.74 on 4 and 1014 DF, p-value: < 2.2e-16
summary(district_data)
##
## Call:
## lm(formula = DA0CC23R ~ DPSTTOSA + DPSTKIDR + DPSTURNR + DPFPAREGP,
## data = district_clean)
##
## Residuals:
## Min 1Q Median 3Q Max
## -33.394 -10.466 -1.653 8.201 57.137
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -3.876e+00 5.119e+00 -0.757 0.449
## DPSTTOSA 1.168e-04 8.387e-05 1.393 0.164
## DPSTKIDR -1.047e-01 8.196e-02 -1.278 0.202
## DPSTURNR -3.308e-01 5.088e-02 -6.502 1.24e-10 ***
## DPFPAREGP 8.024e-01 6.089e-02 13.176 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 14.44 on 1014 degrees of freedom
## (4 observations deleted due to missingness)
## Multiple R-squared: 0.1959, Adjusted R-squared: 0.1927
## F-statistic: 61.74 on 4 and 1014 DF, p-value: < 2.2e-16
The model explains how much my dependent variable is related to indepedent variables. This model has a r-squared value of 0.1902, which explain the affect of the independent variables at 19.02% of variation to the dependent variable.
Significant p-values in variables are DPSTTOSA (Average Teacher Salary) p=0.0232; DPSTURNR (Teacher Turnover Rate) p=2.69x10^(-14), and DPFPAREGP (% of Basic Education Service) p=2x10^(-16).
% of Basic Education Service has the high statistically significant positive relation with College Admissions: % At/Above Cierion. Average Teacher Salary has a statistically significant positive relationship with College Admissions: % At/Above Crierion. Teacher Turnover Rate has a high statistical significance and a negative relationship with College Admissions: At/Above Crierion.
Lesser significant p-values in variables are DPSTKIDR (# Students Per Teacher) p=0.8959 with an estimate of -0.01091. This means the # of students per teacher less of a relationship than the other variables controlled.
plot(district_data,which=1)