I am getting the following error when I run a linear mixed model.
Error in validObject(.Object) :
invalid class “corMatrix” object: 'sd' slot has non-finite entries
In addition: Warning message:
In vcov.merMod(object, use.hessian = use.hessian) :
Computed variance-covariance matrix problem: not a positive definite matrix;
returning NA matrix
I have created a loop that runs through the columns of my data frame and run a LMM for each column. I have run the same process on 2 other data frames and I had no errors. The other data frames have similar properties (i.e contain 0s etc.). I have also tried excluding rows that contain zero values and this has not fixed the error.
Can anyone explain what this error means?
My loop: I am running LMM with likelihood ratio test
uni_HPOS_total1_A = data.frame(metab = character(), beta = double(), pvalue = double(), stringsAsFactors = FALSE)
for (i in 1:length(colnames(HPOS_XCMS_metab_0_new))){
model0 = lmer(HPOS_XCMS_metab_0_new[, i] ~ (1|technical covariate) ,
REML = FALSE, data = HPOS_XCMS_metab_0_covars)
model1 = lmer(HPOS_XCMS_metab_0_new[, i] ~ (1|technical covariate) + outcome,
REML = FALSE, data = HPOS_XCMS_metab_0_covars)
beta = summary(model1)$coefficients["outcome",1]
res <- anova(model0, model1)
pval = res$`Pr(>Chisq)`[2]
uni_HPOS_total1_A[nrow(uni_HPOS_total1_A) + 1,] = list(colnames(HPOS_XCMS_metab_0)[i], beta, pval)
}
Thanks