Last chance! 50% off unlimited learning
Sale ends in
av
, av.brief
Analysis of variance with graphics.
Can also be called from the more general model
function.
ANOVA(my.formula, dframe=mydata,
brief=FALSE, digits.d=4, ...)av(my.formula, ...)
av.brief(my.formula, brief=TRUE, ...)
formula
for specifying a model. For
example, for a response variable named Y and two predictor variables, X1 and
X2, specify the corresponding linear model as Y ~ X1 + X2.mydata
, otherwise explicitly specify.lm
which provides the core computations.aov
, TukeyHSD
, and provides summary statistics for each level. Two-factor ANOVA also provides an interaction plot of the means with interaction.plot
as well as a table of means and other summary statistics.aov
, TukeyHSD
, interaction.plot
# create simulated data, no population mean difference
# X has two values only, Y is numeric
# put into a data frame
n <- 12
X <- sample(c("Group1","Group2"), size=n, replace=TRUE)
Y <- rnorm(n=n, mean=50, sd=10)
mydata <- data.frame(X,Y)
# analyze data with formula version
# variable names and levels of X are automatically obtained from data
# although data frame not attached, reference variable names directly
ANOVA(Y ~ X)
# short name
av(Y ~ X)
# variable of interest is in a data frame which is not the default mydata
# access the data frame in the lessR dat.twogroup data set
# although data not attached, access the variables directly by their name
data(datTwoGroup)
ANOVA(ShipTime ~ Supplier, dframe=datTwoGroup)
# two-factor ANOVA with replications and interaction
ANOVA(breaks ~ wool * tension, dframe=warpbreaks)
Run the code above in your browser using DataLab