Error message related to parameterisation in model code

84 views
Skip to first unread message

Yan

unread,
Dec 15, 2017, 11:11:12 AM12/15/17
to nimble-users
Dear nimble team,

When processing the model code using nimbleModel(), I received the following message:

Error in if (model$z[getNodeFunctionIndexedInfo(INDEXEDNODEINFO_,  : 
  missing value where TRUE/FALSE needed
I coded node $z$ to follow a categorical distribution, i.e. z[n] ~ dcat(eta[1:J]).
Just wonder why the message appeared.

Thank you in advance.

Best,

Yan

Chris Paciorek

unread,
Dec 15, 2017, 11:13:31 AM12/15/17
to Yan, nimble-users
Hi Yan,

This message is very likely occurring because you haven't initialized
"eta" -- i.e., "eta" is probably NA, which causes an error in doing
calculations with "z".

-Chris
> --
> 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 post to this group, send email to nimble...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nimble-users/d308701f-bbc4-43b9-9c91-09caec737cc8%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Yan

unread,
Dec 15, 2017, 12:12:27 PM12/15/17
to nimble-users
Hi Chris,

Thanks for the quick reply. I initialised $eta$ through specifying alpha ( eta[1:J] ~ ddirch(alpha[1:J]) ). Is there any other reason for the error?

Many thanks,

Yan


在 2017年12月15日星期五 UTC下午4:13:31,Christopher Paciorek写道:

Chris Paciorek

unread,
Dec 15, 2017, 12:25:37 PM12/15/17
to Yan, nimble-users
Hi Yan, specifying the distribution for eta does not initialize it to
a value in the model. If you want the error message to go away, you
can specify an initial value for 'eta' via the 'inits' argument to
nimbleModel.

That said, if you do not set 'eta' via 'inits', then despite the error
message when you run nimbleModel, the model should get created (let us
know if it does not) and you can proceed to use the model. If you run
an MCMC, then eta will be initialized based on its prior distribution.

Chris
> https://groups.google.com/d/msgid/nimble-users/599870d0-03e8-4ade-9bef-7de659eb24e0%40googlegroups.com.

Yan

unread,
Dec 15, 2017, 12:45:04 PM12/15/17
to nimble-users
Hi Chris,

Thanks for the message below. Given the initial values for $eta$ the model was built, though the error message still appeared.

Best,

Yan

在 2017年12月15日星期五 UTC下午5:25:37,Christopher Paciorek写道:

Daniel Turek

unread,
Dec 15, 2017, 12:47:42 PM12/15/17
to Yan, nimble-users
Yan, can you send a fully reproducible example of this?

To unsubscribe from this group and stop receiving emails from it, send an email to nimble-users+unsubscribe@googlegroups.com.

To post to this group, send email to nimble...@googlegroups.com.

Daniel Turek

unread,
Dec 15, 2017, 1:53:46 PM12/15/17
to nimble-users, Yan
Forwarding the reproducible example to nimble-users list.

On Fri, Dec 15, 2017 at 1:15 PM, Yan <ly201...@gmail.com> wrote:
Hi Chris,

I have the code and data attached.

Best,

Yan
Reply all
Reply to author
Forward
0 new messages