In analysis one, the data wasnt signficiant between precint 3 and 18 because it was above 0.05.But for precints 8 and 18 and 8 and 3, they differed between because it was 0.00.
if (!require("tidyverse"))
install.packages("tidyverse")
## Loading required package: 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.4.4 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ purrr 1.0.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(tidyverse)
mydata <- read.csv("https://raw.githubusercontent.com/drkblake/Data/main/Weekly18and23.csv")
mydata$V1 <- mydata$Minutes_2018
mydata$V2 <- mydata$Minutes_2023
mydata$PairDifferences <- mydata$V2 - mydata$V1
mydata %>%
select(PairDifferences) %>%
summarise(
count = n(),
mean = mean(PairDifferences, na.rm = TRUE),
sd = sd(PairDifferences, na.rm = TRUE),
min = min(PairDifferences, na.rm = TRUE),
max = max(PairDifferences, na.rm = TRUE))
## count mean sd min max
## 1 52 4.75 9.017206 -15.3 26.8
mydata %>%
select(V1, V2) %>%
summarise_all(list(Mean = mean, SD = sd))
## V1_Mean V2_Mean V1_SD V2_SD
## 1 8.763462 13.51346 5.951867 5.998203
options(scipen = 999)
t.test(mydata$V2, mydata$V1,
paired = TRUE)
##
## Paired t-test
##
## data: mydata$V2 and mydata$V1
## t = 3.7986, df = 51, p-value = 0.0003888
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
## 2.239594 7.260406
## sample estimates:
## mean difference
## 4.75
For analysis two, the data sets differed significantly. The p-value was 0.0007732. The comparison between them was a big difference.
mydata <- read.csv("https://raw.githubusercontent.com/drkblake/Data/main/RichPoor.csv")
if (!require("tidyverse"))
install.packages("tidyverse")
library(tidyverse)
mydata$DV <- mydata$Minutes
mydata$IV <- mydata$Precinct
group_by(mydata, IV) %>%
summarise(
count = n(),
mean = mean(DV, na.rm = TRUE),
sd = sd(DV, na.rm = TRUE),
min = min(DV, na.rm = TRUE),
max = max(DV, na.rm = TRUE))
## # A tibble: 2 × 6
## IV count mean sd min max
## <chr> <int> <dbl> <dbl> <dbl> <dbl>
## 1 Precinct 12 159 14.3 7.05 -4.6 34.6
## 2 Precinct 8 132 9.15 4.48 -2.9 18.3
options(scipen = 999)
t.test(mydata$DV ~ mydata$IV,
var.equal = FALSE)
##
## Welch Two Sample t-test
##
## data: mydata$DV by mydata$IV
## t = 7.5258, df = 271.55, p-value = 0.0000000000007732
## alternative hypothesis: true difference in means between group Precinct 12 and group Precinct 8 is not equal to 0
## 95 percent confidence interval:
## 3.787442 6.471049
## sample estimates:
## mean in group Precinct 12 mean in group Precinct 8
## 14.27925 9.15000
For analysis three, 2018 and 2023 differed because the p-value is 0.00338. The response times in 2023 were larger.
if (!require("tidyverse"))
install.packages("tidyverse")
library(tidyverse)
mydata <- read.csv("https://raw.githubusercontent.com/drkblake/Data/main/Weekly18and23.csv")
mydata$V1 <- mydata$Minutes_2018
mydata$V2 <- mydata$Minutes_2023
mydata$PairDifferences <- mydata$V2 - mydata$V1
mydata %>%
select(PairDifferences) %>%
summarise(
count = n(),
mean = mean(PairDifferences, na.rm = TRUE),
sd = sd(PairDifferences, na.rm = TRUE),
min = min(PairDifferences, na.rm = TRUE),
max = max(PairDifferences, na.rm = TRUE))
## count mean sd min max
## 1 52 4.75 9.017206 -15.3 26.8
mydata %>%
select(V1, V2) %>%
summarise_all(list(Mean = mean, SD = sd))
## V1_Mean V2_Mean V1_SD V2_SD
## 1 8.763462 13.51346 5.951867 5.998203
options(scipen = 999)
t.test(mydata$V2, mydata$V1,
paired = TRUE)
##
## Paired t-test
##
## data: mydata$V2 and mydata$V1
## t = 3.7986, df = 51, p-value = 0.0003888
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
## 2.239594 7.260406
## sample estimates:
## mean difference
## 4.75