MeanAndVariance: MeanAndVariance

Description Usage Arguments Value Author(s) Examples

View source: R/lsmeans.r

Description

Returns a vector containing the mean, the variance and the coefficients needed to combine the model's parameters to obtain the required mean and variance.

Usage

1
MeanAndVariance(MeanLabel, Mmatrix, myModel)

Arguments

MeanLabel

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:

MeanAndVariance("FactorAA1", Mmatrix, myModel) MeanAndVariance("FactorBB1", Mmatrix, myModel) MeanAndVariance("FactorAA1:FactorBB1", Mmatrix, myModel)

Mmatrix

A matrix returned by CalculateMmatrix(myModel,myData)

myModel

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

Value

A vector containing the mean, the variance and a the coefficients needed to combine the model's parameters to obtain the required mean and variance

Author(s)

Julio A. Di Rienzo <email: dirienzo@agro.unc.edu.ar>

Examples

1
2
3
4
5
6
7
8
9
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)
Mmatrix=CalculateMmatrix(myModel,Oats)
MeanAndVariance("VarietyVictory", Mmatrix,myModel)
MeanAndVariance("VarietyVictory:nitro0.6", Mmatrix,myModel)

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