simr
simr copied to clipboard
Errror message: Cholmod warning 'not positive definite' and NAs produced
I have the following model:
mod.1 <- glmer(lane_position ~ heading + (heading | pNum), family = Gamma(link = "identity"), nAGQ = 0, data = magnitudedata)
The observed effect is:
fixef(mod.1)["heading"] heading 0.0491085
And then I run the following power analysis:
fixef(mod.1)["heading"] <- 0.01
powerSim(mod.1, nsim = 50)
However the result states I have zero power and 50 errors:
Power for predictor 'heading', (95% confidence interval):=============================================================================================================================| 0.00% ( 0.00, 7.11)
Test: z-test Effect size for heading is 0.010
Based on 50 simulations, (46 warnings, 50 errors) alpha = 0.05, nrow = 4052
Time elapsed: 0 h 0 m 10 s
Looking at the warnings and I see a message like this:
lastResult()$warnings
stage index message
1 Simulating 1 NAs produced 2 Simulating 2 NAs produced 3 Simulating 3 NAs produced 4 Fitting 3 Cholmod warning 'not positive definite' at file:../Cholesky/t_cholmod_rowfac.c, line 431 5 Fitting 3 Cholmod warning 'not positive definite' at file:../Cholesky/t_cholmod_rowfac.c, line 431
Do you have any ideas on what this means and how to fix it? Help is much appreciated it, thank you!
I'm guessing this is because you're using a Gamma distribution with an identity link. If your linear predictor becomes negative, then you end up in an invalid region of the parameter space.
That does make sense. Thank you for the swift reply! Using the log link removes issue.