[R-sig-ME] Model Definition and Interpretation - Interactions, plus Singularity
Phillip Alday
ph||||p@@|d@y @end|ng |rom mp|@n|
Thu Mar 7 16:56:41 CET 2019
Hello,
On 6/3/19 7:53 pm, Reinstein, Ilan wrote:
> Hi all, I hope all is well.
>
::snip::
>
>
> 1. glmer(correct ~ scale(Sequence) + (scale(Sequence) | ID:caseType), family = binomial)
>
> 2. glmer(correct ~ scale(Sequence):caseType + (scale(Sequence):caseType | ID), family = binomial)
This model is a little unusual -- it includes interactions without main
effects, which usually doesn't make sense.
I think you want:
glmer(correct ~ 1 + scale(Sequence)*caseType +
(1+scale(Sequence)*caseType | ID), family = binomial)
(Note: I always make my intercept term explicit, both to remind that
it's there, and because some of the other software I use doesn't add an
implicit intercept.)
I wouldn't worry about achieving balance via artificial mehtods -- lme4
doesn't require it and the lack of balance will primarily show itself as
a difference in the intercept term, which isn't a big deal, and to a
lesser extent a difference in the standard errors -- they may actually
be better because you have more data overall.
Finally, you have 15ish (or at least more than 10 based on your
description and a logical leap) items per category, so you have more
than enough items to also estimate item effects. If each item belongs
uniquely to a single caseType, then you can't estimate caseType by item
effects, but you could potentially estimate sequence effects:
glmer(correct ~ 1 + scale(Sequence)*caseType +
(1+scale(Sequence)*caseType | ID) + (1+scale(Sequence)|Item), family =
binomial)
and if that fails to converge, you can try a model which just allows for
just intercept-level variation by item:
glmer(correct ~ 1 + scale(Sequence)*caseType +
(1+scale(Sequence)*caseType | ID) + (1|Item), family = binomial)
This latter model would pick up e.g. whether a given item is more or
less likely to be corrected rated, beyond the effect of its overarching
caseType or sequence position. lme4 will pick up on the "between" design
aspects of the item component without you having to be more explicit.
About your convergence problems: assuming they still linger after adding
in the main effects, I would interpret them as there not being enough
data to estimate the by-subject and by-item differences in the sequence
effect, which isn't horrible nor particularly surprising for me: I
expect the overall effect of sequence and the general variation between
subjects and items (i.e. the corresponding random intercepts) to be much
larger than the variation between subjects and items in the sequence effect.
Best,
Phillip
>
> I've fitted these two models to capture the different learning rates by person and by case type but I am not sure about, first, if the interaction is correctly specified, and second, where and how to specify the interaction given the needs of my problem (person-case or # items-case, random or fixed). Are cases nested within persons, even if the number of items by case differs? Or is the interaction of case type with the number on the sequence more informative for my purpose?
>
>
> The first model's coef()/ranef() output is very attractive since I can have an Intercept and a Slope for the interaction of person and case type, however after carefully reviewing the answers in this discussion<https://stats.stackexchange.com/questions/31569/questions-about-how-random-effects-are-specified-in-lmer>, I moved to model number 2 since it made more sense in the interpretation, however I am unsure which is more appropriate for my needs. I am starting to get more inclined towards the second model but it is a singular fit (+1 correlation of random effects). I've looked for possible solutions without the need to go Bayesian, but I am not sure how to implement those either so I tried going to rstanarm. Are there any suggestions about the priors?
>
>
> I will continue to try out the different suggestions presented in the different threads around singularities on lme4.
>
>
> Finally, I looked for a suitable dataset for reproducibility but I hope this is more of a conceptual discussion.
>
>
> Similar questions about singular fits: https://stats.stackexchange.com/questions/378939/dealing-with-singular-fit-in-mixed-models
>
>
> [https://cdn.sstatic.net/Sites/stats/img/apple-touch-icon@2.png?v=344f57aa10cc]<https://stats.stackexchange.com/questions/378939/dealing-with-singular-fit-in-mixed-models>
>
> lme4 nlme - Dealing with singular fit in mixed models - Cross Validated<https://stats.stackexchange.com/questions/378939/dealing-with-singular-fit-in-mixed-models>
> stats.stackexchange.com
> Let's say we have a model mod <- Y ~ X*Condition + (X*Condition|subject) # Y = logit variable # X = continuous variable # Condition = values A and B, dummy coded; the design is repeated ...
>
>
>
>
> Thank you in advance,
>
>
> Best,
>
>
> Ilan Reinstein
>
>
>
> ------------------------------------------------------------
> This email message, including any attachments, is for ...{{dropped:7}}
More information about the R-sig-mixed-models
mailing list