Steps in one-factor ANOVA:
1. State the null and alternative hypothesis:
yourownfunctionwith2inputs Y
Defines vectorofallobservations
numeric
number
grandmean asingle
elementwised
grandmean number
Yetgetfsame from each
squares
returnthecalculatednumber
anddefineswhat
2.
9elgyafmteuannt.ge
Compute the test statistic:
Roundsto 3decimal
places
To do this, several sub-steps need to be followed first:
1..Load & look at the data: Sst cn ixs
ofrows 1 variance
sample
yourownfunctionwith3inputs
Defines
ec ofnivector
ofgroupsamplesizes
distanceofeach
squared group fromthegrandmean
mean igtgitgiEr.means
jiingiieaend.is
7 889ie 8Fm'e9nds fiEnsmEaItare
RoundsSSBto 3decimalplaces
Notice that this dataset is in a “wide” format. Sometimes we want to store data in
a “long” (“narrow”) format. We can use the reshape2 package to do this:
yourownfunctionwith2inputs
Defines
see.eeorssessaimsiesbs
398GEYeEead9feswhat
RoundsSSWto 3decimalplaces
, Notice that the factor names are shortened, so we need to change this:
2. Compute sample statistics to describe the data:
Sample sizes & total sample size:
Group means & grand mean:
Totalvariance Is o freedom
degrees
meansquaretotal
1. State the null and alternative hypothesis:
yourownfunctionwith2inputs Y
Defines vectorofallobservations
numeric
number
grandmean asingle
elementwised
grandmean number
Yetgetfsame from each
squares
returnthecalculatednumber
anddefineswhat
2.
9elgyafmteuannt.ge
Compute the test statistic:
Roundsto 3decimal
places
To do this, several sub-steps need to be followed first:
1..Load & look at the data: Sst cn ixs
ofrows 1 variance
sample
yourownfunctionwith3inputs
Defines
ec ofnivector
ofgroupsamplesizes
distanceofeach
squared group fromthegrandmean
mean igtgitgiEr.means
jiingiieaend.is
7 889ie 8Fm'e9nds fiEnsmEaItare
RoundsSSBto 3decimalplaces
Notice that this dataset is in a “wide” format. Sometimes we want to store data in
a “long” (“narrow”) format. We can use the reshape2 package to do this:
yourownfunctionwith2inputs
Defines
see.eeorssessaimsiesbs
398GEYeEead9feswhat
RoundsSSWto 3decimalplaces
, Notice that the factor names are shortened, so we need to change this:
2. Compute sample statistics to describe the data:
Sample sizes & total sample size:
Group means & grand mean:
Totalvariance Is o freedom
degrees
meansquaretotal