[R] Help with glm and glht for analysing count data

Mary Crossland marycrossland at gmail.com
Tue Nov 4 15:37:13 CET 2014


Dear all,


I’d like some help with analysing some count data. I am very new to R (and
statistical analysis for that matter!) and have done my best to work it out
on my own … but seemed to have got stuck!


I am looking at the effects of cutting hedges on invertebrates (I’m not
that interested in the difference of inverts collected on the east side of
a hedge compared to the west)

The experimental design consists of paired cut and uncut plots established
in 3 different hedgerow types. Invertebrate counts were taken from each
plot (6 plots overall) four times over 4 weeks.


  Plot

Cut state

Orientation

No. inverts







Week 1

Week 2

Week 3

Blackthorn



Cut

East







Cut

West







Uncut

East







Uncut

West







Hawthorn

Cut

East







Cut

West







Uncut

East







Uncut

West







Hazel

Cut

East







Cut

West







Uncut

East







Uncut

West







Table 1. Example of data.


The data was very skewed and contained a fair few zero counts. I therefore
decided to use glm.


##I first started with a saturated model##

model1<-glm(Inverts~Plot*Cut.Uncut*orientation,quasipoisson)

##Three way interactions are removed##

model2<-update(model1,~.-Plot:Cut.Uncut:orientation)

##anova tests whether the three way interaction is significant or not##

anova(model1,model2,test="Chi")

##I continued to strip down the model##

model3<-update(model2,~.-Plot:Cut.Uncut)

anova(model3,model2,test="Chi")

model4<-update(model2,~.-Plot:orientation)

anova(model4,model2,test="Chi")

## I then looked to see whether just plot had an effect##

model5<-update(model3,~.-Plot:orientation)

model6<-update(model5,~.-Plot)

anova(model6,model5,test="Chi")



Plot was found to be significant. I then wanted to know where this was
coming from so looked at the glht function….


Summary(glht(model5,mcp(Plot=”Tukey”)))


This showed Blackthorn to be significantly different to the other two
hedges which looking at a box plot seems about right. However if an
interaction between Plot and Cut.Uncut variables was found how would I
explore this further? The glht with Tukey specified seems to only work with
one variable?


Apologies if my explanation is poor, I would be more than happy to give you
more information if it would help.


I’m not sure if anything I’ve done if right or even if I’m on the right
lines…

Any help would be fantastic!


Many thanks,

Mary

	[[alternative HTML version deleted]]



More information about the R-help mailing list