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.2 ✔ 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(pastecs)
##
## Attaching package: 'pastecs'
##
## The following objects are masked from 'package:dplyr':
##
## first, last
##
## The following object is masked from 'package:tidyr':
##
## extract
setwd("C:/Users/KaeRo/Desktop/R Studio/Reseach Data Selection")
library(readxl)
district <- read_excel("district.xls")
CORRELATION TESTING————————————————————————————————————-
Teacher_percent<- district %>% select(DPSTBLFP,DPSTHIFP,DPSTWHFP,DPSTINFP,DPSTPIFP,DPSTTOSA) %>% drop_na()
cor(Teacher_percent)
## DPSTBLFP DPSTHIFP DPSTWHFP DPSTINFP DPSTPIFP
## DPSTBLFP 1.00000000 -0.06114596 -0.499141527 0.054671612 0.088232503
## DPSTHIFP -0.06114596 1.00000000 -0.817625865 -0.091437442 0.010729376
## DPSTWHFP -0.49914153 -0.81762586 1.000000000 0.006730531 -0.074328408
## DPSTINFP 0.05467161 -0.09143744 0.006730531 1.000000000 -0.005833426
## DPSTPIFP 0.08823250 0.01072938 -0.074328408 -0.005833426 1.000000000
## DPSTTOSA 0.09898315 0.14264616 -0.193255525 0.020925351 0.086403715
## DPSTTOSA
## DPSTBLFP 0.09898315
## DPSTHIFP 0.14264616
## DPSTWHFP -0.19325553
## DPSTINFP 0.02092535
## DPSTPIFP 0.08640372
## DPSTTOSA 1.00000000
pairs(~DPSTBLFP+DPSTHIFP+DPSTWHFP+DPSTINFP+DPSTPIFP+DPSTTOSA, data=Teacher_percent)
So average teacher pay doesn’t correlate with percentage of certain race
But interestesting relationship with hispanic and white teachers (there
is no other apparent correlation with other teacher races)
Cleaned_district<-district %>% drop_na()
cor(Cleaned_district$DPSTWHFP,Cleaned_district$DPETWHIP)
## [1] 0.8654033
So percentage of white teachers is somewhat correlated with percentage of white students
cor(Cleaned_district$DPETWHIP, Cleaned_district$DA0AT21R)
## [1] 0.210462
Percentage of white students not correlated with attendance rates
cor(Cleaned_district$DPETGIFP, Cleaned_district$DPETWHIP)
## [1] 0.01259812
Gifted and talented not correlated with percentage of white students
cor(Cleaned_district$DPETWHIP, Cleaned_district$DA0912DR21R)
## [1] -0.2865596
drop out rate is not correlated to percentage of white students
cor(Cleaned_district$DPSTTOSA, Cleaned_district$DPETBLAP)
## [1] 0.09129986
Teacher salary and percentage of african american children not correlated
VARIABLES OF INTEREST———————————————————————————————————— Comparing % of White Teachers & % of Hispanic Teachers
cor.test(Teacher_percent$DPSTWHFP,Teacher_percent$DPSTHIFP,method="kendall")
##
## Kendall's rank correlation tau
##
## data: Teacher_percent$DPSTWHFP and Teacher_percent$DPSTHIFP
## z = -36.587, p-value < 2.2e-16
## alternative hypothesis: true tau is not equal to 0
## sample estimates:
## tau
## -0.7098393
I used the Kendall’s rank in all honesty because I don’t think this data set will work with any of the others (not bell curve). The p- value is less than .05, so that means that there is some correlation? I think I’m reading that correctly.