[R-sig-ME] lme4 observation level effects with indicator

Thierry Onkelinx thierry.onkelinx at inbo.be
Tue Apr 5 09:17:50 CEST 2016


Dear Tiffany,

You could try to make dummy variables for each level of period.
dat$PrePeriod <- as.integer(dat$period == "Pre")
dat$PostPeriod <- as.integer(dat$period == "Post")

mod.pois <- glmer( count ~ 1 + period + year  + year*period +
(period|year.factor) + (period|Site)  + (0 + PrePeriod|Site:year.factor)  +
(0 + PostPeriod|Site:year.factor),
                        data=dat, family=poisson)

Best regards,

ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to say
what the experiment died of. ~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data. ~ Roger Brinner
The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey

2016-04-02 21:23 GMT+02:00 Tiffany Vidal <tiffany.vidal op gmail.com>:

> I am interested in estimating a mixed model with a random effect for year,
> site, and an observation-level effect to account for overdispersion,
> assuming Poisson error structure, using the lme4 package in R.
> Additionally, I have an indicator variable 'period' to adjust the parameter
> estimated by pre- and post- time periods. I am running into problems trying
> to specify the observation level effect by time period. I could model this
> using glmer.nb and avoid the observation-level effect, but I would like the
> flexibility to allow overdispersion to vary by time period as well. If
> there was a way to allow the negative binomial scaling parameter to vary by
> time period, I would probably use glmer.nb.
>
> My model as I'm trying to specify with glmer:
> mod.pois <- glmer( count ~ 1 + period + year  + year*period +
> (period|year.factor) + (period|Site) ,
>                         data=dat, family=poisson)
>
> The above runs and I think does what I want, but doesn't include the
> observation-level effect.
>
> I have tried:
> mod.pois <- glmer( count ~ 1 + period + year  + year*period +
> (period|year.factor) + (period|Site)  + (period|Site:year.factor),
>                         data=dat, family=poisson)
>
> but the error indicates identifiability issues. I have one observation at
> each site x year combination.
>
> Is there a way to achieve this using this package? Thank you in advance for
> any thoughts.
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models op r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>

	[[alternative HTML version deleted]]



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