Description Usage Arguments Value Author(s) See Also Examples
Returns the means and their standard errors for each factor or factors combination included in formula argument of the call to lm, gls, mle,lmer or glmer functions.
1 | CalculateMatrixofMeansAndStandardErrors(myModel, myData,myModelTerm, Mmatrix,MissingCells)
|
myModel |
An object of class lm, gls, mle, glm, mer, lmerMod or glmerMod |
myData |
A data frame included in the data argument of the call to the lm, gls, mle, glm, lmer and glmer functions. |
myModelTerm |
myModelTerm is a string identifying the term of the model for which the means and estandar errors are requested. These terms must not contain references to covariables. Only the factors involved in the model formula can be included. Let suppose that the model formula is Y~FactorA+FactorB+FactorA:FactoB +CovariableX, then admissible calls to CalculateMatrixofMeansAndStandardErrors are: CalculateMatrixofMeansAndStandardErrors(myModel, myData,"FactorA",Mmatrix,MissingCells) CalculateMatrixofMeansAndStandardErrors(myModel, myData,"FactorB",Mmatrix,MissingCells) CalculateMatrixofMeansAndStandardErrors(myModel, myData,"FactorA:FactorB",Mmatrix,MissingCells) |
Mmatrix |
A matrix returned by CalculateMmatrix(myModel,myData) function. |
MissingCells |
MissingCells=FALSE. If TRUE it will return, when possible, estimations for means for levels combinations not present in the data set. |
A two columns matrix containing means and their estandard error for the levels of the model term identified by myModelTerm.
Julio A. Di Rienzo <email: dirienzo@agro.unc.edu.ar>
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)
Mmatrix=CalculateMmatrix(myModel,Oats)
CalculateMatrixofMeansAndStandardErrors(myModel,Oats,"Variety",Mmatrix,MissingCells=FALSE)
CalculateMatrixofMeansAndStandardErrors(myModel,Oats,"nitro",Mmatrix,MissingCells=FALSE)
CalculateMatrixofMeansAndStandardErrors(myModel,Oats,"Variety:nitro",Mmatrix,MissingCells=FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.