<p>You are asking quite a few questions in your question. I'll try to cover them all, but I do suggest reading the documentation and vignette from <a href="https://cran.r-project.org/web/packages/lme4/" rel="nofollow noreferrer"><code>lme4</code></a> and the <a href="http://bbolker.github.io/mixedmodels-misc/glmmFAQ.html#lme4-1" rel="nofollow noreferrer">glmmFAQ</a> page for more information. Also I'd highly recommend searching for these topics on google scholar, as they are fairly well covered.</p>
<p>I'll start somewhere simple</p>
<h1>Note 2 (why is my model singular?)</h1>
<p>Your model is highly singular, because the way you are simulating your data does not indicate any dependency between the data itself. If you wanted to simulate a binomial model you would use <code>g(eta) = X %*% beta</code> to simulate your linear predictor and thus the probability for success. One can then use this probability for simulating the your binary outcome. This would thus be a 2 step process, first using some known <code>X</code> or randomly simulated <code>X</code> given some prior distribution of our choosing. In the second step we would then use <code>rbinom</code> to simulate binary outcome while keeping it dependent on our predictor <code>X</code>.</p>
<p>In your example you are simulating independent <code>X</code> and a <code>y</code> where the probability is independent of <code>X</code> as well. Thus, when we look at the outcome <code>y</code> the probability of success is equal to <code>p=c</code> for all subgroup for some constant <code>c</code>.</p>
<h1>Can someone explain me the actual difference between Method 1 and Method 2? (<code>(1| year:plot)</code> vs <code>(1|year/plot)</code>)</h1>
<p>This is explained in the package vignette <a href="https://cran.r-project.org/web/packages/lme4/vignettes/lmer.pdf" rel="nofollow noreferrer">fitting linear mixed effects models with lme4</a> in the table on page 7.</p>
<ol>
<li><code>(1|year/plot)</code> indicates that we have 2 mixed intercept effects, <code>year</code> and <code>plot</code> and <code>plot</code> is nested within <code>year</code>.</li>
<li><code>(1|year:plot)</code> indicates a single mixed intercept effect, <code>plot</code> nested within <code>year</code>. Eg. we do not include the main effect of <code>year</code>. It would be somewhat similar to having a model without intercept (although less drastic, and interpretation is not destroyed).</li>
</ol>
<p>It is more common to see the first rather than the second, but we could write the first as a function of the second <code>(1|year) + (1|year:plot)</code>.</p>
<h1><strong>Thus: Is it indeed more appropriate to use the cbind-method than the raw binary data?</strong></h1>
<p><code>cbind</code> in a formula is used for binomial data (or multivariate analysis), while for binary data we use the raw vector or <code>0/1</code> indicating success/failure, eg. aggregate binary data (similar to how we'd use <code>glm</code>). If you are uninterested in the random/fixed effect of subplot, you might be able to aggregate your data across plots, and then it would likely make sense. Otherwise stay with you <code>0/1</code> outcome vector indicating either success or failures.</p>
<h1>What would be the correct random model structure and why?</h1>
<p>This is a topic that is extremely hard to give a definitive answer to, and one that is still actively researched. Depending on your statistical paradigm opinions differ greatly.</p>
<h2>Method 1: The classic approach</h2>
<p>Classic mixed modelling is based upon knowledge of the data you are working with. In general there are several &quot;rules of thumb&quot; for choosing these parameters. I've gone through a few in <a href="https://stackoverflow.com/questions/62469170/lmer-or-binomial-glmm/62563069#62563069">my answer here</a>. In general if you are &quot;not interested&quot; in the systematic effect and it can be thought of as a random sample of some population, then it could be a random effect. If it is the population, eg. samples do not change if the process is repeated, then it likely shouldn't.</p>
<p>This approach often yields &quot;decent&quot; choices for those who are new to mixed effect models, but is highly criticized by authors who tend towards methods similar to those we'd use in non-mixed models (eg. visualizing to base our choice and testing for significance).</p>
<h2>Method 2: Using visualization</h2>
<p>If you are able to split your data into independent subgroups and keeping the fixed effect structure a reasonable approach for checking potential random effects is the estimate marginal models (eg. using <code>glm</code>) across these subgroups and seeing if the fixed effects are &quot;normally distributed&quot; between these observations. The function <code>lmList</code> (in <code>lme4</code>) is designed for this specific approach. In linear models we would indeed expect these to be normally distributed, and thus we can get an indication whether a specific grouping &quot;might&quot; be a valid random effect structure. I believe the same is approximately true in the case of generalized linear models, but I lack references. I know that Ben Bolker have advocated for this approach in a prior article of his (the first reference below) that I used during my thesis. However this is only a valid approach for strictly separable data, and the implementation is not robust in the case where factor levels are not shared across all groups.</p>
<p>So in short: If you have the right data, this approach is simple, fast and seemingly highly reliable.</p>
<h2>Method 3: Fitting maximal/minimal models and decreasing/expanding model based on AIC or AICc (or p-value tests or alternative metrics)</h2>
<p>Finally an alternative to use a &quot;step-wise&quot;-like procedure. There are advocates of both starting with maximal and minimal models (I'm certain at least one of my references below talk about problems with both, otherwise check glmmFAQ) and then testing your random effects for their validity. Just like classic regression this is somewhat of a double-edged sword. The reason is both extremely simple to understand and amazingly complex to comprehend.</p>
<p>For this method to be successful you'd have to perform cross-validation or out-of-sample validation to avoid selection bias just like standard models, but unlike standard models sampling becomes complicated because:</p>
<ol>
<li>The fixed effects are conditional on the random structure.</li>
<li>You will need your training and testing samples to be independent</li>
<li>As this is dependent on your random structure, and this is chosen in a step-wise approach it is hard to avoid information leakage in some of your models.</li>
<li>The only certain way to avoid problems here is to define the space
that you will be testing and selecting samples based on the most
restrictive model definition.</li>
</ol>
<p>Next we also have problems with choice of metrics for evaluation. If one is interested in the random effects it makes sense to use AICc (AIC estimate of the conditional model) while for fixed effects it might make more sense to optimize AIC (AIC estimate of the marginal model). I'd suggest checking references to AIC and AICc on glmmFAQ, and be wary since the large-sample results for these may be uncertain outside a very reestrictive set of mixed models (namely &quot;enough independent samples over random effects&quot;).</p>
<p>Another approach here is to use p-values instead of some metric for the procedure. But one should likely be even more wary of test on random effects. Even using a Bayesian approach or bootstrapping with incredibly high number of resamples sometimes these are just not very good. Again we need &quot;enough independent samples over random effects&quot; to ensure the accuracy.</p>
<p>The <a href="https://cran.r-project.org/web/packages/DHARMa/index.html" rel="nofollow noreferrer"><code>DHARMA</code></a> provides some very interesting testing methods for mixed effects that might be better suited. While I was working in the area the author was still (seemingly) developing an article documenting the validity of their chosen method. Even if one does not use it for initial selection I can only recommend checking it out and deciding upon whether one believes in their methods. It is by far the most simple approach for a visual test with simple interpretation (eg. almost no prior knowledge is needed to interpret the plots).</p>
<p>A final note on this method would thus be: It is indeed an approach, but one I would personally <strong>not</strong> recommend. It requires either extreme care or the author accepting ignorance of model assumptions.</p>
<h2>Conclusion</h2>
<p>Mixed effect parameter selection is something that is <strong>difficult</strong>. My experience tells me that mostly a combination of method 1 and 2 are used, while method 3 seems to be used mostly by newer authors and these tend to ignore either out-of-sample error (measure model metrics based on the data used for training), ignore independence of samples problems when fitting random effects or restrict themselves to only using this method for testing fixed effect parameters. All 3 do however have some validity. I myself tend to be in the first group, and base my decision upon my &quot;experience&quot; within the field, rule-of-thumbs and the restrictions of my data.</p>
<h2>Your specific problem.</h2>
<p>Given your specific problem I would assume a mixed effect structure of <code>(1|year/plot/subplot)</code> would be the correct structure. If you add autoregressive (time-spatial) effects likely <code>year</code> disappears. The reason for this structure is that in geo-analysis and analysis of land plots the classic approach is to include an effect for each plot. If each plot can then further be indexed into subplot it is natural to think of &quot;subplot&quot; to be nested in &quot;plot&quot;. Assuming you do not model autoregressive effects I would think of <code>time</code> as random for reasons that you already stated. Some years we'll have more dry and hotter weather than others. As the plots measured will have to be present in a given year, these would be nested in year.</p>
<p>This is what I'd call the <code>maximal</code> model and it might not be feasible depending on your amount of data. In this case I would try using <code>(1|time) + (1|plot/subplot)</code>. If both are feasible I would compare these models, either using bootstrapping methods or approximate LRT tests.</p>
<p><strong>Note:</strong> It seems not unlikely that <code>(1|time/plot/subplot)</code> would result in &quot;individual level effects&quot;. Eg 1 random effect per row in your data. For reasons that I have long since forgotten (but once read) it is not plausible to have individual (also called subject-level) effects in binary mixed models. In this case It might also make sense to use the alternative approach or test whether your model assumptions are kept when withholding <code>subplot</code> from your random effects.</p>
<p>Below I've added some useful references, some of which are directly relevant to the question. In addition check out the glmmFAQ site by Ben Bolker and more.</p>
<h1>References</h1>
<ol>
<li>Bolker, B. et al. (2009). „Generalized linear mixed models: a practical guide for ecology and evolution“. In: Trends in ecology &amp; evolution 24.3, p. 127–135.</li>
<li>Bolker, B. et al. (2011). „GLMMs in action: gene-by-environment interaction in total fruit production of wild populations of Arabidopsis thaliana“. In: Revised version, part 1 1, p. 127–135.</li>
<li>Eager, C. og J. Roy (2017). „Mixed effects models are sometimes terrible“. In: arXiv preprint arXiv:1701.04858. url: <a href="https://arxiv.org/abs/1701.04858" rel="nofollow noreferrer">https://arxiv.org/abs/1701.04858</a> (last seen 19.09.2019).</li>
<li>Feng, Cindy et al. (2017). „Randomized quantile residuals: an omnibus model diagnostic tool with unified reference distribution“. In: arXiv preprint arXiv:1708.08527. (last seen 19.09.2019).</li>
<li>Gelman, A. og Jennifer Hill (2007). Data Analysis Using Regression and Multilevel/Hierarchical Models. Cambridge University Press.</li>
<li>Hartig, F. (2019). DHARMa: Residual Diagnostics for Hierarchical (Multi-Level / Mixed) Regression Models. R package version 0.2.4. url: <a href="http://florianhartig.github.io/DHARMa/" rel="nofollow noreferrer">http://florianhartig.github.io/DHARMa/</a> (last seen 19.09.2019).</li>
<li>Lee, Y. og J. A. Nelder (2004).  „Conditional and Marginal Models: Another View“. In: Statistical Science 19.2, p. 219–238.<br />
doi: 10.1214/088342304000000305. url: <a href="https://doi.org/10.1214/088342304000000305" rel="nofollow noreferrer">https://doi.org/10.1214/088342304000000305</a></li>
<li>Lin, D. Y. et al. (2002). „Model-checking techniques based on cumulative residuals“. In: Biometrics 58.1, p. 1–12. (last seen 19.09.2019).
Lin, X. (1997). „Variance Component Testing in Generalised Linear Models with Random Effects“. In: Biometrika 84.2, p. 309–326. issn: 00063444. url: <a href="http://www.jstor.org/stable/2337459" rel="nofollow noreferrer">http://www.jstor.org/stable/2337459</a>
(last seen 19.09.2019).</li>
<li>Stiratelli, R. et al. (1984). „Random-effects models for serial observations with binary response“. In:<br />
Biometrics, p. 961–971.</li>
</ol>
How to determine the correct mixed effects structure in a binomial GLMM (lme4)?
<p>Could someone help me to determine the correct random variable structure in my binomial GLMM in lme4?</p>
<p>I will first try to explain my data as best as I can. I have binomial data of seedlings that were eaten (1) or not eaten (0), together with data of vegetation cover. I try to figure out if there is a relationship between vegetation cover and the probability of a tree being eaten, as the other vegetation is a food source that could attract herbivores to a certain forest patch.</p>
<p>The data is collected in ~90 plots scattered over a National Park for 9 years now. Some were measured all years, some were measured only a few years (destroyed/newly added plots). The original datasets is split in 2 (deciduous vs coniferous), both containing ~55.000 entries. Per plot about 100 saplings were measured every time, so the two separate datasets probably contain about 50 trees per plot (though this will not always be the case, since the decid:conif ratio is not always equal). Each plot consists of 4 subplots.
<em>I am aware that there might be spatial autocorrelation due to plot placement, but we will not correct for this, yet.</em></p>
<p>Every year the vegetation is surveyed in the same period. Vegetation cover is estimated at plot-level, individual trees (binary) are measured at a subplot-level.
All trees are measured, so the amount of responses per subplot will differ between subplots and years, as the forest naturally regenerates.</p>
<p>Unfortunately, I cannot share my original data, but I tried to create an example that captures the essentials:</p>
<pre><code>#set seed for whole procedure
addTaskCallback(function(...) {set.seed(453);TRUE})
# Generate vector containing individual vegetation covers (in %) 
cover1vec &lt;- c(sample(0:100,10, replace = TRUE)) #the ',number' is amount of covers generated

# Create dataset
DT &lt;- data.frame(
                 eaten = sample(c(0,1), 80, replace = TRUE),
                 plot = as.factor(rep(c(1:5), each = 16)), 
                 subplot = as.factor(rep(c(1:4), each = 2)),
                 year = as.factor(rep(c(2012,2013), each = 8)),
                 cover1 = rep(cover1vec, each = 8)
)
</code></pre>
<p>Which will generate this dataset:</p>
<pre><code>&gt;DT
   eaten plot subplot year cover1
1      0    1       1 2012      4
2      0    1       1 2012      4
3      1    1       2 2012      4
4      1    1       2 2012      4
5      0    1       3 2012      4
6      1    1       3 2012      4
7      0    1       4 2012      4
8      1    1       4 2012      4
9      1    1       1 2013     77
10     0    1       1 2013     77
11     0    1       2 2013     77
12     1    1       2 2013     77
13     1    1       3 2013     77
14     0    1       3 2013     77
15     1    1       4 2013     77
16     0    1       4 2013     77
17     0    2       1 2012     46
18     0    2       1 2012     46
19     0    2       2 2012     46
20     1    2       2 2012     46
....etc....
80     0    5       4 2013     82    
</code></pre>
<p><em>Note1:</em> to clarify again, in this example the number of responses is the same for every subplot:year combination, making the data balanced, which is not the case in the original dataset.
<em>Note2:</em> this example can not be run in a GLMM, as I get a singularity warning and all my random effect measurements are zero. Apparently my example is not appropriate to actually use (because using sample() caused the 0 and 1 to be in too even amounts to have large enough effects?).</p>
<p>As you can see from the example, cover data is the same for every plot:year combination.
Plots are measured multiple years (only 2012 and 2013 in the example), so there are <strong>repeated measures</strong>.
Additionally, a <strong>year effect</strong> is likely, given the fact that we have e.g. drier/wetter years.</p>
<p>First I thought about the following model structure:</p>
<pre><code>library(lme4)
mod1 &lt;- glmer(eaten ~ cover1 + (1 | year) + (1 | plot), data = DT, family = binomial)
summary(mod1)
</code></pre>
<p>Where (1 | year) should correct for differences between years and (1 | plot) should correct for the repeated measures.</p>
<p>But then I started thinking: all trees measured in plot 1, during year 2012 will be more similar to each other than when they are compared with (partially the same) trees from plot 1, during year 2013.
So, I doubt that this random model structure will correct for this <em>within plot temporal effect</em>.</p>
<p>So my best guess is to add another random variable, where this &quot;interaction&quot; is accounted for.
I know of two ways to  possibly achieve this:</p>
<p><em>Method 1.</em>
Adding the random variable &quot; + (1 | year:plot)&quot;</p>
<p><em>Method 2.</em>
Adding the random variable &quot; + (1 | year/plot)&quot;</p>
<p>From what other people told me, I still do not know the difference between the two.
I saw that <em>Method 2</em> added an extra random variable (year.1) compared to <em>Method 1</em>, but I do not know how to interpret that extra random variable.</p>
<p>As an example, I added the Random effects summary using <em>Method 2</em> (zeros due to singularity issues with my example data):</p>
<pre><code>Random effects:
 Groups    Name        Variance Std.Dev.
 plot.year (Intercept) 0        0       
 plot      (Intercept) 0        0       
 year      (Intercept) 0        0       
 year.1    (Intercept) 0        0       
Number of obs: 80, groups:  plot:year, 10; plot, 5; year, 2
</code></pre>
<p>Can someone explain me the actual difference between <em>Method 1</em> and <em>Method 2</em>?
I am trying to understand what is happening, but cannot grasp it.</p>
<p>I already tried to get advice from a colleague and he mentioned that it is likely more appropriate to use cbind(success, failure) per plot:year combination.
Via this site I found that cbind is used in binomial models when <em>Ntrails &gt; 1</em>, which I think is indeed the case given our sampling procedure.</p>
<p>I wonder, if cbind is already used on a plot:year combination, whether I need to add a plot:year random variable?
When using cbind, the example data would look like this:</p>
<pre><code>&gt;DT3
   plot year cover1 Eaten_suc Eaten_fail
8     1 2012      4         4          4
16    1 2013     77         4          4
24    2 2012     46         2          6
32    2 2013     26         6          2
40    3 2012     91         2          6
48    3 2013     40         3          5
56    4 2012     61         5          3
64    4 2013     19         2          6
72    5 2012     19         5          3
80    5 2013     82         2          6
</code></pre>
<p><strong>What would be the correct random model structure and why?</strong>
I was thinking about:</p>
<p>Possibility A</p>
<pre><code>mod4 &lt;- glmer(cbind(Eaten_suc, Eaten_fail) ~ cover1 + (1 | year) + (1 | plot), 
              data = DT3, family = binomial)
</code></pre>
<p>Possibility B</p>
<pre><code>mod5 &lt;- glmer(cbind(Eaten_suc, Eaten_fail) ~ cover1 + (1 | year) + (1 | plot) + (1 | year:plot), 
              data = DT3, family = binomial)
</code></pre>
<p>But doesn't cbind(success, failure) already correct for the year:plot dependence?</p>
<p>Possibility C</p>
<pre><code>mod6 &lt;- glmer(cbind(Eaten_suc, Eaten_fail) ~ cover1 + (1 | year) + (1 | plot) + (1 | year/plot), 
              data = DT3, family = binomial)
</code></pre>
<p>As I do not yet understand the difference between year:plot and year/plot</p>
<p><strong>Thus: Is it indeed more appropriate to use the cbind-method than the raw binary data? And what random model structure would be necessary to prevent pseudoreplication and other dependencies?</strong></p>
<p>Thank you in advance for your time and input!</p>
<p>EDIT 7/12/20: I added some extra information about the original data</p>