Re: [R] glht with a glm using a Gamma distribution

From: jebyrnes <jebyrnes_at_ucdavis.edu>
Date: Tue, 15 Apr 2008 13:50:31 -0700 (PDT)

To reply, in case anyone reads this, the problem was of course in the setup of the matrix, and there are two possible solutions.

The first, for a model with only a single set of groupings, is to use mcp. So, even with this contrast matrix

contra<-rbind("A v. B" = c(-1,1,0,0),

                      "A v. C" = c(-1,0,1,0),
                      "A v. D" = c(-1,0,0,1))

The following will produce the desired analysis:

summary(glht(a.glm, linfct=mcp(trt=contra)))

If one wants to use the coefficients, however, one would need something like as follows
contrb<-rbind("A v. B" = c(0,1,0,0),

			"A v. C" = c(0,0,1,0),
			"A v. D" = c(0,0,0,1))

Note, that coefficients are important in the case of factorial designs (e.g. if there was a block and block:trt effect included in the model). In this case, one needs to look at the coefficients and setup the appropriate contrast as on contr.

At least, I think so. I have not yet found a way to use mcp for factorial designs. Does one exist?

-Jarrett

jebyrnes wrote:
>
> Quick question about the usage of glht. I'm working with a data set
> from an experiment where the response is bounded at 0 whose variance
> increases with the mean, and is continuous. A Gamma error
> distribution with a log link seemed like the logical choice, and so
> I've modeled it as such.
>
> I'm guessing I'm just using glht improperly, but, any help would be
> appreciated!
>
> trt<-c("d", "b", "c", "a", "a", "d", "b", "c", "c", "d", "b", "a")
> trt<-as.factor(trt)
>
> resp<-c(0.432368576, 0.265148862, 0.140761439, 0.218506998,
> 0.105017007, 0.140137615, 0.205552589, 0.081970097, 0.24352179,
> 0.158875904, 0.150195422, 0.187526698)
>
> #take a gander at the lack of differences
> boxplot(resp ~ trt)
>
> #model it
> a.glm<-glm(resp ~ trt, family=Gamma(link="log"))
>
> summary(a.glm)
>
> #set up the contrast matrix
> contra<-rbind("A v. B" = c(-1,1,0,0),
> "A v. C" = c(-1,0,1,0),
> "A v. D" = c(-1,0,0,1))
> library(multcomp)
> summary(glht(a.glm, linfct=contra))
> ---
> Yields:
>
> Linear Hypotheses:
> Estimate Std. Error z value p value
> A v. B == 0 1.9646 0.6201 3.168 0.00314 **
> A v. C == 0 1.6782 0.6201 2.706 0.01545 *
> A v. D == 0 2.1284 0.6201 3.433 0.00137 **
> ---
> Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
> (Adjusted p values reported)
>
>
>

-- 
View this message in context: http://www.nabble.com/glht-with-a-glm-using-a-Gamma-distribution-tp16694729p16709118.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Tue 15 Apr 2008 - 20:53:01 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 15 Apr 2008 - 21:30:53 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive