0

When trying to use cAIC4::cAIC() for my mixed model (I have several models with different random effects structures, including random intercepts only, random intercepts and slopes, random intercepts and specification of serial correlation etc.) fitted by nlme::lme(), immediately after running I get the message: R Session Aborted, R encountered a fatal error, the session was terminated.

Similar models (e.g. with random intercepts and slopes) fitted using lme4::lmer() do not cause any problems.

Unfortunately, I cannot share my data for confidentiality reasons. A different longitudinal data set does not cause the same issue, however I can include the model specification and an impression of the data:

> head(df, 10)
   ID   S A     BT AT outcome Time
1   1   0 0.40  0  5      90    4
2   1   0 0.40  0  5      90    6
3   1   0 0.40  0  5      90    7
4   1   0 0.40  0  5      90   11
5   2   0 1.32  0  7      90    5
6   2   0 1.32  0  7      90    7
7   2   0 1.32  0  7      90   11
8   3   1 5.78  0  3      85    0
9   3   1 5.78  0  3      85    2
10  4   1 5.98  1  3      58    2

model <- lme(outcome ~ S + BT + A + AT*Time, random = ~ 1|ID,
             data = df, na.action = na.exclude, method = "REML")


library(cAIC4)
cAIC(model)

Could anything in the model specification be a possible issue? The data is unbalanced with a different number of measurements for each ID and irregular time intervals.

Additional note: I want to use cAIC for model comparison in terms of the random effects, since the LRT does not seem a valid way to compare mixed models in many cases (especially more complex models).

EDIT: after some days, the terminal error does not happen anymore, however an error occurs when running cAIC:


Error in h(simpleError(msg, call)) : 
 error in evaluating the argument 'x' in selecting a method for function 'crossprod': error in evaluating the argument 'x' in selecting a method for function 'crossprod': non-conformable arguments

This happens only for the model with a specific variance-covariance structure for the residuals (and intercepts only), since it now works for random intercepts and random intercepts + slopes models.

If my data contains missings, this results in an additional warning:

In addition: Warning message:
In RLRsim::extract.lmeDesign(m) :
  Removing incomplete cases from supplied data.
yentl02
  • 25
  • 4
  • I'm very interested in this question, but without a reproducible example it's going to be almost impossible to say anything. If you `simulate()` a new response variable with `simulate(model)`, can you substitute that for your outcome and share your data? Can you `debug(cAIC)`, step through the function, and see at which point it crashes? – Ben Bolker Sep 17 '22 at 00:25
  • Thank you very much for your response. Unfortunately when using ```simulate(model)```, it results in a "null" list with the ML/REML likelihood and an "info entry" with a value of 0. This happens for all my ```lme()``` models (I checked with random intercepts only/random intercepts + slopes. The random intercepts + continuous autoregressive variance covariance for the residuals didn't work). I edited my question since running the function ```cAIC``` now results in an error (this did not happen before, and I did not change anything in the model or data). – yentl02 Sep 19 '22 at 09:12
  • I forgot, the `simulate()` method for lme objects does something different ... Is there any way you can perturb your data slightly and still get the same answer? What if you add some random noise to the response? (Do you get the same problem if you make the response completely random -- `rnorm(n = nrow(df), mean = mean(df$outcome), sd = sd(df$outcome)` ?) – Ben Bolker Sep 19 '22 at 13:10

0 Answers0