JAGS execution failed

Want to use the Bayesian fitting routines in the PAL_PFHB group of routines but you are having trouble integrating JAGS and/or Stan? Make sure to mention your OS (Linux, Mac, Windows), Matlab or Octave version and Palamedes version.
Post Reply
Aoibheann
Posts: 3
Joined: Thu May 18, 2023 6:12 am

JAGS execution failed

Post by Aoibheann »

Hello.
I am trying to use the PAL_PFHB_SingleSubjectMultipleConditions Demo however I am getting the error:
Execution of JAGS failed. Palamedes issued the command:
"C:
Any ideas what could be causing this?

Thanks
User avatar
Nick Prins
Site Admin
Posts: 28
Joined: Sun Feb 13, 2022 8:55 pm

Re: JAGS execution failed

Post by Nick Prins »

Hi. I cannot reproduce this behavior. Will need some more information. Let's try this:
First, make sure you are using latest version of Palamedes. Type 'PAL_version' (without quotes) into Matlab or Octave command version. If this is not the latest version (1.11.8 at the time of this writing), then upgrade to latest version of Palamedes and try again. If that solved the issue: awesome, please let us know. If it didn't, please give us the following information:
OS (Linux, Mac, or Windows plus version?)
Matlab or Octave (plus version)?
JAGS version
Full Matlab/Octave command window output of PAL_PFHB_SingleSubjectMultipleConditions
Nick Prins, Administrator
Manvi
Posts: 2
Joined: Tue May 23, 2023 6:06 am

Re: JAGS execution failed

Post by Manvi »

We are currently using the latest version of Palamedes toolbox (1.11.8) and still facing the same issue.

OS = Window 10
Matlab = version 2021b
Jags version = 4.3.1

Error message from the command window:

>> PAL_PFHB_SingleSubjectMultipleConditions_Demo
Use Stan or JAGS (either must be installed from third party first, see PAL_PFHB_fitModel for information)? Type stan or jags: jags

Prepping ....
Found MCMC sampler (or a way to build it) here:
C:\Program Files\JAGS-4.3.1
and will use it. This may or may not be the latest version that is installed. Type 'help PAL_PFHB_fitModel' for suggestions.
Waiting for JAGS to complete ....

Warning: Escaped character '\P' is not valid. See 'doc sprintf' for supported special characters.
> In PAL_PFHB_runEngine (line 78)
In PAL_PFHB_fitModel (line 303)
In PAL_PFHB_SingleSubjectMultipleConditions_Demo (line 47)
Error using PAL_PFHB_runEngine
Execution of JAGS failed. Palamedes issued the command:
"C:

Error in PAL_PFHB_fitModel (line 303)
[status OSsays Syscmd] = PAL_PFHB_runEngine(pfhb.engine,pfhb.machine);

Error in PAL_PFHB_SingleSubjectMultipleConditions_Demo (line 47)
pfhb = PAL_PFHB_fitModel(data,'gammaEQlambda',true,'engine',engine,'nsamples',10000);

>>
User avatar
Nick Prins
Site Admin
Posts: 28
Joined: Sun Feb 13, 2022 8:55 pm

Re: JAGS execution failed

Post by Nick Prins »

Okay, thanks for that. It looks like Palamedes believes the JAGS executable is located in C:\Program Files\JAGS-4.3.1 but when it actually tries to execute it, it turns out it is not there. I think your Windows path variable is where Palamedes got the wrong location from. The location that needs to be included in the path variable is the exact folder that contains the jags executable. On your system that is probably C:\Program Files\JAGS-4.3.1\x64\bin. It could also be: C:\Program Files\JAGS\JAGS-4.3.1\x64\bin (that's what it is on my Windows machine after installing jags from sourceforge). To verify that that folder contains a working jags executable, maneuver to that folder in your windows terminal (not your matlab or octave terminal) and then type 'jags' (without quotes) followed by enter. That should start JAGS and produce a 'welcome to JAGS' message among other things. Once you update your Windows path variable, things should work (but note that Matlab needs to be restarted for the updated path variable to take effect). Another option is to use the 'enginepath' argument in the call to PAL_PFHB_fitModel. Change line 47 in PAL_PFHB_SingleSubjectMultipleCondition_Demo.m to:

pfhb = PAL_PFHB_fitModel(data,'gammaEQlambda',true,'engine',engine,'nsamples',10000,'enginepath','c:\Program Files\JAGS\JAGS-4.3.1\x64\bin');

(after making sure that the path provided indeed contains the jags executable). You would need to make a similar change in all calls to PAL_PFHB_fitModel (there are 3 in PAL_PFHB_SingleSubjectMultipleConditions_Demo.m: lines 47, 77, and 82).

Let us know whether that works or not.
Nick Prins, Administrator
Aoibheann
Posts: 3
Joined: Thu May 18, 2023 6:12 am

Re: JAGS execution failed

Post by Aoibheann »

Hi, we ended up uninstalling Matlab and reinstalling and that fixed the error.

Thanks for your help
Post Reply