Hi Nathalie,
depending on the hypotheses you want to test, you can set the contrasts
either by using
options(contrasts=c("unordered contrasts","ordered
contrasts")) (see
?contrast for the possible choices)
or you can specify the contrasts in the glm function itself (contrasts
argument)
If you want to construct your own contrasts, you can use model.matrix, eg:
cycle.shape <- factor(rep(1:3,10),levels=c(1,2,3),ordered=T)
efficiency <- rpois(30,5)
freq <- rbinom(30,15,0.5)
cont <- matrix(ncol=2,nrow=3,c(-2,1,1,0,1,-1))
modmatrix <-
model.matrix(~cycle.shape*freq,contrasts=list(cycle.shape=cont))
m15<-glm(efficiency~modmatrix-1, family=quasipoisson)
summary(m15)
The -1 in the glm formula is necessary as the model.matrix function includes
a column for the intercept. Alternatively, you just drop the first column of
the model matrix.
cheers
Joris
On Fri, May 7, 2010 at 11:15 AM, Natalie Holt <fbsnch@leeds.ac.uk> wrote:
> Hi,
>
> I have some data on the effect of cycle shape (categorical) and frequency
> (continuous) on the efficiency of muscle contraction. My minimum adequate
> model is:
>
> m15<-glm(efficiency~cycle.shape*freq, family=quasipoisson)
>
>
> However, I wish to know where significant differences lie between specific
> combinations of treatments. I guess I want an equivalent of a post hoc test
> following an ANOVA. Is there a way of doing this for 2 explanatory
variables
> with an interaction between them and the above error structure.
>
> Mnay thanks,
>
> Natalie
>
> ______________________________________________
> R-help@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.
>
--
Joris Meys
Statistical Consultant
Ghent University
Faculty of Bioscience Engineering
Department of Applied mathematics, biometrics and process control
Coupure Links 653
B-9000 Gent
tel : +32 9 264 59 87
Joris.Meys@Ugent.be
-------------------------------
Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php
[[alternative HTML version deleted]]