aov.ibd: Analysis of Variance, Estimated Marginal Means and Contrast...

View source: R/ibd.R

aov.ibdR Documentation

Analysis of Variance, Estimated Marginal Means and Contrast Analysis of Data from An Incomplete Block Design

Description

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).

Usage

aov.ibd(formula,specs,data,contrast,joint=FALSE,details=FALSE,sort=TRUE,by=NULL,
alpha=0.05,Letters = "ABCDEFGHIJ",...)

Arguments

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

Details

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.

Value

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

Author(s)

Baidya Nath Mandal <mandal.stat@gmail.com>

Examples

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)

ibd documentation built on May 29, 2024, 12:11 p.m.

Related to aov.ibd in ibd...