Does this code indicate an error?

652 views
Skip to first unread message

alireza beheshty

unread,
May 18, 2021, 10:40:44 PM5/18/21
to nimble-users
Hi

I run my model but now I see it has an error.
I don't know this is an important error and make a mistake for result?
Thanks

----------------------------------------------------------------------------------------------------------
> mcmc.out <- nimbleMCMC(code = SLMMCode, data = SLMMdata,
+ constants = SLMMConsts,
+ inits = SLMMInits,
+ monitors = c("bm","b","phi", "tau_w",
+ "alpha", "latent", "tau_y"),
+ niter = 50000,
+ thin = 10, nchains = 1, setSeed = TRUE)

----------------------output----------------------------------------------------------------------------
defining model...
building model...
setting data and initial values...
running calculate on model (any error reports that follow may simply
reflect missing values in model variables) ... Error in
solve.default(x) :
Lapack routine dgesv: system is exactly singular: U[49,49] = 0
checking model sizes and dimensions... This model is not fully
initialized. This is not an error. To see which variables are not
initialized, use model$initializeInfo(). For more information on model
initialization, see help(modelInitialization).
checking model calculations...
Error in solve.default(x) :
Lapack routine dgesv: system is exactly singular: U[49,49] = 0
Error in solve.default(x) :
Lapack routine dgesv: system is exactly singular: U[49,49] = 0
Note: cannot calculate logProb for node prec_W[1:211, 1:211] .
Error in chol.default(model$prec_W[1:211, 1:211]) :
the leading minor of order 1 is not positive definite
Note: cannot calculate logProb for node
lifted_chol_oPprec_W_oB1to211_comma_1to211_cB_cP[1:211, 1:211] .
NAs were detected in model variables: prec_W, bm, logProb_bm,
lifted_chol_oPprec_W_oB1to211_comma_1to211_cB_cP, W, logProb_W, b,
mu_y, logProb_y.
model building finished.
compiling... this may take a minute. Use 'showCompilerOutput = TRUE'
to see C++ compilation details.
compilation finished.
running chain 1...
warning: value of deterministic node prec_W[1:211, 1:211]: value is NA
or NaN even after trying to calculate.
warning: value of deterministic node
lifted_chol_oPprec_W_oB1to211_comma_1to211_cB_cP[1:211, 1:211]: value
is NA or NaN even after trying to calculate.
warning: value of stochastic node W[1:211]: value is NA or NaN even
after trying to simulate.
warning: problem initializing stochastic node W[1:211]: logProb is NA or NaN.
warning: value of deterministic node mu_y[1]: value is NA or NaN even
after trying to calculate.

Daniel Turek

unread,
May 19, 2021, 6:52:14 AM5/19/21
to alireza beheshty, nimble-users
Yes, this looks like an error you should probably be concerned about.  Did the resulting MCMC samples look suspect to you?

From looking at it, it looks like the precision matrix, perhaps of a dmnorm distribution, wasn't probably initialized, and the MCMC wasn't able to initialize it correctly either.  If not that, then it has to do with some other matrix in your model not being properly initialized.  If you're willing to send reproducible code (off-list if necessary) then we could look into it further.

Good luck,
Daniel


--
You received this message because you are subscribed to the Google Groups "nimble-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nimble-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nimble-users/CAO4RiGX6-hqcTDVMWDYhJV0URVHC2DUmuW_HmdregUuFc0bFZQ%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages