HH (version 2.1-32)

lmatRows: Find the row numbers in the lmat corresponding to the focus factor.

Description

lmatRows finds the row numbers in the lmat (column numbers in the linfct in R) corresponding to the focus factor. See mmc for more information. These are internal functions that the user doesn't see. They are necessary when the design has more than one factor. lmatContrast converts user-specified contrasts of levels of a factor to the full lmat or linfct matrix that carries the information about other factors and their interactions and covariates.

Usage

lmatRows(x, focus)
## S3 method for class 'mmc.multicomp':
lmatRows(x, focus)
## S3 method for class 'multicomp':
lmatRows(x, focus)
## S3 method for class 'glht':
lmatRows(x, focus) ## R only
## S3 method for class 'lm':
lmatRows(x, focus)
lmatContrast(lmat.none, contrast.matrix)

Arguments

x
"lm" or "mmc.multicomp" or "multicomp" or "glht" object.
focus
The name of the term in the ANOVA table for which multiple comparisons are to be constructed.
lmat.none
lmat matrix with the S-Plus multicomp package or t(linfct) matrix with the R multcomp package. In both packages the matrix is the one used for estimating the group means.
contrast.matrix
Matrix of column contrasts for a factor. The columns are the contrasts, the rows are the levels of the factor.

Value

  • For lmatRows, vector of row numbers of the lmat, the matrix of linear contrasts defining the comparisons of interest. For lmatContrast, a linear contrast matrix that follows the conventions of the multiple comparisons package. It has columns for each contrast specified by the input contrast.matrix and rows as needed for the other terms in the model.

Details

The MMC function are based on glht in R and on multicomp in S-Plus. The two packages have different conventions for specifying the linear contrasts. The lmatRows function gives appropriate values in each system.

See Also

mmc,#ifndef S-Plus glht. #endif #ifdef S-Plus multicomp. #endif

Examples

Run this code
## catalystm example
## See ?MMC for more on this example
catalystm <- read.table(hh("datasets/catalystm.dat"), header=FALSE,
                       col.names=c("catalyst","concent"))
catalystm$catalyst <- factor(catalystm$catalyst, labels=c("A","B","C","D"))
catalystm1.aov <- aov(concent ~ catalyst, data=catalystm)

catalystm.mmc <-
  if.R(r=glht.mmc(catalystm1.aov, linfct = mcp(catalyst = "Tukey")),
       s=multicomp.mmc(catalystm1.aov, plot=FALSE))
dimnames(catalystm.mmc$mca$lmat)[[1]]
lmatRows(catalystm1.aov, focus="catalyst")

## user-specified contrasts
catalystm.lmat <- cbind("AB-D" =c( 1, 1, 0,-2),
                        "A-B"  =c( 1,-1, 0, 0),
                        "ABD-C"=c( 1, 1,-3, 1))
dimnames(catalystm.lmat)[[1]] <- levels(catalystm$catalyst)
zapsmall(lmatContrast(catalystm.mmc$none$lmat, catalystm.lmat))

Run the code above in your browser using DataCamp Workspace