| add.sig.letters {NCStats} | R Documentation |
Places significance letters next to mean points on an active fit.plot from a one-way or a two-way ANOVA.
add.sig.letters(mdl,lets,which,change.order=FALSE,pos=rep(2,length(mns)),
offset=0.5,col=rep(1,length(mns)),cex=rep(0,length(mns)),
...)
mdl |
A lm object or formula depicting an ANOVA. |
lets |
A vector of characters to be placed next to each group mean point. |
which |
A character string listing terms in the fitted model for which the means should be calculated and the letters placed. |
change.order |
A logical that is used to change the order of the factors in the lm object. This is used to change which factor is plotted on the x-axis and which is used to connect means. Used only with a two-way ANOVA and only if the same argument is used with the fit.plot function. |
pos |
A value or vector of values indicating the positiong to place the characters relative to each group mean point. Note that 1=below, 2=left, 3=above, and 4=right. |
offset |
A value indicating a proportion of character widths to move the character away from each group mean point. |
col |
A single or vector of numeric or character representations of colors used for each character. |
cex |
A single or vector of numeric values used to represent the character expansion values. |
... |
Other arguments to be passed to the text function. |
The graphic of group means must be active for this function to place the characters next to the group mean points. Typically this graphic is made with the fit.plot function.
None. However, an active graphic is modified.
Derek H. Ogle, dogle@northland.edu
data(Mirex)
Mirex$year <- factor(Mirex$year)
attach(Mirex)
## one-way ANOVA
lm1 <- lm(mirex~year)
anova(lm1)
mc1 <- glht(lm1,mcp(year="Tukey"))
summary(mc1)
fit.plot(lm1,n.label=FALSE)
add.sig.letters(lm1,c("a","a","a","a","ab","b"),pos=c(2,2,4,4,4,4))
## two-way ANOVA
lm2 <- lm(mirex~year*species)
anova(lm2)
mc2y <- glht(lm2,mcp(year="Tukey"))
summary(mc2y)
mc2s <- glht(lm2,mcp(species="Tukey"))
summary(mc2s)
par(mfcol=c(1,2))
fit.plot(lm2,which="year",type="b",pch=19)
add.sig.letters(lm2,which="year",c("a","a","a","a","ab","b"),pos=c(3,1,1,1,4,3))
fit.plot(lm2,which="species",type="b",pch=19)
add.sig.letters(lm2,which="species",c("a","b"),pos=c(1,3))
detach(Mirex)