MixSIAR icon indicating copy to clipboard operation
MixSIAR copied to clipboard

Error in JAGS model

Open Lushani84 opened this issue 7 years ago • 9 comments

Hi, I've been using MixSIAR for a bit now and thought I've gotten comfortable with the code. The model was running fine for a few data sets but I keep getting this error with my current set. There were no error messages up until hit run_model() I tried looking for an answer on StackOverflow but to no avail, please help!

module glm loaded Compiling model graph Resolving undeclared variables Allocating nodes Deleting model

Error in jags.model(model.file, data = data, inits = init.values, n.chains = n.chains, : RUNTIME ERROR: Compilation error on line 123. Index out of range taking subset of src_tau

Lushani84 avatar Jul 31 '17 22:07 Lushani84

Hmm, that is strange. The model is probably misspecified and my error checks missed the problem. If you want to email me your csv files and R script, I can take a look.

-Brian

brianstock avatar Aug 01 '17 01:08 brianstock

Thank you! I'm sending them to you now.

Lushani84 avatar Aug 01 '17 01:08 Lushani84

Hi, how was the problem solved? I was wondering, because I think I have a comparable one with the jags model: Compiling model graph Declaring variables Resolving undeclared variables Allocating nodes Deleting model

Error in jags.model(model.file, data = data, inits = init.values, n.chains = n.chains, : RUNTIME ERROR: Compilation error on line 165. Index out of range taking subset of src_cov

But I also have an error when calculating the convex hull area: Error: dims [product 14] do not match the length of object [0]

Thank you in advance Nadin

NaDinG avatar Jan 11 '18 13:01 NaDinG

Hello!

Same here... Any hint about what the problem might have been?

I got this message:

Compiling model graph Resolving undeclared variables Allocating nodes Deleting model

Error in jags.model(model.file, data = data, inits = init.values, n.chains = n.chains, : RUNTIME ERROR: Compilation error on line 113. Index out of range taking subset of src_tau

Thanks! David.

nauplius97 avatar May 22 '18 22:05 nauplius97

Hi everyone,

I have the same error when trying to run the JAGS model:

(Compiling model graph Resolving undeclared variables Allocating nodes Deleting model

Error in jags.model(model.file, data = data, inits = init.values, n.chains = n.chains, : RUNTIME ERROR: Compilation error on line 93. Index out of range taking subset of src_tau)

Has anyone figured out a fix yet?

Thanks, Kelsey

KelseyKingsbury avatar Jun 23 '18 08:06 KelseyKingsbury

Hi everyone,

I have the same problem/error: Error in jags.model(jags_model, quiet = "TRUE", inits = inits, data = list(mrg.y = mrg.y, : RUNTIME ERROR: Compilation error on line 12. Index out of range taking subset of phi

Was someone able find a solution for the problem already?

Thanks, Sandy

werderz avatar Feb 19 '19 16:02 werderz

After some trial and error I think I have fixed this issue. This error only occurs if you only use 1 error class (either residual or process error only). For example in my case :

model_filename <- "MixSIAR_model.txt" process_err <- FALSE resid_err <- TRUE write_JAGS_model(model_filename, process_err, resid_err, mix, source)

jags.1 <- run_model(run="test",mix,source,discr,model_filename, alpha.prior = alpha, process_err,resid_err) < Make sure in your code these are in the same order: 1. process and 2. residual

Hope that helps. Maarten

MaartenWynants avatar Jun 25 '19 19:06 MaartenWynants

Hi all,

I had the same error showing up and I fixed it. What worked for me was making sure that the initial parameters I called in were the appropriate dimension. What you might play with is the initial parameter. It might need to be a matrix of initial values.

Hope this helps people, Eron

eronraines avatar Dec 19 '19 05:12 eronraines

I was able to fix my error: I got the error and found a typo in my dataset where one of the factors in my Consumers data had one more level than in my sources (e.g., I had 5 locations in my consumer's data and only 4 in the sources). Once I fixed the typo, the error was resolved. Try checking that you have the same number of levels for a factor in both the consumers and sources. Hope that helps.

mhannappel avatar Jul 19 '23 17:07 mhannappel