pf(5.81, 3, 17,lower.tail=FALSE)
## [1] 0.006360579
pf(5.81, 5, 13,lower.tail=FALSE)
## [1] 0.004933094
pf(4.87, 4, 21,lower.tail=FALSE)
## [1] 0.006155146
SS_t <- 196.04
SS_f <- 36.15
SS_e <- SS_t - SS_f
DF_t <- 19
DF_f <- 3
DF_e <- DF_t - DF_f
MS_f <- SS_f / DF_f
MS_e <- SS_e / DF_e
F <- MS_f / MS_e
P <- pf(F, DF_f, DF_e, lower.tail = FALSE)
# missing values
SS_e
## [1] 159.89
DF_e
## [1] 16
MS_f
## [1] 12.05
MS_e
## [1] 9.993125
F
## [1] 1.205829
P
## [1] 0.3395233
SS_t2 <- 1174.24
SS_e2 <- 186.53
SS_f2 <- SS_t2 - SS_e2
DF_t2 <- 29
DF_e2 <- 25
DF_f2 <- DF_t2 - DF_e2
MS_f2 <- 246.93
MS_e2 <- SS_e2 / DF_e2
F2 <- MS_f2 / MS_e2
P2 <- pf(F2, DF_f2, DF_e2,lower.tail=FALSE)
# missing values
SS_f2
## [1] 987.71
DF_f2
## [1] 4
MS_e2
## [1] 7.4612
F2
## [1] 33.09521
P2
## [1] 1.184655e-09
Is this study really a designed experiment? Does it establish a cause-and-effectlink between chocolate consumption and depression? How would the study have to be conducted to establish such a cause-and-effect link?
sham <- c(4.51,7.95,4.97,3.00,7.97,2.23,3.95,5.64,9.45,6.52,4.96,6.10,7019,4.03,2.72,9.19,5.17,5.70,5.85,6.45)
PEMF1 <- c(5.32,6.00,5.12,7.08,5.48,6.52,4.09,6.28,7.77,5.68,8.47,4.58,4.11,5.72,5.91,6.89,6.99,4.98,9.94,6.38)
PEMF2 <- c(4.73,5.81,5.69,3.86,4.06,6.56,8.34,3.01,6.71,6.51,1.70,5.89,6.55,5.34,5.88,7.50,3.28,5.38,7.30,5.46)
PEMF4 <- c(7.03,4.65,6.65,5049,6.98,4.85,7.26,5.92,5.58,7.91,4.90,4.54,8.18,5.42,6.03,7.04,5.17,7.60,7.90,7.91)
PEMF <- data.frame(cbind(PEMF1,PEMF2,PEMF4))
stack <- stack(PEMF)
# aov(PEMF~sham, data= stack) I could not get the ANOVA function to work
mt <- c(1,2,3,4)
ts1 <- c(3129, 3000, 2865, 2890)
ts2 <- c(3200, 3300, 2975, 3150)
ts3 <- c(2800, 2900, 2985, 3050)
ts4 <- c(2600, 2700, 3600, 2765)
ts <-data.frame(cbind(ts1,ts2,ts3,ts4))
stacked <- stack(ts)
# aov(ts~mt,data=stacked) I could not get the ANOVA function to work
Conclusion:
dosage <- c(20,30,40)
ob20 <- c(24,28,37,30)
ob30 <- c(37,44,31,35)
ob40 <- c(42,47,52,38)
ob <- data.frame(cbind(ob20,ob30,ob40))
stacked2 <-stack(ob)
# aov(ob~dosage, data=stacked2) I could not get the ANOVA function to work
car <- c("subcompact", "Compat", "Midsize", "Full size")
sub <- c(3,5,3,7,6,5,3,2,1,6)
comp<- c(1,3,4,7,5,6,3,2,1,7)
mid <- c(4,1,3,5,7,1,2,4,2,7)
full<- c(3,5,7,5,10,3,4,7,2,7)
observe <- data.frame(cbind(sub,comp,mid,full))
stack2 <- stack(observe)
# aov(observe~car, data= stack2) I could not get the ANOVA function to work
\(\sum_{1}^N (Y_{ij} - \bar{Y_{..}})^2\) => \(\sum_{1}^N Y_{ij}^2 - 2\bar{Y_{..}}\sum_{0}^n Y_{ij} + N\bar{Y_{..}}^2\) => \(\sum_{1}^N Y_{ij}^2 - 2\bar{Y_{..}}N\bar{Y_{..}} + N\bar{Y_{..}}^2\) => \(\sum_{1}^N Y_{ij}^2 - N\bar{Y_{..}}^2\) => \(\sum_{i=0}^I Y_{ij}^2 - \frac{\bar{Y_{..}}^2}{N}\)