Incorrect dimensions in y data for nimbleSCR

6 views
Skip to first unread message

catheri...@gmail.com

unread,
Jun 24, 2024, 10:58:05 AMJun 24
to nimble-users
Hi everyone, 

I have a dataset, inits, and constants for a nimble model. But when I try to create a nimbleModel in nimbleSCR, I get an error about inconsistent dimensions in my y matrix:

> Rmodel <- nimbleModel(code, constants, data, inits) Defining model Error in addMissingIndexingRecurse(code[[i]], dimensionsList) : inconsistent dimensionality provided for node 'y' In addition: Warning message: In assignDimensions(dimensions, inits, data) : [Note] Inconsistent dimensions between data and dimensions arguments: y; ignoring dimensions in data.

I didnt provide an explicit dimensions argument, but I've checked dimensions, lengths, etc., and followed the wolverine (https://cran.r-project.org/web/packages/nimbleSCR/vignettes/wolverine_example.html) as a template. However, I'm not finding where my problem(s) is/are. I dont have any Infs, and my NAs seem to be in the right place..

Any assistance would be greatly appreciated. I've attached all relevant objects.

Thanks so much,
Cat 

nimble_yInconsistentDims.RData

Chris Paciorek

unread,
Jun 24, 2024, 2:55:22 PMJun 24
to catheri...@gmail.com, nimble-users
hi Catherine,

It looks like the problem is that you are providing `sxy` as a data
frame with one element named 'y' and that is incorrectly being
interpreted as the initial values for `y`.
The reason is that nimble tries to allow users to provide `inits`
either as (a) a single list that contains initial values for the
variables or (b) as a list of lists with each component list the
initial values for a different MCMC chain. Our checking of which
situation we are in seems to be insufficient to handle this situation
where (since a data frame is a list) we think we are in situation (b).
As a result, the `y` column of `sxy` is being considered as initial
values for `y` and the dimensions don't match the `y` variable in the
model.

Could you change `sxy` to a matrix and see if that fixed things?

I will file an issue for us to try to better error trap this.

-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 view this discussion on the web visit https://groups.google.com/d/msgid/nimble-users/9aa94aa1-0c64-4936-be4e-7b3811a5f8ean%40googlegroups.com.

catheri...@gmail.com

unread,
Jun 25, 2024, 4:48:15 AMJun 25
to nimble-users
Hi Chris,

Thanks so much for the quick response - converting to a matrix did the trick to remove confusion between y in the data and the y-coordinate in the inits!

Cheers,
Cat
Reply all
Reply to author
Forward
0 new messages