[R-sig-ME] mcmcsamp with Poisson distribution

Ben Bolker bbolker at gmail.com
Sun Sep 9 23:03:50 CEST 2012


Nate Fronk <nrf5017 at ...> writes:

> I am using a Before-After Control-Impact study
> design to look at the effect of natural gas activity on bird species.The
> interaction in my equation tests for the effect of well pads being placed in
> the forest. 

 [snip]

> I'm aware I
> could take the Bayesian route but I just wanted to see if there may be some
> code out there somewhere to get around this. Below is an example of what my
> data looks like and my code. Any input would be greatly appreciated. 
> 
> Block    Pads  Time  Abundance    
> 34B25    2      1    8    

[snip]

> 35C74    4      1   15    
> 
> Revi <- read.table("revibaci2.txt", header = TRUE)
> library(lme4)

The following should both be unnecessary, although they don't hurt ...

> Revi$Block<-as.factor(Revi$Block)  
> Revi$Pads<-as.numeric(Revi$Pads)
 
> mm1<-lmer(Abundance~Pads*Time+(1|Block),family=poisson,data=Revi)

  mcmcsamp has never (as far as I know) worked for GLMMs (i.e.
family not equal to the default "gaussian")

> mms1<- mcmcsamp(mm1,1000)
> HPDinterval(mcmcsamp(mm1,n=1000))

  An alternative to try:

library(glmmADMB)

mm2 <- glmmadmb(Abundance~Pads*Time+(1|Block),
       family="poisson",data=Revi,mcmc=TRUE)



More information about the R-sig-mixed-models mailing list