R Programming only! R Programming only! (Please check the code can run correctly, in the previous one,
Question:
R Programming only!
R Programming only!
(Please check the code can run correctly, in the previous one, I got the p-value as 0, which is not correct and didn't show the same as the previous answer you posted)
library(tidyverse) library(scidesignR) library(emmeans)
data("painstudy")
SST <- function(y) { sum((y - mean(y)) ^ 2) }
SSTreat <- function(y, groups, n) { sst <- unlist(lapply(split(y, groups), function(x) { (mean(x) - mean(y)) ^ 2 })) return(n * sum(sst)) }
SSe <- function(y, groups) { sum(unlist(lapply(split(y, groups), function(x) { (x - mean(x)) ^ 2 }))) }
\begin{tabular}{lccc} trt & \( \mathrm{N} \) & Mean & SD \\ \hline A & 50 & 6.20 & 1.34 \\ \hline B & 50 & 7.32 & 1.15 \\ \h Verify the ANOVA identity with using the functions and data above.