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

Bert Gunter gunter.berton at gene.com
Tue Nov 4 18:34:01 CET 2014


It appears that these are primarily statistical issues and, as such,
are somewhat off topic here. I suggest you post on
stats.stackexchange.com instead for statistical help.

Also, if you insist on posting here, post in plain text, not HTML (as
requested by the posting guide, which you would do well to read and
follow).

Cheers,
Bert

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
Clifford Stoll




On Tue, Nov 4, 2014 at 6:37 AM, Mary Crossland <marycrossland at gmail.com> wrote:
> 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]]
>
> ______________________________________________
> 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.



More information about the R-help mailing list