I am fitting a linear mixed effect model in R (function lme), and I get a Var-Cov matrix with negative entries (Log-Cholesky). This does not allow me to compute confidence intervals on the standard deviations of the random effects. Shouldn't this matrix theoretically be postive-definite? Does this warn me of something specific?
The model has two fixed effects (factors) with interaction term, and nested random effects on intercept and slope.
[UPDATE]
I have uploaded the data at this link. The explanation of the experiment and the data-set are detailed in this question. To sanity-check what the problem might be, I first simplify the dataset by considering a single level of the factor spd_des:
> spdDes <- 's15'
> dat <- dat[dat$spd_des==spdDes,]
Nevertheless, when I try to fit a model with random slope on mPair, I get negative entries on the var-cov matrix.
> lmer(cc_marg ~ mPair + (mPair|ratID), data = dat, REML=TRUE, na.action=na.omit)
This is true using lme, lmer, as well as stan_lmer. In particular, stan_lmer returns the warning There were 8 divergent transitions after warmup. When I plot the traces with stan_trace I do not see any convergence: all the traces look like random noise.
lme(cc_marg ~ mPair*spd_des , random = ~mPair|ratID/spd_des/cycle, data=dat_trf, na.action=na.omit, method = "ML", control=lCtr )– Cristiano May 15 '19 at 16:22lmerather than, for example,lmerin thelme4package ormixed_modelinGLMMadaptive? – Robert Long May 15 '19 at 16:29lme4is much more recent (same primary author) with better support to diagnose and identify problems like these and it allows much more flexibility with random effects provided that you dont want to model the residual covariance structure. – Robert Long May 15 '19 at 16:44