[R-sig-ME] testing linear combinations of coefficients of an MCMCglmm model to be zero

vlagani at ics.forth.gr vlagani at ics.forth.gr
Thu Jun 16 18:37:34 CEST 2011


Dear Listmembers,

I am interested in testing linear combinations of coefficients in a  
MCMCglmm model to be zero. Here an example based on the anova.lme  
function for performing this type of tests:

#loading libraries and data
library(nlme)
data(BodyWeight)

#setting the contrasts
contrasts(BodyWeight$Diet) = contr.sum(3);

#fitting the model
model.nlme = lme(weight ~ Time * Diet, BodyWeight, random = ~ Time);
summary(model.nlme)

#is the coefficient Time:Diet3 equal to zero? Given the contrasts we chose,
#we must calculate and test the quantity -1*(Time:Diet1 + Time:Diet2)
anova(model.nlme, L = c("Time:Diet1" = -1, "Time:Diet2" = -1))

Given my quite limited knowledge about MCMC models, I suppose that a  
similar test can be performed in a MCMC setting as follows:

#loading libraries and data
library(MCMCglmm)
data(BodyWeight, package= 'nlme')
set.seed(1234);

#setting the contrasts
contrasts(BodyWeight$Diet) = contr.sum(3);

#fitting the model
model.mcmc = MCMCglmm(weight ~ Time * Diet, data = BodyWeight, random  
= ~ Time, verbose = FALSE);
summary(model.mcmc)

#is the coefficient Time:Diet3 equal to zero?
HPDinterval(-model.mcmc$Sol[, "Time:Diet1"] - model.mcmc$Sol[,  
"Time:Diet2"], 0.95)

Is this the correct way to test the linear combination of two  
coefficients in a MCMCglmm model?

Please notice that this question is closely related to one my previous post:
http://permalink.gmane.org/gmane.comp.lang.r.lme4.devel/6205

Again, I am trying to understand how to replicate some of the  
functionalities of the nlme package within an MCMC framework.

Thanks in advance,

Vincenzo


-- 
Vincenzo Lagani
Visiting Researcher
BioInformatics Laboratory
Institute of Computer Science
Foundation for Research and Technology - Hellas




More information about the R-sig-mixed-models mailing list