Skip to content
Back to formatted view

Raw Message

Message-ID: <1341935813289-4636009.post@n4.nabble.com>
Date: 2012-07-10T15:56:53Z
From: Ariel
Subject: multiple comparisons with generalised least squares
In-Reply-To: <1338909741362-4632412.post@n4.nabble.com>

racmar wrote
> 
> I have also been searching various forums and books to see if there are
> any methods I could use and have only found people, such as yourself,
> asking the same question. 
> 

I was looking into this recently, as well, and found that the problem has to
do with building the model.matrix/terms/model.frame for gls objects when
using the glht function.  I ended up creating three gls-specific functions
and was able to get estimates/confidence intervals for the toy example
below.   You may find these functions useful (under the caveat that I only
checked that I got estimates and not that the estimates were correct ;) ).

Ariel

Example:
library(nlme)

Orthodont$fage <- factor(Orthodont$age)

#toy example with Orthodont data using age as a factor
fitgls <- gls( distance ~ fage, data=Orthodont, 
	weights = varIdent(form =~1|fage))



library(multcomp)

#notice the error about the model.matrix for gls objects when using glht
confint( glht (fitgls, mcp(fage="Tukey") ))

#create model.frame, terms, and model.matrix functions specifically for gls
objects
model.matrix.gls <- function(object, ...) 
	model.matrix(terms(object), data = getData(object), ...)


model.frame.gls <- function(object, ...) 
	model.frame(formula(object), data = getData(object), ...)


terms.gls <- function(object, ...) 
	terms(model.frame(object),...)


#now run glht again
confint( glht(  fitgls, mcp(fage="Tukey") ))




--
View this message in context: http://r.789695.n4.nabble.com/multiple-comparisons-with-generalised-least-squares-tp3441513p4636009.html
Sent from the R help mailing list archive at Nabble.com.