[R-sig-ME] is a mixed effect model appropiate?
ritz at nexs.ku.dk
Thu Aug 10 00:06:33 CEST 2017
in my experience it works fine to fit a linear mixed model with lmer()
in cases where there are only few levels of a random effect.
Most of the time the estimated variance (component) (in your case the
between-site variance) will be become 0, most likely reflecting that
there was very little information in the data (not enough sites) for
estimation of this parameter.
I would prefer this approach (including site as a random effect) to
using a decision rule where the number of levels of the random effect
determines whether or not a random effect is included in a model.
Best wishes Christian
On 09-08-2017 23:41, Alday, Phillip wrote:
> With only three sites, you don't have enough levels to use site as a
> grouping variable / random effect. Random effects are *variance*
> components and it doesn't make too much sense to discuss variance with
> only three group members.
> You could include site as a fixed effect, as you're doing now; adding
> interaction terms would largely address the independence issue. Note
> however that the inference from fixed and random effects is slightly
> different: with fixed effects, you get estimates for each level, but
> for random effects you get an estimate of the variance between / due to
> sites and, optionally, a prediction for individual sites. So the random
> effect will tend to generalize better to across all possible sites,
> assuming that you sampled enough sites to begin with, while the fixed
> effect will better model individual sites.
> In your case, I would focus on including interaction terms before
> modelling site. If you are able to do that, I would include site as a
> fixed effect (too few levels as a random effect), but I suspect site
> will correlate strongly with some of the other variables and so you
> might have some issues with collinearity.
> One final thing: you can fit (Gaussian) linear models with glm(), but
> lm() will tend to be faster and offer some additional summary info. You
> of course still need glm() for generalized variants such as logit, etc.
> For lmer and glmer, the distinction is stricter -- you must use lmer()
> for the (Gaussian) linear case and glmer() for the generalized case or
> glmer() will complain.
> On Wed, 2017-08-09 at 16:26 -0300, Tamara R wrote:
>> Hi, i'm working with survey data regarding leptospirosis knowledge,
>> attitudes and practices on residents from three slum settlements and
>> using socio-demographic indicators, knowledge score and attitude
>> score as
>> predictors of preventive practices score.
>> I started analyzing my data as a linear model with both categorical
>> continuous predictors:
>> glm(practices~site + sex + education + occupation + knowledge score +
>> attitude score
>> But discussing the results with my phD advisor she suggested me to
>> put site
>> as a random effect in a linear mixed model because of lack of
>> between observations from the same site:
>> lmer(practices~sex + education + occupation + knowledge score +
>> score + (1|site))
>> Thing is that i have less than 100 observations and the variance of
>> effects equals to 0. I read in a previous post on this group that it
>> indicates that the model could be simplified by removing the random
>> but i wish to know if simplifying my model (going back to the
>> regression model) will be appropiate to model the lack of
>> independence of
>> the data or should i also include random slopes for knowledge and
>> scores into the model? Thanks in advance
>> Tamara Ricardo
>> Lic. en Biodiversidad - Becaria CONICET
>> FHUC - Universidad Nacional del Litoral
>> Ciudad Universitaria - Pje. el Pozo
>> Santa Fe (3000) - Argentina
>> [[alternative HTML version deleted]]
>> R-sig-mixed-models at r-project.org mailing list
> R-sig-mixed-models at r-project.org mailing list
[[alternative HTML version deleted]]
More information about the R-sig-mixed-models