# Tag Info

0

I don't know if it's a way toward the answer, but I do not understand the logic behind the first model. If RatID is the random effect, and assuming each rat really has a different ID, I do not see what the sp_des:Rat additional random effect term really means. A syntax like (1|RatID) would have been expected, for random effects on intercepts only. Especially ...

1

Okay, I misunderstood. The conditional response is given by $$X_i(t_{ij}) \mid w_i \sim N(\eta + Z_i(t_{ij})w_i, \sigma^2).$$ And, the marginal distribution is given by: $$X_i(t_{ij}) \sim N(\eta, Z_i(t_i)\Sigma_{w}Z'_i(t_i) + \sigma^2).$$ Ref: https://www.sciencedirect.com/science/article/pii/...

0

Accurate integration of this kind of function will require you to work in log-space, which means that you will use the $\text{logsumexp}$ function for sums of terms. You can then use any standard method of numerical integration (e.g., quadrature, importance sampling, etc.) To give you a more specific idea of how to implement this technique, I will ...

3

The log-sum-exp trick is a way to calculate sums over finite sets, operating in the log domain to avoid overflow. I'll show how to generalize this trick to integrals, giving a way to rewrite the log of your marginal likelihood. The log marginal likelihood is: $$\log \ell_m(\theta) = \log \int \exp \big( \ell(\theta, b) \big) dF(b)$$ Let $\ell^*(\theta)$ ...

3

The marginal log-likelihood in mixed models is typically written as: $$\ell(\theta) = \sum_{i = 1}^n \log \int p(y_i \mid b_i) \, p(b_i) \, db_i.$$ In specific settings, e.g., in linear mixed model, where both terms in the integrand are normal densities, this integral has a closed-form solution. But in general you need to approximate it using Monte Carlo ...

4

First, note that the simulated data above results in a singular model fit because there is no variation in the response among any of the random factors. This can be overcome with a simple modification: library(lme4) set.seed(15) participant <- rep(1:40, each = 30) session <- rep(rep(1:3, each = 10), times = 40) item <- rep(1:10, times = 120) ...

0

This is an old question, but I ran into a similar situation when trying to run a gamm model using bam. I believe what's going on is that s(prev, speaker, bs='re') in the model above is estimating a variance term for the ~prev:speaker-1 interaction (random slopes), whereas s(time, by=speaker, bs="fs", m=1) is estimating a separate slope term for each ...

0

Thank you Scinilla for your answer! I used a simulation of data (from here) and tried all three models, and all return similar estimates for the standard deviations. Based on this, I guess there is no difference between the two approaches but if anyone thinks there is, I am happy for suggestions! # data simulation from https://debruine.github.io/lmem_sim/...

Top 50 recent answers are included