# ANOVA pt.3

attach(diett)

R code: model(DependentV~IndependentV)
-Error in the model includes both individual differences
AND other factors we didn't include AND measurement error.

-Reporting ANOVA results F(3, 244) = 2.8255

model <- aov(WeightChange~Diet)
par(mfrow=c(2,2))
plot(model)
summary(model)
Df Sum Sq Mean Sq F value Pr(>F)
Diet 3 1801 600 2.8255 0.03931 *
Residuals 244 51840 212
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
NOTE: -If you have ordinal data, you have to create catigories out of it to use the ANOVA analysis.
library(MBESS)
F2Rsquare(2.8255,3,244)
[1] 0.03357342

-F2Rsquare(Fvalue,df numerator, df denominator)
omega-squared = SumOfSquares-betweengroups - (K-1)MS-withingroups/SumofSquares-total + MS-withingroups
R-squared or Eta-hat-squared = SumOfSquares-treatment/SS-total

## Fixed Effects v. Random Effects v. Mixed Effects Model

-if I randomly selected my test treatments from the total population of all treatments then I could draw my conclusions back to ALL TREATMENTS
-This is a Random Effects Model
-We have been using a Fixed Effects Model

## Confidence Interval

Eta-sqrd

ci.R2(R2=Eta-squrd,df.1,df.2,conf.level)

ci.R2(R2=.3357342,df.1=3,df.2=244,conf.level=.95)
\$Lower.Conf.Limit.R2
[1] 0.2336431

\$Prob.Less.Lower
[1] 0.025

\$Upper.Conf.Limit.R2
[1] 0.4253084

\$Prob.Greater.Upper
[1] 0.025

ci.R2(R2=.03357342,df.1=3,df.2=244,conf.level=.95)
\$Lower.Conf.Limit.R2
[1] 0

\$Prob.Less.Lower
[1] 0.025

\$Upper.Conf.Limit.R2
[1] 0.08072746

\$Prob.Greater.Upper
[1] 0.025