Given the information you provided, I would simply specify Subject
as random:
model.3 <- glmer(DV ~ X + Y + Z + Y:Z + (1|Subject), data=data, family="binomial")
Having Subject
specified in the model will account for the multiple measurements on the same subjects (the "repeated measurements" aspect of your study). Neither of your models (i.e. model.1
and model.2
does that; see further below).
Unless there is a reason that those 60 random trials might differ among subjects, which I don't know, I wouldn't take Trial
into the model.
In the random statement, you want to include things that would fall under (a) "pseudo-replication" (temporal and spatial) and (b) factors for which you want a variance to be estimated. For example, if you were to repeat your experiment in different cities, or different hospitals, or other things that could affect the outcome, I would include this in the random statement as well. This will allow you to capture this additional potential variation, which may or may not be of interest to you.
To answer your second question, the difference between + (1|Trial/Subject)
and + (1|Trial)
is that the former has Subject
nested in Trial
, which expands to + (1|Trial) + (1|Trail:Subject)
and means that you want to capture the variance (a) due to Trial
and (b) the variance of the grouping of Trial
with Subject
; while in the latter you only want to account for the variation due to Trial
. You should always check your model with summary(my.model)
and find the line where it says Number of obs:
and groups:
. There you can double check whether your syntax captures the number of groups for which you wanted to the variances to be estimated.
Some useful links:
http://glmm.wikidot.com/faq and in particular to understand the (g)lmer syntax for the random statement http://glmm.wikidot.com/faq#toc27
There are also a lot of other question regarding model specifications here on Cross Validated.
You may find this one helpful as well:
http://rpsychologist.com/r-guide-longitudinal-lme-lmer