[R-sig-ME] MCMCglmm Poisson with an offset term and splines

Jarrod Hadfield j.hadfield at ed.ac.uk
Fri Sep 22 06:55:02 CEST 2017


The model looks OK as far as can be assessed without knowing the data. 
For the offset term you need to hold the associated coefficient at 1 by 
placing a strong prior on it. If  you want everything else to have the 
default prior then use:

k<-11 # number of fixed effects

prior<-list(B=list(V=diag(k)*1e8, mu=rep(0,k)),
             R=list(V=1, nu=0),
             G=list(G1=list(V=1, nu=0),
                    G2=list(V=1, nu=0),
                    G3=list(V=1, nu=0)))

prior$mu[k]<-1 # assuming the offset term is last

The interpretation of the offset is simply the coefficient is assumed to 
be one and that the rate at which events occur is constant.



On 22/09/2017 01:52, dani wrote:
> Hello everyone,
> I have a Poisson model with an offset term that involves repeated observations nested into two cross-classified groups.
> The model includes
> - four categorical variables
> - 6 continuous variables (for one of them I would like to include a smoother)
> - the offset=log(duration)
> I first used the spl2 function to create the fixed ((x6numspline1) and random terms (x6numspline2) for the smoother. I added the random smoother term to the other two random intercepts (for student ID and classroom) that I have (which are cross-classified).
> My question is: Do you find my model sound? Before I study the priors, I just wanted to run a default model - is my inclusion of an offset ok? Also, given that the observations are repeated and nested into both Student ID and classroom, I am not sure how to specify the variance structure in MCMCglmm (beginner here:))
> mc_spl0 <- MCMCglmm(number_events ~ x1cat+x2cat+x8cat+x9cat+x3num+x4num+x5num+x6numspline1+x7num+x8num+log(duration),
>                      random =~ ID+class+idv(x6numspline2),
>                      data   = newdat,
>                      family = "poisson",
>                      thin   = 100,
>                      burnin = 10000,
>                      nitt   = 150000,
>                      saveX=TRUE, saveZ=TRUE, saveXL=TRUE, pr=TRUE, pl=TRUE)
> In addition, I am not sure what to make of the results for the offset term (included as a covariate in the model) in the output - how should I discuss them?
> Thank you all so much!
> Best regards,
> N-M.
> <http://aka.ms/weboutlook>
> 	[[alternative HTML version deleted]]
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

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