[R-sig-eco] Question about GLM post hoc and chi square (Angel)

Bob O'Hara bohara at senckenberg.de
Mon Jun 16 09:51:44 CEST 2014


On 16/06/14 08:49, Åström, Jens wrote:
> Hi,
>
> Adding to what's already been said:
>
>
> Just in case you're not aware of this, I think you have a typo in your model. Are you looking for glm(Count~Sex+Time+Behaviour+Sex*Time+Sex*Behaviour+Time*Behaviour,family=poisson)? By the way, I think this could also be written  glm(Count~Sex+Time+Behaviour+Sex:Time+Sex:Behaviour+Time:Behaviour,family=poisson) or simply glm(Count~+Sex*Time+Sex*Behaviour+Time*Behaviour,family=poisson). The "*" means both main effects and all possible interactions.
FWIW, glm(Count~(Sex +Time+Behaviour)^2,family=poisson) will also work: 
it expands to the main effects and first order interactions.

(oh, and the advice I've seen is don't use Wald tests: they are 
conservative because they assume the other parameters are fixed at their 
MLEs, so ignore any uncertainty in them. Use likelihood ratio tests instead)

Bob

> Also, you should probably look into the issue of overdispersion. Overdispersion is very common in ecological count data and basically means that you have more variation in your data than the Poisson distribution assumes. This typically leads to anti-consevative p-values, i.e. too small p-values, and needs to be accounted for.
>
> Read more about it and potential solutions here: http://glmm.wikidot.com/faq
>
> Good luck,
>
> Jens
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Sat, 14 Jun 2014 18:55:44 -0700 (PDT)
> From: Angel <alexander.angeloski at hotmail.com>
> To: r-sig-ecology at r-project.org
> Subject: Re: [R-sig-eco] Question about GLM post hoc and chi square
> Message-ID: <BLU174-W408EBBB0F91199F57E4D90F2170 at phx.gbl>
> Content-Type: text/plain
>
> You are able to obtain Chi squared values by using a wald chi square post hoc test. To do this you can use the aod package, function wald.test. This function is perfect for generalised linear models using poisson distribution.
>
>
> Also, as long as you have got
> interaction terms in your results from GLM, you could get the wald chi square (and an associated p-value) for these terms, hence giving you the  table which you are after.
>
> If this response is not clear enough, I can post some example (I am not sure of the etiquette)
>
> AA.
>
> Date: Fri, 13 Jun 2014 18:07:27 -0700
> From: ml-node+s471788n7578944h7 at n2.nabble.com
> To: alexander.angeloski at hotmail.com
> Subject: Question about GLM post hoc and chi square
>
>
>
> 	Dear all,
>
>
> I am making an analysis using a GLM using three explanatory variables and a
>
> response variable. I need to obtain a table similar to this one,
>
> http://postimg.org/image/5sau79wlt/r
>
>   nevertheless, I have not been able to do it. I am having a hard time
>
> specially getting the chi square values. I would like to know how to obatin
>
> them.
>
>
> I also would like to know what function could help me to make ad hoc
>
> comparisons for single variables and interactions.
>
>
> If any of you knows how to do both estimations, I would really appreciate
>
> it.
>
>
> All the best!!!
>
>
> This is my script
>
> a=read.table("ricis3.txt",header=T)
>
> attach(a)
>
> model7=glm(Count~Sex+Time+Behaviour+Sex*Time+Sex*Behaviour+Time+Behaviour*Sex,family=poisson)
>
> summary(model7)
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


-- 

Bob O'Hara

Biodiversity and Climate Research Centre
Senckenberganlage 25
D-60325 Frankfurt am Main,
Germany

Tel: +49 69 7542 1863
Mobile: +49 1515 888 5440
WWW:   http://www.bik-f.de/root/index.php?page_id=219
Blog: http://blogs.nature.com/boboh
Journal of Negative Results - EEB: www.jnr-eeb.org



More information about the R-sig-ecology mailing list