addSigLetters {NCStats} | R Documentation |

Places significance letters next to mean points on an active `fitPlot`

from a one-way or a two-way ANOVA.

addSigLetters(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 |

`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 |

`pos` |
A value or vector of values indicating the positiong to place the characters relative to each group mean point. Note that |

`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 |

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 `fitPlot`

function.

None. However, an active graphic is modified.

Students are often asked to determine which level means are different if a significant one-way or two-way ANOVA is encountered. The results of these multiple comparisons are often illustrated by placing “significance letters” next to mean points on an interaction of main effects plot. In R this can be accomplished with a number of `text`

calls. This function, however, simplifies this process so that newbie students can create the graphic in an efficient and relatively easy manner (in conjunction with `fitPlot`

). This function thus allows newbie students to interact with and visualize moderately complex linear models in a fairly easy and efficient manner.

if (require(FSA)) { data(Mirex) Mirex$year <- factor(Mirex$year) ## one-way ANOVA lm1 <- lm(mirex~year,data=Mirex) anova(lm1) # suppose multiple comparison results from following ## Not run: mc1 <- multcomp::glht(lm1,mcp(year="Tukey")) summary(mc1) ## End(Not run) fitPlot(lm1,main="") addSigLetters(lm1,c("a","a","a","a","ab","b"),pos=c(2,2,4,4,4,4)) # same example, but using cld() from multcomp ## Not run: ( sl1 <- multcomp::cld(mc1) ) fitPlot(lm1,main="") addSigLetters(lm1,lets=sl1,pos=c(2,2,4,4,4,4)) ## End(Not run) ## two-way ANOVA lm2 <- lm(mirex~year*species,data=Mirex) anova(lm2) # suppose multiple comparison results from following ## Not run: mc2y <- glht(lm2,mcp(year="Tukey")) summary(mc2y) mc2s <- glht(lm2,mcp(species="Tukey")) summary(mc2s) ## End(Not run) op <- par(mfcol=c(1,2)) fitPlot(lm2,which="year",type="b",pch=19,ylim=c(0.05,0.35),main="") addSigLetters(lm2,which="year",c("a","a","a","a","ab","b"),pos=c(2,2,4,4,4,4)) fitPlot(lm2,which="species",type="b",pch=19,ylim=c(0.05,0.35),main="") addSigLetters(lm2,which="species",c("a","a"),pos=c(2,4)) par(op) }

[Package *NCStats* version 0.4.7 Index]