variance-covariance matrix with negative entries on mixed model fit 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. 
 A: Very often this problem occurs in the optimization routine used by the software, and indicates that the the solution is on or very near the boundary of the parameter space, usually in mixed models, that is a variance component of zero (or a correlation between random effects of 1 or -1). It may be the case that the particular variance component actually is (or is very near) zero (in which case it can be omitted from the model), or that the variance component is meaningfully positive, but the optimization routine fails, often because the number of clusters/levels of the relevant factor is small. Sometimes this can be overcome by using a different optimiser. In R, it is often better, when fitting linear mixed models without a residual covariance structure to use one of the newer packages such as lme4, which offers much better support for diagnosing convergence problems. Another option is to use a Bayesian approach, such as the rstanarm package in R which again can be useful for diagnosing convergence issues. Another package that may be helpful is GLMMadaptive which implements Gaussian Adaptive Qundrature rather than the Laplace method.
Lastly, I would say that in this specific case, the random effects structure is quite complex as it is fitting nested random effects for 3 levels, and random slopes over all 3 levels, and their relevant correlations. This may be an over-specified model, particularly if any of the numbers of clusters are small. I would certainly start with a much simpler model in lme4 with just random intercepts, and add random slopes if warranted by theory to the relevant levels one at a time. Uncorrelated random effects can also be specified if necessary. Building a model up this way will often be a good way to identify and overcome these kinds of problem
Demidenko's book "Mixed Models. Theory and Applications in R" discusses these problems in depth in section 2.15.
The answers to this question and this question are also relevant.
