# Run this code to load the required packages
suppressMessages(suppressWarnings(suppressPackageStartupMessages({
library(mosaic)
library(supernova)
library(Lock5withR)
})))
# Adjust the plots to be a bit smaller
options(repr.plot.width = 6, repr.plot.height = 4)
CensusSchool <- read.csv("https://docs.google.com/spreadsheets/d/e/2PACX-1vSVaWnM4odSxy0mlnhWvvGbeLtiKoZmsbqC6KLzXtBOjQfrF9EVKuX4RVh3XbP3iw/pub?gid=2100178416&single=true&output=csv", header = TRUE)
str(CensusSchool)
gf_point(Paid_Work_Hours ~ Gender, data = CensusSchool)
CensusSchool4 <- filter(CensusSchool, Paid_Work_Hours != 7000, Gender != "NA")
gf_jitter(Paid_Work_Hours ~ Gender, data = CensusSchool4)
CensusSchool9 <- filter(CensusSchool, Paid_Work_Hours <= 168)
gf_point(Paid_Work_Hours ~ Gender, data = CensusSchool9)
CensusSchool9 <- filter(CensusSchool, Paid_Work_Hours <= 168, Gender != "NA")
gf_jitter(Paid_Work_Hours ~ Gender, data = CensusSchool9)%>%
gf_boxplot(alpha = .1, color = "red", size = .5)
CensusSchool10 <- filter(CensusSchool, Paid_Work_Hours < 40, Gender != "NA")
gf_jitter(Paid_Work_Hours ~ Gender, data = CensusSchool10)%>%
gf_boxplot(alpha = .4, color = "dodgerblue2")
censusschool.model <- lm(Paid_Work_Hours ~ Gender, data = CensusSchool10)
censusschool.model
Genderpredictions <- predict(censusschool.model)
Genderpredictions
gf_jitter(Paid_Work_Hours ~ Gender, data = CensusSchool10) %>%
gf_jitter(Genderpredictions ~ Gender, color = "red", size = 0.3)
supernova(censusschool.model)