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.