5
$\begingroup$

I have two questions:

  1. Is it ok/when might it be ok to specify a mixed model with a random slope but no random intercept?
  2. How would one specify such a model in lme4/glmmTMB?

I am working on a dateset that contains 200 snakes that have been measured at six points in time.

I first built a model that included weight as the outcome and individual as a random intercept.

w1 <- glmmTMB(weight_t ~ (1 | scale_id), data = long, family = gaussian) summary(w1) Family: gaussian ( identity ) Formula: weight_t ~ (1 | scale_id) Data: long AIC BIC logLik deviance df.resid 20488.5 20503.5 -10241.3 20482.5 1090 Random effects: Conditional model: Groups Name Variance Std.Dev. scale_id (Intercept) 7.284e-02 0.2699 Residual 8.055e+06 2838.1679 Number of obs: 1093, groups: scale_id, 200 Dispersion estimate for gaussian family (sigma^2): 8.06e+06 Conditional model: Estimate Std. Error z value Pr(>|z|) (Intercept) 2649.32 85.85 30.86 <2e-16 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

Above we can see that the variance attributable to individual is minimal, it approximates zero. My interpretation of this is that the model is essentially equivalent with or without the random intercept for individual.

I then built a model with a correlated random slope for time and random intercept for individual.

w2 <- glmmTMB(weight_t ~ (t_days | scale_id), data = long, family = gaussian) Warning message: In fitTMB(TMBStruc) : Model convergence problem; non-positive-definite Hessian matrix. See vignette('troubleshooting') 

My interpretation here from reading the glmmTMB troubleshooting page is that this second model is too complex/overparameterized. This error can also occur when random effects approximate zero, but the first model ran so I assume this is not the case.

A model with uncorrelated random slope for time and random intercept for individual works. This model shows that the random slope for time is important but again suggests that the random intercept for individual is of little importance.

w3 <- glmmTMB(weight_t ~ (t_days || scale_id), data = long, family = gaussian) summary(w3) Family: gaussian ( identity ) Formula: weight_t ~ (t_days || scale_id) Data: long AIC BIC logLik deviance df.resid 18652.2 18672.2 -9322.1 18644.2 1089 Random effects: Conditional model: Groups Name Variance Std.Dev. scale_id (Intercept) 7.313e-02 0.2704 scale_id.1 t_days 3.523e+02 18.7697 Residual 6.472e+05 804.4942 Number of obs: 1093, groups: scale_id, 200 Dispersion estimate for gaussian family (sigma^2): 6.47e+05 Conditional model: Estimate Std. Error z value Pr(>|z|) (Intercept) -394.44 41.13 -9.589 <2e-16 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

The fact that this model ran, again brings be back to my conclusion that my correlated random slope and intercept model is too complex.

In conclusion it seems that a random slope for time is important but a random intercept for individual is not. Therefore, it would seem reasonable to include a random slope for time without a fixed intercept? Is this appropriate, if so how would I specify this?

I note that there seems to be at least two other conflicting posts on this topic. This post suggests it is ok to have a random slope but no random intercept, but the comments on this post suggest that you should not have a random slope without a random intercept.

$\endgroup$

1 Answer 1

4
$\begingroup$

To fit a model with random slopes but without random intercepts you would use:

glmmTMB(weight_t ~ (0 + t_days | scale_id), data = long, family = gaussian) 

I haven't checked that glmmTMB supports such a model, but I would assume that it does, but that it how you would do it in lme4

Yes, it would seem that the model with correlated random slopes and intercetps is too complex. This makes sense if the random intercept variance is close to zero, as it would appear from your final model, since the software would be trying to estimate a correlation close to zero and this sometimes does pose problems.

I think it is OK to exclude the random intercepts if you have good reason to believe that there should be no initial variation in measurements across snakes. Certainly that is what the models are telling you. Sometimes this happens when an analyst mistakenly adjusts the data to make all the initial measurements the same, which is a big mistake, so as long as you didn't do this, and all the initial measurements really were the same, then you should be good.


Edit: You mentioned in the comment to my answer that this is a model of growth in weight over time. In that case you need to include t_days as a fixed effect, otherwise the model will be severely distorted because random effects are assumed to be normally distributed around zero - and it seems unlikely that you will have negative growth. So I would go back to this mode:

weight_t ~ t_days + (t_days | scale_id) 

and proceed from there.

Also as mentioned, you might consider centering time at zero, and incorporating nonlinear growth.

$\endgroup$
6
  • $\begingroup$ Thanks. This is immensely useful. I have not altered any measurements, initial or otherwise. There is some variation in initial snake weight, range 70-141 grams, but this is minuscule compared to variation at time point 6, 1200-16000 grams. Maybe is why I get minimal variance attributed to individual snakes? I am out of my depth here. It was a randomised trial to test the effect of tagging so snakes were randomly allocated to tag and non-tag groups, but I guess that shouldn't be coming into play here yet as I have not even included tag as a factor in these models yet. $\endgroup$ Commented Sep 18, 2020 at 7:14
  • 1
    $\begingroup$ You're welcome. Yes, that is why you get a very small random intercept variance. I assume it's birthweight or very shortly after birth ? In your situation I might be tempted to retain the random intercecpts, centre the time variable at 0 and also consider a nonlinear term (unless you know that growth is linear over the time period in question ?) $\endgroup$ Commented Sep 18, 2020 at 7:31
  • 1
    $\begingroup$ It would be good to include a plot of your data $\endgroup$ Commented Sep 18, 2020 at 7:42
  • 1
    $\begingroup$ I was thinking about this some more. Although there is very little initial variation relative to final variation, there might be a relation between initial bodyweight and the growth trajectory, that is, there could be correlation between random intercepts and random slopes, but the modelling so far has been unable to detect this. If this sounds plausible in your study, some changes will be necessary. $\endgroup$ Commented Sep 18, 2020 at 9:18
  • 1
    $\begingroup$ Yes, fitting birthweight as a fixed effect is a reasonable idea. Cubic splies would be good, although you may want to consider random slopes for the splies too (though don't be surprised if the data doesn't support that). I was thinking you might want to try some kind of transformation to make the earlier readings more spread out (and would then allow random intercepts). You also have increasing variance over time (heteroskedasticity) which can often be fixed with a transformation. $\endgroup$ Commented Sep 20, 2020 at 10:30

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.