[R-sig-ME] glmer random effects structure: a case

Malcolm Fairbrother M.Fairbrother at bristol.ac.uk
Sun Nov 15 16:41:28 CET 2015


Dear Simone,
How many INDs and DATEs are in your dataset? It sounds like you have plenty
of INDs, but it's less clear how many DATEs you have. If you have a lot,
you may have a situation of cross-classification: observations are nested
both in INDs and DATEs, but neither of those is nested in the either.
If you don't have many DATEs, it will make more sense to use fixed effects
for those. And even if you have a lot, if the DATEs are located close to
each other in time, you may have a lot of autocorrelation, and that
requires other techniques. (In R, you may need to use the older package
nlme, which allows for correlated residuals.)
In any event, if INDs are in many cases captured on multiple DATEs, it
definitely doesn't make sense to nest INDs in DATEs. Clearly they aren't
nested. (Assuming I've understood your data structure correctly.)
It also sounds like you should be centering Var2 by IND. This is pretty
much de rigueur in multilevel models with x variables that vary within
clusters. Enders and Tofighi 2007 is a useful, clear paper on this issue,
and you might also want to look at these recent papers by me and colleagues
in the Centre for Multilevel Modelling at Bristol:
doi:10.1017/psrm.2014.7
doi:10.1017/psrm.2013.24
Basically, take the mean of Var2 for each individual, and enter that as a
covariate. Then take the difference between the original Var2 and its mean
for that individual, and enter that as a covariate as well. You'll get two
pieces of information in your fitted model: the distinct "between" and
"within" effects of Var2. It sounds like that is what you want.
Hope that's useful.
- Malcolm



Date: Sat, 14 Nov 2015 17:48:46 +0100
> From: Simone <miseno77 at hotmail.com>
> Cc: "r-sig-mixed-models at r-project.org"
>         <r-sig-mixed-models at r-project.org>
> Subject: [R-sig-ME] glmer random effects structure: a case
>
>
> Hi all,
> I have a simple (but not that simple to me) question on how to specify the
> random structure in R.A binary response variable (Var1) has been measured
> from a number of individuals (IND) that have been susceptible of being
> captured over a number of dates (DATE). I suspect that Var1 might depend
> either on its sex (SEX), or age (AGE) or Var2 which is a continuous
> variable measured from each individual every time it is captured. Since
> Var2 is a measure of the quality of each individual, it is likely that some
> individuals will tend to have greater values of Var2 than others during the
> entire study period.Note that some individuals have been captured only one
> time, other two, other three and so on (very unbalanced). For each date an
> individual can be captured only one time.So, I have two groups: IND and
> DATE. I would think this is a two-level model with IND nested to DATE so
> that:
> model1 <- glmer(Var1 ~ SEX + AGE + Var2 + (1|DATE/IND), family = binomial,
> data = mydata)
> Does it make sense? I think i am not taking into account the fact that the
> mean of Var2 may be different among individuals but I don't know how to do
> that.I would really appreciate an answer to this question that I am sure
> would help me a lot to understand better how mixed models work.
>

	[[alternative HTML version deleted]]



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