library(readxl)
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.1
## ✔ ggplot2 3.5.1 ✔ tibble 3.2.1
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.1
## ✔ purrr 1.0.4
## ── 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
district<-read_excel("district.xls")
bilingual<-district%>%select(DPETBILP,DPSTBIFP,DPSTTOSA,DPETHISP)
bilingual_clean<-bilingual%>%na.omit(.)
head(bilingual_clean)
## # A tibble: 6 × 4
## DPETBILP DPSTBIFP DPSTTOSA DPETHISP
## <dbl> <dbl> <dbl> <dbl>
## 1 1 0 55570 11.5
## 2 2.7 0.7 47916 11.8
## 3 4.1 0 50382 11.3
## 4 2 0 55346 13.5
## 5 16.1 2.6 48825 42.9
## 6 6.8 0 44741 26.2
bilingual_clean_model<-lm(DPETBILP~DPSTBIFP+DPSTTOSA+DPETHISP,data = bilingual_clean)
summary(bilingual_clean_model)
##
## Call:
## lm(formula = DPETBILP ~ DPSTBIFP + DPSTTOSA + DPETHISP, data = bilingual_clean)
##
## Residuals:
## Min 1Q Median 3Q Max
## -58.634 -4.812 -0.733 2.908 71.672
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -1.034e+01 3.159e+00 -3.273 0.00109 **
## DPSTBIFP 9.999e-01 5.720e-02 17.480 < 2e-16 ***
## DPSTTOSA 1.893e-04 5.861e-05 3.231 0.00127 **
## DPETHISP 2.400e-01 1.195e-02 20.084 < 2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 10.53 on 1199 degrees of freedom
## Multiple R-squared: 0.4919, Adjusted R-squared: 0.4906
## F-statistic: 386.9 on 3 and 1199 DF, p-value: < 2.2e-16
plot(bilingual_clean_model,which = 1)
