# Generic function se.contrast(object, ...) ## S3 method for class 'aov': se.contrast(object, contrast.obj, coef = contr.helmert(ncol(contrast))[, 1L], data = NULL, ...) ## S3 method for class 'aovlist': se.contrast(object, contrast.obj, coef = contr.helmert(ncol(contrast))[, 1L], data = NULL, ...)
object | an object of class "aov", "aovlist", or an object that inherits from one of these classes. |
contrast.obj | an object that determines the contrasts. The contrasts can be specified as either a list together with coefficients or a matrix. A single contrast is specified by a list of logical vectors that indicate the cell means to use in the contrast. The coef vector specifies the contrast between the cell means. Multiple contrasts are specified in a matrix where each column of the matrix defines a contrast. |
coef | an expression that defines the contrast between the cell means specified by contrast.obj when it is a list. The coef values must sum to zero and have the same length as contrast.obj. The default value gives the standard error of the difference between the first and second cell means specified by contrast.obj (i.e., the first helmert contrast). |
data | data frame in which to fit object. This is an optional argument. |
... | other optional arguments pass to or from the function. |
# "gun" is a dataset from the package Sdatasets. gun.aov <- aov(Rounds ~ Method + Physique/Team, data = Sdatasets::gun) se.contrast(gun.aov, list(Team == "T1" & Physique == "S", Team == "T2" & Physique == "S"), data = Sdatasets::gun)# For all pairwise contrasts between Physiques: PhysiqueS <- with(Sdatasets::gun, (Physique == "S")/sum(Physique == "S")) PhysiqueA <- with(Sdatasets::gun, (Physique == "A")/sum(Physique == "A")) PhysiqueH <- with(Sdatasets::gun, (Physique == "H")/sum(Physique == "H")) cont <- cbind(PhysiqueS - PhysiqueA, PhysiqueS - PhysiqueH, PhysiqueA - PhysiqueH) dimnames(cont)[[2]] <- paste(c("S", "S", "A"), "and", c("A", "H", "H")) se.contrast(gun.aov, contrast = cont)