Dear all, I am considering a mixture Poisson model with two components. The problem is described in the attachment. Thank you, B.
Hi runjags community, I am having an issue with runjags recognizing where jags is installed. I am using the USDA Ceres cluster (Linux system). JAGS 4.3.2 is installed in the 'project/carib_fia/james.hogan/JAGS' folder. I can dyn.load the libjags.so.4 from there and get R2jags to link to JAGS, but for some reason, I cannot get runjags to find where JAGS is (see picture attached; code is below): sessionInfo() ## dynamic load JAGS dyn.load('/project/carib_fia/james.hogan/JAGS/4.3.2/lib/libjags.so.4')...
thankyou so much for your solution. My problem has been solved. This is my code before : CXX="g++ -m64" \ ./configure LDFLAGS="-L/c/Progra~1/JAGS/JAGS-4.3.0/x64/bin" CXXFLAGS="-I/c/Progra~1/JAGS/JAGS-4.3.0/include" make win64-install And this is the solution code : CXX="g++ -m64" \ ./configure --host=x86_64-w64-mingw32.static.posix LDFLAGS="-L/c/Progra~1/JAGS/JAGS-4.3.1/x64/bin" CXXFLAGS="-I/c/Progra~1/JAGS/JAGS-4.3.1/include" make win64-install After I run that code, it created the dll file
Dear all, I tried modifying the runjags package and there was an error when devtools::test() was run with an error notification Error (test-basic_example.R:2:3): basic example works Error in neojags:::load.neojagsmodule(): The internal neojags module is not installed - please reinstall the full version of the package from CRAN, or alternatively you can download a standalone version of the JAGS module from the sourceforge page at http://sourceforge.net/projects/neojags/ Backtrace: 1. neojags:::example_neojags()...
Dear all, I tried modifying the runjags package and there was an error when devtools::test() was run with an error notification Error (test-basic_example.R:2:3): basic example works Error in neojags:::load.neojagsmodule(): The internal neojags module is not installed - please reinstall the full version of the package from CRAN, or alternatively you can download a standalone version of the JAGS module from the sourceforge page at http://sourceforge.net/projects/neojags/ Backtrace: 1. neojags:::example_neojags()...
Dear all, I tried modifying the runjags package and there was an error when devtools::test() was run with an error notification Error (test-basic_example.R:2:3): basic example works Error in neojags:::load.neojagsmodule(): The internal neojags module is not installed - please reinstall the full version of the package from CRAN, or alternatively you can download a standalone version of the JAGS module from the sourceforge page at http://sourceforge.net/projects/neojags/ Backtrace: 1. neojags:::example_neojags()...
Dear all, I tried modifying the runjags package and there was an error when devtools:test() was run with an error notification Error (test-basic_example.R:2:3): basic example works Error in neojags:::load.neojagsmodule(): The internal neojags module is not installed - please reinstall the full version of the package from CRAN, or alternatively you can download a standalone version of the JAGS module from the sourceforge page at http://sourceforge.net/projects/neojags/ Backtrace: 1. neojags:::example_neojags()...
I just wanted to pop in and say I have the same issue (Mar 5 2023). It was only a run of 3K iterations (burnin 100, adapt 2K, 3 chains) and the output shouldn't have been enormous as far as monitored variables. A bit of a bummer to wait 5 days and have it produce no output.
This is really a question for the JAGS forum (https://sourceforge.net/p/mcmc-jags/discussion/) as it doesn't seem to involve runjags. However, before you post there, I would include more information detailing exactly you have done so far - i.e. all the steps for how you are compiling, not just "when I compile it" - as well as a link to the source code you are trying to compile. In case you are not aware of it, there is also an article that explains how to create a module (https://psycnet.apa.org/record/2014-07832-002),...
This is really a question for the JAGS forum (https://sourceforge.net/p/mcmc-jags/discussion/) as it doesn't seem to involve runjags. However, before you post there, I would include the following information: Platform you are running on (Windows?) and what compiler toolchain you are using (Rtools?) What exactly you have done so far - all the steps not just "when I compile it" - as well as a link to the source code you are trying to compile In case you are not aware of it, there is also an article...
I use JAGS 4.3.1 msys in Rtools4.2 . I already compile paretoprior modules but also doesn't create any file .dll
Dear all, I try to add new modules into JAGS. When I compile it, there’s no error massage, but it doesn’t create any file .dll in sub-folder of modules , it’s only create file .a and .la . Do anyone know what happen? Thank you so much! -Syf.
Hi Matt, I had a sort of similar problem with the dgenpareto module in R jags. Recently, I have updated my R, Rstudio, and rjags packages. Below are the platform/versions I am running my R scripts on/with: version _ platform x86_64-w64-mingw32 arch x86_64 os mingw32 crt ucrt system x86_64, mingw32 status major 4 minor 2.0 year 2022 month 04 day 22 svn rev 82229 language R version.string R version 4.2.0 (2022-04-22 ucrt) nickname Vigorous Calisthenics library(runjags) Warning message: package ‘runjags’...
Dear Matt, thank you very much! It works on Windows as well. Thank you for your time and have a nice rest of the day. Best, Frantisek
OK thanks - this reminded me that there is a difference between a Fork cluster (default on macOS/Linux) and PSOCK cluster (the only thing available on Windows) in that the latter does not share the full environment of the parent process. By forcing my machine to use a PSOCK cluster I was able to replicate your issue. The solution is to set up the cluster manually and make sure your package is loaded before running the model: library("parallel") cl <- makePSOCKcluster(2) clusterCall(cl, function(x)...
Hi Matt, thank you for the quick reply! I'm also running 3.6.3 but on Windows. I quickly checked with friends and they verify that it runs on MacOS and Linux, but also have problems with Windows. Also, the modules argument does not seem to be neccessary. I get the following error on Windows: > runjags::autorun.jags( + model = model_syntax, + data = data, + monitor = "omega", + n.chains = 2, + method = "rjparallel", + modules = "RoBMA" + ) Auto-run JAGS Running a pilot chain... Compiling rjags model......
Hi František Your example works fine for me on R 3.6.3 for macOS (CRAN build). But I am behind with updating R (and a lot of other things) due to uexpected commitments working on COVID so it might be that this is an issue under R 4.x Can you confirm on what version of R (and what platform) you see the error and also describe the problem in more detail? Then I will try and look into it when other duties permit. Note: I would NOT expect the "parallel" or "background" methods to work (and they don't)...
Hi, I'm developing a package that uses runjags and I wanted to add chain parallelization. However, I'm getting an error because my JAGS module that I distribute with the package as can't be found. I found an argument that is dedicated for the modules specification, but I'm not able to make it work. There is a reproducible example (the non-parallel alternative works perfectly) : library("RoBMA") model_syntax <- ' model{ for(j in 1:2){ eta[j] ~ dgamma(1, 1) } for(j in 1:2){ std_eta[j] = eta[j] / sum(eta)...
Hi, I run a model using run.jags() for 1 week and I have the same error with you when 2 chains have finished. Could you tell me how to solve this problem? Help!
I'm trying to run a fairly substantial model in a parallelized way. I'm getting an error on the step where results are read back in to R after the chains finish running. According to the output, all chains finish successfully, but then it doesn't look like the results files get written. Output is copied below. Any ideas on how to approach debugging this? Thanks for any help you can provide! Loading required package: coda [1] "nchains: 10" [1] "nsamples: 80000" [1] "nadapt: 1000" [1] "nburnin: 1000"...
Considering that it's been over a day and it's apparently still not starting the simulation, I probably need to do some rethinking, yes! This entire project has been driving me insane because the model and the dataset in combination are so computationally demanding. Again, I appreciate your responsiveness immensely.
No problem. Thanks for reporting the issue with drop.k! You should see the "Testing the model and data for simulation 1..." message before any simulation starts, but some data checking etc occurs before this point so it might take a while to get there with such a large dataset. In general these types of computationally intensive model validation methods are really only feasible with models that compile and run quickly, so to be honest the run.jags.study function was not designed (or tested) for big...
Matt!! This is so helpful, and I appreciate it more than you know. I'm trying a test with just one simulation that drops 10% of the data, and I was wondering how you can tell when it's reached the simulation stage. This is the code I'm running now: datafit <- run.jags.study(simulations=1, model=model, datafunction=datafun_drop10pc, targets=list(y=y), monitor=params, data=datalist_study, inits=list(chain1, chain2, chain3)) It's been about an hour and I haven't yet seen the "Testing the model and data...
As I said before the problem is a bug in drop.k - or specifically the way in which it is trying to automatically deduce which data points to drop for each simulation (for this example it ends up dropping data points unrelated to y, hence the error). The short-term solution is to workaround this problem by specifying the function to drop the correct data points directly to the run.jags.study function. Some example R code for a toy example is attached. For your example you need to replace the drop.k...
Apologies for the delay in replying. I can reproduce the error with what you sent me so no need for the attachment, thanks. It looks like a bug in drop.k - quite possibly related to the other bug reported in this thread, although I haven't quite had chance to nail down where it is coming from yet. I think the best short-term workaround for you will be to use the underlying run.jags.study function directly - I will get back to you ASAP.
(Hmm, it looks like the attachment is still too big, so please let me know if it would be helpful to have it and I will send it to you another way. )
Coming back to say that since the model takes an extremely long time to run (though I suppose you could reduce the number of iterations), I'm also attaching a zip file containing results that you can use to test the drop.k() function. Thank you again!
Hi Matt, you're a rock star; thanks for being willing to take a look. I'm attaching the script and a data file (loaded in the script as jags_data. I used file.choose() here to load it for simplicity's sake. The data file is called pheno_tidy_disp.csv.)
The error is coming from the following line: for (j in 1:n){ For some reason the data variable n is not being passed through to JAGS when running drop.k - this is a bit strange as you say it works when running locally. I am not sure why this might be without seeing the function call to drop.k though; can you give the exact R code you are using (preferably as an attached R script file) showing the call to run.jags that works and the call to drop.k that gives an error. If possible it would also help...
Hi Matt, I'm still struggling to fix this problem, and I know it's not your job to help everyone who uses your package (which is awesome and I'm so grateful for it) but if you could even give me a hint of how to approach it I would be in such a better position. The complete model is attached:
Thanks for the quick response. Sorry for my ignorance, but I am not sure how I can address the issue. If you have any idea how I can fix this, please let me know.
It sounds like a variable giving the upper limit of a for loop is not defined. If it worked locally but doesn't work when running the model via drop.k it is probably defined in some data that is not being correctly passed through drop.k to the model.
Hmm. Ok, I need to think on that. In any case, this is eventually ended with an error: Error: The following error occured when compiling and adapting the model using rjags: Error in rjags::jags.model(model, data = dataenv, inits = inits, n.chains = length(runjags.object$end.state), : RUNTIME ERROR: Compilation error on line 86. Cannot evaluate range of counter j "j" is my datapoints. I'm not sure what is going on here, since the model itself compiled and ran successfully to begin with. Any insight?...
That depends - the function (currently) isn't smart enough to actively kill JAGS if the simulation has taken more than 15 minutes; the max.time parameter is only used when JAGS returns a simulation that has either not converged and/or obtained a high enough effective sample size. At that point, if either the simulation has already taken longer than 15 minutes or the expected time to finish burnin or obtain sufficient effective sample size would be more than 15 minutes, then runjags returns an unconverged...
Hi Matt, quick question: If I specify "simulations=1" and don't include a max.time, should I expect the test to be finished in somewhere reasonably close to 15 minutes (the default max)? I have a test like that that's been running over half an hour now. Thanks!
Maybe you have already seen this, but the new version of modeest (2.3.2) can lead to warnings like Warning message: In runjags.summaries(fullmcmclist = mcmc, thinnedmcmclist = thinnedmcmc, : An unexpected error occured while calculating the mode I think that a small piece of line 280 of runjags.summaries.R needs to be deleted/commented out: return(modeest::mlv(x, ...)) #$M[1]) Best, Ed
Understood; thanks for the update!
There are a large number of changes required for the next release of runjags, and unfortunately due to other commitments I have not yet got it finished. I am hoping to have a pre-release version on sourceforge for testing purposes early in the new year. If you keep an eye on the Notifications page (you can sign up for alerts) then you will know as soon as it is available. I will make sure that this bug is fixed at least. Matt
Hi Matt, just wondering if the bug in getarraynames() has been fixed yet, because I'm getting the same error as Travis was—I can rename all the variable names in the model and re-run everything again, but if there's a way to get around that I'd be psyched. Thanks!
I have been using rjags for a multivariate normal model with unknown mean and variance. If I apply the model multiple times to the same dataset, I get very different results. I thought that I wasn't using enough iterations to get convergence, so I tried using runjags and the autorun.jags function to extend the simulations, and after 800K+ iterations, the Gelman-Rubin statistics was still above 1.05 for many of the parameters. I also get a note "unable to calculate the multi-variate psrf." I have...
Hi Jeff Apologies for the delay in replying. The error is happening while translating your data from the R representation to a character representation (as required to be read by JAGS) - I have never seen this error before but I guess the 3 dimensional arrays in your data are quite large and the error is coming from that. In order to get around the problem you could try to provide the data to the run.jags function as a character string rather than a list - see ?dump for a way to generate character...
A call to run.jags() is producing the following error message: Error in paste(value[[i]], collapse = ", ") : result would exceed 2^31-1 bytes I tried passing the argument sample = 0 and the error persisted, so it is happening during model creation. The model is large and has some 3-dimensional arrays. I tried removing arrays from the list of monitored parameters, but the error persisted. Does anyone have an idea of what is causing this error or possible options to avoid it? Thank you, Jeff
Thanks, that's exactly what I was looking for, and exactly what I would have never figured out by myself! Ed
Hi Ed Good question - to which the answer is 'kind of'. Or more precisely: 'no - but there is an ugly hack'. Before the ylab variable is evaluated (in a function deep inside runjags) the 'col' and 'varname' variables are assigned to the calling environment. So if we can map the current variable name to the desired variable name, then you can use a switch statement wrapped inside an expression statement (we need to force lazy evaluation because 'varname' is not known at the time of the call to plot())....
Is there a way to modify the axis labels on trace plots? I ran the first regression model in the examples of the run.jags() help file. Then I tried this command: plot(results, "trace", trace.options=list(ylab=c("1","2","3"))) which gives me the label "1 2 3" on all three panels of the plot. I also tried supplying a list to the ylab argument instead of a character vector, and I tried using the panel argument instead of ylab with no luck (but reading the lattice documentation brought back fond memories)....
Sorry for the delay in replying - I have been away from work for a couple of weeks. I am not entirely sure what is going on as I cannot reproduce your results, but my best guess is that the error happened while reading the CODA files (possibly because you are trying to read a lot of parameters for 200,000 iterations?). Could you give me some more information on e.g. the model and monitored variables requested etc? In the meantime some observations that might help: 1) If your simulation takes 2 weeks...
Hi, this just happened again—exactly the same error messages—and I could really use support figuring it out because this is a huge model and it's insane that it gets all the way to the end and then crashes somehow. Running the following just returns the same messages again. Help! results.jags("/private/var/folders/hn/fgc198pn2bg54lhqdf4fdsgw0000gn/T/Rtmpk7SA4m/runjagsfiles2d96c20378e", recover.chains=TRUE)
Hi, this just happened again—exactly the same error messages—and I could really use support figuring it out because this is a huge model and it's insane that it gets all the way to the end and then crashes somehow. Running the following just returns the same messages again. Help! results.jags("/private/var/folders/hn/fgc198pn2bg54lhqdf4fdsgw0000gn/T/Rtmpk7SA4m/runjagsfiles2d96c20378e", recover.chains=TRUE)
Hi there, I spent 2 weeks running a large model and when it finally finished I got the following error messages. I don't think the simulations failed, because when that has happened in the past I've seen a drop in CPU usage due to one or more cores not being used. That leaves the mysterious "error in processing results", plus the bug mentioned below associated with a missing file in the root simulation directory. I'm not sure how to fix either of these. I obviously want to prevent this from happening...
Hi there, I spent 2 weeks running a large model and when it finally finished I got the following error messages. I don't think the simulations failed, because when that has happened in the past I've seen a drop in CPU usage due to one or more cores not being used. That leaves "error in processing results", plus this bug with a missing file in the root simulation directory. I'm not sure how to fix either of these. I obviously want to prevent this from happening again—can you help? Thanks! I'm using...
Hi there, I spent 2 weeks running a large model and when it finally finished I got the following error messages. I don't think the simulations failed, because when that has happened in the past I've seen a drop in CPU usage due to one or more cores not being used. That leaves "error in processing results", plus this bug with a missing file in the root simulation directory. I'm not sure how to fix either of these. I obviously want to prevent this from happening again—can you help? Thanks! I'm using...
Great - glad it worked out! And thanks for reporting back - I will at some point create a cluster FAQ sheet (as it is probably the single most common source of strange problems with runjags), and it is extremely useful to have first-hand reports of success/failure on different systems.
Setting n.sims didn't change anything on GCE, but using makecluster() DID! Hooray! Thanks again, Matt.
You could try setting the n.sim option to runjags e.g. (adapted from the examples in the help file for ?run.jags): results <- run.jags(model, n.chains=8, inits=initlist, method="rjparallel", n.sims=2) Or you could try setting up your own cluster (either fork or psock) manually and then giving that to runjags: library(parallel) cl <- makeCluster(4) results <- run.jags(model, n.chains=8, inits=initlist, method="rjparallel", cl=cl) [See the help file for ?makeCluster for more options] But my best guess...
Hi Matt, that makes sense—I figured it was an issue with GCE, and eventually realized that I could try rjparallel instead. This doesn't throw up the error! But the parallelization still isn't happening (only 1 core is being used). Is there something else I need to do to get this to work? This may be a question that's already been asked and answered, so I'll do some searching as well. Thanks so much!
That looks like an issue with the Google Compute Engine restricting access to certain utilities (in this case ps which is used by runjags to kill the relevant JAGS instances if the user aborts the simulation). It is common (and sensible) for remote access clusters to impose such restrictions, but this seems to differ a lot between clusters, and I don't use Google Compute Engine so can't test it specifically. In this case runjags's attempt to use ps is actually unnecessary - it is not possible for...
P.S. One of the strangest things about this error is that I don't get it when I execute the exact same code on my laptop (which doesn't have multiple cores, which is why I want to be able to run it in the cloud).
Matt, thank you so much for your helpful response. I've set overdispersed initial values for each of my 3 chains, but am now running into a new issue. In addition to the system error below (I understand that the warning message doesn't actually signal an error), I don't think the parallelization itself is working, since I only see 1 core being used in the few minutes before the error message appears. (I'm running this on a 4-CPU Google Compute Engine instance.) Thanks for any advice you can offer!...
Matt, thank you so much for your helpful response. I've set overdispersed initial values for each of my 3 chains, but am now running into a new issue. In addition to the system error below (I understand that the warning message doesn't actually signal an error), I don't think the parallelization itself is working, since I only see 1 core being used. (I'm running this on a 4-CPU Google Compute Engine instance.) Thanks for any advice you can offer! mod_lags <- autorun.jags(model="phenomodel_flowerfruitseed.jags",...
If you leave the default argument autorun.jags(..., inits=NA) then JAGS takes all initial values from the middle (either mean or mode depending on the distribution) of the prior. This is generally NOT recommended because (1) it is the same values for all chains so convergence disgnostics that compare chains are less useful to persuade yourself that the model has converged and (2) occasionally you will find that initial values taken from the middle of the priors results in a model that won't compile...
Hi there—can anyone help me out with the specific argument I need to use to get autorun.jags to draw all initial values for my (rather complicated) model from the prior distributions specified in the model? I'd like to do this for all 3 chains I'm planning to run in parallel, and have already learned that failing to specify inits leads JAGS to use the same initial starting values for all chains—definitely not what I want. Thanks so much!
Hi there—can anyone help me out with the specific argument I need to use to get autorun.jags to draw all initial values for my (rather complicated) model from the prior distributions specified in the model? I'd like to do this for all 3 chains I'm planning to run. Thanks so much!
Hi there—can anyone help me out with the specific argument I need to specify to get autorun.jags to draw all initial values for my (rather complicated) model from the prior distributions specified in the model? I'd like to do this for all 3 chains I'm planning to run. Thanks so much!
Dear Forum, I added a logF distribution into runjags module, but i failed to compile it. This is my code in DLogf.h #ifndef DLOGF_H_ #define DLOGF_H_ // Checks the JAGS version and sets necessary macros: #include "../jagsversions.h" #ifndef INCLUDERSCALARDIST #include <distribution/RScalarDist.h> namespace jags { #else #include "jags/RScalarDist.h" #endif /* INCLUDERSCALARDIST */ namespace runjags { /** * <pre> * * </pre> * @short Normal distribution */ class DLogf : public RScalarDist { public:...
Dear Forum, I added a logF distribution into runjags module, but i failed to compile it. This is my code in DLogf.h #ifndef DLOGF_H_ #define DLOGF_H_ // Checks the JAGS version and sets necessary macros: #include "../jagsversions.h" #ifndef INCLUDERSCALARDIST #include <distribution/RScalarDist.h> namespace jags { #else #include "jags/RScalarDist.h" #endif /* INCLUDERSCALARDIST */ namespace runjags { /** * <pre> * * </pre> * @short Normal distribution */ class DLogf : public RScalarDist { public:...
Dear Forum, I added a logF distribution into runjags module, but i failed to compile it. This is my code in DLogf.h #ifndef DLOGF_H_ #define DLOGF_H_ // Checks the JAGS version and sets necessary macros: #include "../jagsversions.h" #ifndef INCLUDERSCALARDIST #include <distribution/RScalarDist.h> namespace jags { #else #include "jags/RScalarDist.h" #endif /* INCLUDERSCALARDIST */ namespace runjags { /** * <pre> * * </pre> * @short Normal distribution */ class DLogf : public RScalarDist { public:...
Dear Forum, I added a logF distribution into runjags module, but i failed to compile it. This is my code in DLogf.h #ifndef DLOGF_H_ #define DLOGF_H_ // Checks the JAGS version and sets necessary macros: #include "../jagsversions.h" #ifndef INCLUDERSCALARDIST #include <distribution/RScalarDist.h> namespace jags { #else #include "jags/RScalarDist.h" #endif /* INCLUDERSCALARDIST */ namespace runjags { /** * <pre> * * </pre> * @short Normal distribution */ class DLogf : public RScalarDist { public:...
My problem was solved by your suggestion. Thank you.
That is not the way to solve your first problem. You need to add the library jrmath, which provides the missing symbols jags_qF, jags_pF, jags_dF when you compile the shared object runjags.so by modifying the file src/Makevars.in. The line PKG_LIBS=-L@JAGS_LIB@ -ljags @JAGS_RPATH@ should be changed to PKG_LIBS=-L@JAGS_LIB@ -ljags -ljrmath @JAGS_RPATH@ and you will need to modify Makevars.win if you want to compile your modified package on Windows.
Dear Forum, I added a logF distribution into runjags module, but i failed to compile it. This is my code in DLogf.h #ifndef DLOGF_H_ #define DLOGF_H_ // Checks the JAGS version and sets necessary macros: #include "../jagsversions.h" #ifndef INCLUDERSCALARDIST #include <distribution/RScalarDist.h> namespace jags { #else #include "jags/RScalarDist.h" #endif /* INCLUDERSCALARDIST */ namespace runjags { /** * <pre> * * </pre> * @short Normal distribution */ class DLogf : public RScalarDist { public:...
I have successfully fixed the code so it can be compiled. I convert JRmath to Rmath, dF to df, pF to pf and qF to qf. However, when I use this distribution, runjags (JAGS) do not report the DIC value. Why JAGS can't calculate DIC for this distribution? Thank you.
Dear Forum, I added a logF distribution into runjags module, but i failed to compile it. This is my code in DLogf.h #ifndef DLOGF_H_ #define DLOGF_H_ // Checks the JAGS version and sets necessary macros: #include "../jagsversions.h" #ifndef INCLUDERSCALARDIST #include <distribution/RScalarDist.h> namespace jags { #else #include "jags/RScalarDist.h" #endif /* INCLUDERSCALARDIST */ namespace runjags { /** * <pre> * x ~ DNeonorm(mu, tau) * f(x | mu, tau) = sqrt(tau) * exp(-1/2 * tau * (x - mu)^2) *...
Dear Forum, I added a logF distribution into runjags module, but i failed to compile it. This is my code in DLogf.h #ifndef DLOGF_H_ #define DLOGF_H_ // Checks the JAGS version and sets necessary macros: #include "../jagsversions.h" #ifndef INCLUDERSCALARDIST #include <distribution/RScalarDist.h> namespace jags { #else #include "jags/RScalarDist.h" #endif /* INCLUDERSCALARDIST */ namespace runjags { /** * <pre> * x ~ DNeonorm(mu, tau) * f(x | mu, tau) = sqrt(tau) * exp(-1/2 * tau * (x - mu)^2) *...
The short answer is yes: or at least that is the intention, so if it doesn't work it is a bug of some kind. I've tested it with a few different models and not had a problem so it must be something to specific to your situation I'm afraid. Is there any chance you would be able to share the saved model object (privately), or (even better) a reproducible example using simulated data? Thanks, Matt
Hi Forum, Can a saved runjags object be extended after the original R session has ended, and the runjags object loaded from a saved location? I have tried to do this, but I receive the "invalid parent values" error, which I thought would not be an issue extending a model that has already run to completion. Best regards, and thanks, Matt
I agree, you're off the hook ;-)
The only other advice I can give is to contact your cluster admins I'm afraid - it sounds to me as though that is where the problem is. If you can send them an example of a script that you know for sure worked before the upgrade then they might be able to tell you why it no longer works. In any case I don't think it has anything to do with the change in the version of JAGS.
OK, that's a bummer, I've been using the parallel method successfully for a long time. Thanks for your help trying to diagnose this.
Rather than submitting a single task that spawns multiple processes you may have better luck sending each chain to the cluster as a separate task, and then combining them later (locally) using combine.jags
I'm running with method="parallel", which I suspected could be interrupted if rjags was missing (I now see there's a separate method='rjparallel' option, so my hypothesis is not correct). I ran a test job on my remote cluster with method="simple" with just a few steps and it seems to have completed. Unfortunately, for time constraint reasons, I really need to use the parallel method.
Assuming you are using method='interruptible' (which is default if rjags is not loaded), that means that a terminate signal (e.g. ctl-c) was given to R while JAGS was running. I have no idea why that might happen on your cluster I'm afraid, but I can't see why it should have anything to do with rjags not being installed. A possible workaround might be to use either method='simple' (which does not require rjags) or method='rjags' (which obviously does) - these are probably more sensible on a remote...
The cluster admins installed R and JAGS, and I'm reinstalling everything else from scratch. I installed runjags first, with install.packages("runjags",configure.args="--with-jags-include=/path/to/include/JAGS --with-jags-lib=/path/to/JAGS/lib") and tried to run. The error I'm getting is: Error in runjags.start(model = runjags.object$model, monitor = c(monitor, : The JAGS process was terminated by the user I'm now thinking this could be because I have not installed RJAGS ( I'm now trying to troubleshoot...
Recent versions of the runjags package are compatible with both JAGS 3.x and 4.x (although the former will probably be removed soon), but the package must be compiled against the same version of JAGS that it will be used with. So if JAGS was upgraded and the R packages were left alone then runjags needs to be reinstalled. You will also need to update rjags (if you are using it). If that doesn't work it would be helpful to know exactly what error you are getting (mismatched versions should cause the...
Hi, My computing cluster underwent an upgrade/refresh, and the admins installed JAGS 4.3.0, where I had been using 3.4. I'm trying to figure out all the reasons why my jobs aren't running (changing paths, version upstream of runjags, etc) and I'm wondering if the newer version of JAGS could be one of the many reasons. Thanks, -Stephen
Thanks, Mr. Denwood. I just misunderstood the way the function works. I thought it would sample 10000, thinning by 2 along the way, to keep a remaining 5000. Matt
You have specified 10000 samples with a thin of 2, which means that JAGS is only storing every second iteration, so you need 20000 iterations to get 10000 samples, which is what happens. But if you look at the number of iterations stored (per chain) it should be 10000. As far as I can see this is the case e.g.: library('coda') library('runjags') X <- 1:100 Y <- rnorm(length(X), 2*X + 10, 1) model <- "model { for(i in 1 : length(Y)){ Y[i] ~ dnorm(true.y[i], precision); true.y[i] <- (m * X[i]) + c...
Hi. My version of run.jags seems to run 20000 iterations regardsless of what I specify in the "samples" statement. > cjagsout<-run.jags(model="my model", + monitor=parms2,data=forjags,n.chains=2,inits=j.inits,burnin=10000,adapt=1000, + sample=10000,thin=2,jags.refresh=60,method="rjags",modules = "glm on",summarise = TRUE) Compiling rjags model... Calling the simulation using the rjags method... Adapting the model for 1000 iterations... |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% Burning...
This helps, thanks so much Matt. I should have digged deeper in the runjags documentation. I was able to get runjags to install using the following: install.packages("runjags",configure.args = c("--with-jags-lib=/share/pkg/jags/4.0.0/install/lib"))
Hi Ryan Thanks for your message and sorry for the delay in replying - this somehow slipped through the net back in April. I have investigated the reported issue but I'm afraid I can't reproduce it. For example the following works as expected for me: X <- 1:100 Y <- rnorm(length(X), 2*X + 10, 1) # Model in the JAGS format model <- "model { for(i in 1 : N){ Y[i] ~ dnorm(true.y[i], precision); true.y[i] <- (m * X[i]) + c } m ~ dunif(-1000,1000) c ~ dunif(-1000,1000) precision ~ dexp(1) }" # Data and...
Hi Colin Thanks for your report. The runjags package is still using the same configure script as rjags 3.x, which assumes that the JAGS installation follows the same format as the R installation. However, there is a workaround for non-standard installs detailed in the README file within the runjags package: The configure script will try to guess the location of the JAGS library installation. It will look in /<prefix>/<lib>, where - <prefix> is the determined from the location of the jags script that...
Hello, I am trying to install the runjags package on a remote computer cluster. I am running R 3.4.0. I have JAGS 4.0.0 loaded, and can confirm that the rjags package will install and load. When I go to install the runjags package install.packages('runjags'), I get the following error: configure: error: "Cannot load JAGS library in /share/pkg/jags/4.0.0/install/lib64" I think part of the problem is that the directory /share/pkg/jags/4.0.0/install/lib64 does not exist in jags/4.0.0, but the directory...
I am getting an error with Results.Jags. After extending a model I am unable to import...
The format is described in ?runjags.options - note that the code that uses the option...
Hello all. I am wondering what the format for the timeout.import option is. I believe...
Thanks for the bug report. I have never seen this error before and I'm afraid I can't...
I am using R 3.2.4 and runjags runjags_2.0.4-2. In using results.jags to load model...
Just for anybody else reading this thread - there was a bug in drop.k that only manifested...
Hi Matt, Thanks for the response. I did try to limit the dimenstions in all sorts...