# Run this code to load the required packages
suppressMessages(suppressWarnings(suppressPackageStartupMessages({
library(mosaic)
library(supernova)
library(Lock5withR)
})))
CensusSchool <- read.csv("https://docs.google.com/spreadsheets/d/e/2PACX-1vSVaWnM4odSxy0mlnhWvvGbeLtiKoZmsbqC6KLzXtBOjQfrF9EVKuX4RVh3XbP3iw/pub?gid=2100178416&single=true&output=csv", header = TRUE)
#str(CensusSchool)
select(CensusSchool, Doing_Homework_Hours, Schoolwork_Pressure)
#hours_vs_pressure <- filter(CensusSchool,Schoolwork_Pressure != "NA", Doing_Homework_Hours < 100)
#hours_vs_pressure <- filter(Doing_Homework_Hours != "NA")
#gf_histogram(~Doing_Homework_Hours, data = hours_vs_pressure, fill = "green4") %>%
#gf_facet_grid(Schoolwork_Pressure ~ .)
hours_vs_pressure <- filter(CensusSchool, Schoolwork_Pressure != "NA", Doing_Homework_Hours < 100, Doing_Homework_Hours != "NA", Doing_Homework_Hours >=0)
gf_histogram(~Doing_Homework_Hours, data = hours_vs_pressure, fill = "green4") %>%
gf_facet_grid(Schoolwork_Pressure ~ .)
#gf_jitter( Doing_Homework_Hours ~ Schoolwork_Pressure, data = hours_vs_pressure, width = .2, alpha = .2, size = 2, color = "darkblue")
pressure.model<-lm(Doing_Homework_Hours ~ Schoolwork_Pressure, data = hours_vs_pressure)
hours_vs_pressure$pressure_predict<- predict(pressure.model)
gf_jitter(Doing_Homework_Hours ~ Schoolwork_Pressure, data = hours_vs_pressure, width = .2, alpha = .2, size = 2, color = "darkblue") %>%
gf_point(pressure_predict ~ Schoolwork_Pressure, data = hours_vs_pressure, color = "green", size = 3)