-
Notifications
You must be signed in to change notification settings - Fork 2
Description
(this is actually a csv, but due to github restrictions I had to change it to txt) - 1mb bug.txt
using CSV
using DataFrames
using MixedModels
using MixedModelsPermutations
using Random
path = "https://github.com/palday/MixedModelsPermutations.jl/files/6024516/bug.txt"
evt = CSV.read(download(path),DataFrame)
evt.subject = categorical(evt.subject)
#f = @formula y ~ 1 + category * condition * baseline + zerocorr(1 + category * condition | subject)
f = @formula y ~ 1 + category * condition * baseline + (1 + category * condition | subject)
m2 = fit(MixedModel, f, evt)
perm = permutation(MersenneTwister(1), 1, m2)This results sometimes* in ERROR: PosDefException: matrix is not positive definite; Cholesky factorization failed. on the last line or ERROR: LinearAlgebra.LAPACKException(4). It works with ZeroCorr** though
** The simplest formula that fails for me:
f = @formula y~1 + (1+category&condition|subject)- but that one also fails with zerocorr
* Sometimes, not sure exactly when. E.g. when I dropped "baseline" I got the LAPACKException, but I think with the upper model I also got the LAPACKException before. Not sure if that matters, hints to similar problem.
Edit: I found another dataset where this occurs just with (1|subject). The actual variance estimate of the model is "0" in that case - thus I guess it makes lot's of sense, that the permutation has trouble. Not sure how I should proceed, because more-or-less random data will always exist in the baseline period (or shortly before activity onset)