MeansComparison: MeansComparison

Description Usage Arguments Value Author(s) Examples

View source: R/lsmeans.r

Description

It tests the equality of two means.

Usage

1
MeansComparison(MeanLabel1, MeanLabel2, Mmatrix, myModel, myDF = 0)

Arguments

MeanLabel1

String identifying a level of a factor or a combination of levels of interacting factors. The factors involved had to be declared in the model formula. Let suppose that the model formula is Y~FactorA+FactorB+FactorA:FactorB+CovariableX, if FactorA has three levels A1,A2 and A3, FactorB has two level B1 and B2, examples of admissible calls are:

MeansComparison("FactorAA1","FactorAA3", Mmatrix, myModel,myDF) MeansComparison("FactorBB1","FactorBB2", Mmatrix, myModel,myDF) MeansComparison("FactorAA1:FactorBB1","FactorAA1:FactorBB2", Mmatrix, myModel,myDF)

MeanLabel2

See MeanLabel2

Mmatrix

A matrix returned by CalculateMmatrix(myModel,myData)

myModel

An object of class lm, gls, mle, glm, mer, lmerMod or glmerMod

myDF

It represents the degree of freedom of the appropriate error term for the comparison. These degrees of freedom can be obtained from tha anova table. The function that performs a test is similar to a T-test. If myDF is not specified or set to zero it uses the anova function for a linear combination of the parameter.

Value

Returns the p-value for the comparison of the means of two levels of Treatment.

Author(s)

Julio A. Di Rienzo

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(nlme)
library(lme4)
library(lsmeans)
Oats[,"nitro"]=as.factor(Oats[,"nitro"])

myModel<-lme(yield~1+Variety+nitro+Variety:nitro,random =~1|Block/Variety,,method="REML",data=Oats)
anova(myModel)
Mmatrix=CalculateMmatrix(myModel,Oats)
MeansComparison("VarietyVictory:nitro0.6","VarietyVictory:nitro0.4",Mmatrix,myModel,myDF=10)
MeansComparison("VarietyVictory:nitro0.6","VarietyMarvellous:nitro0.4",Mmatrix,myModel,myDF=45)

lsmeans documentation built on May 2, 2019, 6:15 p.m.