aov.ibd | R Documentation |
Performs intrablock analysis of variance of data from experiments using a block design. It also computes estimated marginal means of the factor variables (e.g. treatments) and optionally estimates and tests the contrasts of factor variables (e.g treatments).
aov.ibd(formula,specs,data,contrast,joint=FALSE,details=FALSE,sort=TRUE,by=NULL,
alpha=0.05,Letters = "ABCDEFGHIJ",...)
formula |
A formula specifying the model of the form response~treatment+block or response~block+treatment. Make sure the treatment and blocks are factor variables. |
specs |
A character vector specifying the names of the factors over which estimated marginal means are desired |
data |
A data frame in which the variables specified in the formula will be found. If missing, the variables are searched for in the standard way. |
contrast |
A matrix whose rows are contrasts of factors (e.g. treatments) |
joint |
If contrast argument has more than one row, then whether a joint test of the contrasts will be performed. Default is FALSE. If joint=TRUE, a check is performed whether the contrasts are pairwise orthogonal or not and then if orthoghonal, joint test is performed. |
details |
Logical, if details=TRUE then all objects including lm object from lm(), emmGrid object from emmeans() are returned. Default is FALSE. |
sort |
Logical value determining whether the least square means are sorted before the comparisons are produced. Default is TRUE. |
by |
Character value giving the name or names of variables by which separate families of comparisons are tested. If NULL, all means are compared. |
alpha |
Numeric value giving the significance level for the comparisons |
Letters |
Characters to be used for compact letter display of groups of factor variables over which least square means are computed. Default is english alphabet capital letters "ABCDEFGHIJ" |
... |
Not used |
The function makes use of lm() function in R and Anova() function in car package with specification of Type III sum of squares and emmeans(), contrast() functions in emmeans() package, cld() function in multcomp package and combines the results in a single place.
Returns a list with following components
lm.obj |
An object of class lm if details=TRUE |
ANOVA.table |
ANOVA table from the fitted lm object |
EMMEANS |
Estimated marginal means means with compact letter display |
contrast.analysis |
Contrast analysis result if contrast matrix was supplied |
Baidya Nath Mandal <mandal.stat@gmail.com>
data(ibddata)
aov.ibd(y~factor(trt)+factor(blk),data=ibddata)
contrast=matrix(c(1,-1,0,0,0,0,0,0,0,0,0,1,-1,0,0,0,0,0),nrow=2,byrow=TRUE)
aov.ibd(y~factor(trt)+factor(blk),specs="trt",data=ibddata,contrast=contrast)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.