Updating manual
Updating command line interface for changes to monitors
Adding traceweight monitor
LOO monitors are inversely weighted by the likelihood
JAGS 4.3.2 misisng for Windows
Allow _observed_ or _observations_ to denote all observed stochastic nodes
randomSample will not changes observed nodes, or the fixes parts of partly observed nodes.
Adding logLikelihood method for partly observed multivariate normal.
Find weighted and total stats by computing on the string description.
Using new Node::logLikelihood method for likelihood monitors
Adding virtual Node::logLikelihood method
Documenting new monitor system
Adding infrastructure for partially observed nodes
Fixes to mcarray class
Ability to add custom functions
Fixes to print method for mcarray objects
Implement dimtags of an mcarray object as a separate attribute
Handle reserved names starting with underscore in parse.varnames
Commit missing man page for waic.samples
Aligning output of waic.samples with its documentation
Updating waic.samples
Distinguishing density and likelihood in the diag module.
Solution Vetting request
Add value names to SArray
Update for API changes in the JAGS library
Updates for changes to dim tags
Change dim tags to be an enumeration, not a string
@martyn_plummer I've got JAGS 5.0.0 and rjags_5-1 running with my code... but it seems to have some strange behaviour. Even when turning the mixture-node stuff off, for some reason (among other things) it is giving detection probability p as around 0.1 to 0.2, while JAGS 4.3.0 on exactly the same code is giving a much more reasonable looking 0.75 (the vast majority of individuals, 90%+, in the capture matrix have no gaps in their capture history). After a long time the distribution is slowly creeping...
Hi all, I'm transfering my project to HPC and in doing so I had to reinstall jags. I set the env variable for finding pkconfig and in the hpc terminal using my home folder installed R version, installing and loading rjags actually worked! However on my HPC they also offer interactive RStudio Server instances which I prefer for my tasks, which use the hpc-wide installation of R. But rjags didn't link. So I set environment variables (LD_LIBRARY_PATH, JAGS_HOME, PKG_CONFIG_PATH) to point to my jags...
@martyn_plummer I've got JAGS 5.0.0 and rjags_5-1 running with my code... but it seems to have some strange behaviour. Even when turning the mixture-node stuff off, for some reason (among other things) it is giving detection probability p as around 0.1 to 0.2, while JAGS 4.3.0 on exactly the same code is giving a much more reasonable looking 0.75 (the vast majority of individuals, 90%+, in the capture matrix have no gaps in their capture history). After a long time the distribution is slowly creeping...
@martyn_plummer I've got JAGS 5.0.0 and rjags_5-1 running with my code... but it seems to have some strange behaviour. Even when turning the mixture-node stuff off, for some reason it is giving detection probability p as around 0.1 to 0.2, while JAGS 4.3.0 on exactly the same code is giving a much more reasonable looking 0.75 (the vast majority of individuals, 90%+, in the capture matrix have no gaps in their capture history). After a long time the distribution is slowly creeping up so it may be...
Updates to SArray API
Changes to SArray API
Tidying up
Fix dimnames allocation reading data table.
Adding dimNames to monitors
CovMonitor always returns a square matrix
Updates to the Monitor class.
Tidying up
Documentation updates
Update part 2: I realised that the github hasn't been updated for 7 years and managed to get rjags working from the sourceforge code... now there's just a Node inconsistent with parents error which I suspect has been introduced by the addition of the mixture-node stuff. So, progress! Once I get to the bottom of that I'll report back on what happens next.
I don't have root privileges and looks like I can't get blas-devel or lapack-devel from the available modules on the system. I'll ask IT tomorrow if they can sort something out for me! Update: IT have kindly set up JAGS 5.0.0 for me, and my JAGS model compiles fine... but it seems to run very slowly, roughly an order of magnitude slower than the previous non-mixture-node version. I haven't managed to set up rjags_5-1 yet, so don't know if this is the issue. I've tried installing it using install_github("mcmc-jags/rjags",...
I don't have root privileges and looks like I can't get blas-devel or lapack-devel from the available modules on the system. I'll ask IT tomorrow if they can sort something out for me! Update: IT have kindly set up JAGS 5.0.0 for me, and my JAGS model compiles fine... but it seems to run very slowly, roughly an order of magnitude slower than the previous non-mixture-node version. I haven't managed to set up rjags_5-1 yet, so don't know if this is the issue. I've tried installing it using install_github("mcmc-jags/rjags",...
I don't have root privileges and looks like I can't get blas-devel or lapack-devel from the available modules on the system. I'll ask IT tomorrow if they can sort something out for me! Update: IT have kindly set up JAGS 5.0.0 for me, and my JAGS model compiles fine... but it seems to run very slowly, roughly an order of magnitude slower than the previous non-mixture-node version. I haven't managed to set up rjags_5-1 yet, so don't know if this is the issue. I've tried installing it using install_github("mcmc-jags/rjags",...
I don't have root privileges and looks like I can't get blas-devel or lapack-devel from the available modules on the system. I'll ask IT tomorrow if they can sort something out for me! Update: IT have kindly set up JAGS 5.0.0 for me, and my JAGS model compiles fine... but it seems to run very slowly, roughly an order of magnitude slower than the previous non-mixture-node version. I haven't managed to set up rjags_5-1 yet, so don't know if this is the issue. I've tried installing it using install_github("mcmc-jags/rjags")...
I don't have root privileges and looks like I can't get blas-devel or lapack-devel from the available modules on the system. I'll ask IT tomorrow if they can sort something out for me!
It looks like you are on an RPM-based Linux system which does not have the packages blas-devel and lapack-devel. Installing these package will give you an extra line /usr/lib64/libblas.so and /usr/lib64/liblapack.so respectively, when you run locate. Another thing to be aware of when you are installing on a RedHat-style Linux system is that you need to set an additional configuration option ./configure --libdir=/usr/local/lib64 This is annoying but there is a schism between RedHat-style and Debian-style...
Thanks! I tried to build the development version both on my Win11 work laptop and Linux HPC, and both are failing for different reasons... on the Windows system it's making it to make but failing at: make[4]: Entering directory '/c/jags-dev/src/lib/compiler' make[4]: *** No rule to make target 'parser.hh', needed by 'all'. Stop. On the Linux HPC in the ./configure step, it's not finding sgemm_ and returning configure: error: "You need to install the LAPACK library" despite GSL being installed by...
There is a compiler bug that slows down allocation of mixture nodes. In severe cases - like your model where you have recursively defined mixture nodes - the compilation appears to freeze completely. This is fixed in the development version which I am hoping to release in the next week or so as JAGS 5.0.0.
@iamjessclark Did you ever work out what was going on here? I'm having a similar issue with my JAGS model freezing at node allocation, which appears to be due to me using Bernoulli random variables e.g. s as indices e.g. phi[s+1]. Unfortunately I can't share the code and data right now, but I can put together an example that does the same thing if that would help.
Did you ever work out what was going on here? I'm having a similar issue with my JAGS model freezing at node allocation, which appears to be due to me using Bernoulli random variables e.g. s as indices e.g. phi[s+1]. Unfortunately I can't share the code and data right now, but I can put together an example that does the same thing if that would help.
The big difference between R and the BUGS language is that R is a procedural language, whereas BUGS is a declarative language. When you define a model in the BUGS language you are not giving a set of instructions for computing the desired result. Instead you are describing the static relationships between variables in the model. More specifically, you are defining a directed acyclic graph. Although the BUGS language may contain features that look like control flow statements, like for blocks and...
@martyn_plummer sorry for the thread necromancy... just wondering if there's a specific reason why both arguments are evaluated in ifelse in JAGS (unlike R)? I came up against this same issue and it took me some time to realise why, as I just assumed it worked like other languages. It would seem to me to be more efficient and easy for coding to only evaluate the relevant argument, but then I haven't written a programming language before so I'll defer to your wisdom!
@martyn_plummer sorry for the thread necromancy... just wondering if there's a specific reason why both arguments are evaluated in ifelse in JAGS (unlike R)? I came up against this same issue and it took me some time to realise why, as I just assumed it worked like other languages. It would seemto me to be more efficient and easy for coding to only evaluate the relevant argument, but then I haven't written a programming language before so I'll defer to your wisdom!
Explaining WAIC
Updates for R CMD check
Updates to monitor functions
I can certainly sign the binary for you. I have an active code signing key from Sectigo. The reason that there is no 4.3.2 binary for Windows is that the changes from 4.3.1 to 4.3.2 were for another platform (MacOS) and the Windows version is identical.
4.3.2 for windows - signed?
Hi Hanne, Can you also supply the data values you give to the first model so that your example is reproducible? Thanks.
Hi Jags community, I have recently learned to write models in JAGS and I am thus a novice. I wrote a JAGS simulation script to generate data which works perfectly. Then I have a complementary JAGS model description to test parameter recovery of the simulate dataset. However, I get the classic node-inconsistent-with-parent error. I can't see the cause, as I have: - taken a lot of time to set informative priors on my parameters - tested the model with setting initial values which did not ameliorate...
This fixed the issue and rjags is now running. Thank you so much! :)
The "procedure not found"/"prozedur nicht gefunden" message indicates a binary compatibility problem. Looking at your original message I see you are using JAGS-4.3.0. You should upgrade to JAGS-4.3.1, which is binary-compatible with recent versions of R.
Thank you for the suggestion! Unfortunately, I get the same output: Sys.setenv("R_TRACE_LOADNAMESPACE"=1) loadNamespace("rjags") - Laden “rjags” Fehler: .onLoad in loadNamespace() für 'rjags' fehlgeschlagen, Details: Aufruf: inDL(x, as.logical(local), as.logical(now), ...) Fehler: kann shared object 'C:/Users/laura/AppData/Local/R/win-library/4.5/rjags/libs/x64/rjags.dll' nicht laden: LoadLibrary failure: Die angegebene Prozedur wurde nicht gefunden The LoadLibrary failure seems odd to me, since...
It might be helpful to get more debugging information. Try Sys.setenv("_R_TRACE_LOADNAMESPACE_"=1) loadNamespace("rjags")
Hello everybody, I have been trying for quite a while now to get rjags running. The package can be installed as it seams, but when trying to load, following occurs: Fehler: Laden von Paket oder Namensraum für ‘rjags’: fehlgeschlagen .onLoad in loadNamespace() für 'rjags' fehlgeschlagen, Details: Aufruf: inDL(x, as.logical(local), as.logical(now), ...) Fehler: kann shared object 'C:/Users/AppData/Local/R/win-library/4.5/rjags/libs/x64/rjags.dll' nicht laden: LoadLibrary failure: Die angegebene Prozedur...
If I understand your code correctly, cluster_id1 is a vector of length N_groups=200 taking values from 1 up to nclusters=40. The most generic way to sum the adjusted prevalence in clusters is with for (j in 1:nclusters){ pcr_prev_cluster[j] <- sum(pcr_adj * (cluster_id1==j)) } If your clusters are ordered, you can create an index vector ind of length nclusters + 1 where ind[j] is the index of the first element of cluster j, so for example ind[1]=1, and the last element is ind[nclusters+1] = N_groups+1....
Hi! I'm sure there's a simple work-around for this, I just can't work it out! I have data that is grouped by clusters, each of 200 groups is assigned one of 40 clusters. I'm estimating an adjusted prevalence for each group, then want to sum them for each cluster. The code runs but it is only taking the first group of each cluster (variable cluster_id1). Attach text file here and pasted code below. model { for(i in 1:N_groups){ ####### Age-adjusted prev for each age group in each cluster ####### pcr_pos[i]~dbinom(pi[i],residents[i])...
Hi! I'm sure there's a simple work-around for this, I just can't work it out! I have data that is grouped by clusters, each of 200 groups is assigned one of 40 clusters. I'm estimating an adjusted prevalence for each group, then want to sum them for each cluster. The code runs but it is only taking the first group of each cluster (variable cluster_id1). Attach text file here.
Thank you so much! I didn't notice the mistake in my modelling. I will take your recommendation into consideration and think again about my models. Again, much thanks for the help!
This model is not correct: Y_i[i] ~ dbern(p_x[i]) p_x[i] <- phi(x[i]) x[i] ~ dnorm(mu, 1) It should be Y_i[i] ~ dbern(p_x[i]) p_x[i] <- phi(mu) which is equivalent to Y_i[i] ~ dinterval(x_i[i], 0) x_i[i] ~ dnorm(mu, 1) and you should get equivalent results from both models. My recommendation is to keep the definition of the model as simple as possible and not include the latent variables x_i[i] in your model. One disadvantage of putting in latent variables that have a hard a posteriori constraint...
Hi, I am currently working with binary data Y_i which = 1 when the hidden unobserved latent variable x_i > 0, x_i ~ Norm(mu, 1) I tried to model Y_i using the dinterval function provided in JAGS in the following way Y_i[i] ~ dinterval(x_i[i], 0) x_i[i] ~ dnorm(mu, 1) By reading the manual I find this viable because Y_i[i] ~ dinterval(x_i[i], 0) basically says Y_i[i] if x[i] > 0 and 0 otherwise This model yield less bias and better results for my following calculation of utility score using P(Y_i)...
I am trying to use posterior from one of my model (very complicated, and no known distribution) to be a prior for my next model, and I find this post useful: https://sourceforge.net/p/mcmc-jags/discussion/610037/thread/1f89e09d/?limit=25#cdf8. I wonder would it be possible to fit in a flexible continuous distribution (as the Interpolated class in PyMC: https://www.pymc.io/projects/docs/en/stable/api/distributions/generated/pymc.Interpolated.html ) instead of a discrete approximation? Thanks.
I am trying to use posterior from one of my model (very complicated, and no known distribution) to be a prior for my next model, and I find this post useful: https://sourceforge.net/p/mcmc-jags/discussion/610037/thread/1f89e09d/?limit=25#cdf8. I wonder would it be possible to fit in a flexible continuous distribution (as the Integrated class in PyMC: https://www.pymc.io/projects/docs/en/stable/api/distributions/generated/pymc.Interpolated.html ) instead of a discrete approximation? Thanks
I am trying to use posterior from one of my model (very complicated, and no known distribution) to be a prior for my next model, and I find this post useful: https://sourceforge.net/p/mcmc-jags/discussion/610037/thread/1f89e09d/?limit=25#cdf8. I wonder would it be possible to fit in a flexible continuous distribution (as the Integrated class in PyMC: https://www.pymc.io/projects/docs/en/stable/api/distributions/generated/pymc.Interpolated.html ) instead of a discrete approximation? Thanks
Hi Martyn. I have the same problem as Anja and I find this plot. Thanks very much for your reply and this is useful. I wonder would it be possible to fit in a continuous distribution instead of a discrete approximation? Thanks a lot!
Hi Martyn. I have the same problem as Anja and I find this plot. Thanks very much for your reply and this is useful. I wonder would it be possible to fit in a continuous distribution (using Spline for example) instead of a discrete approximation? Thanks a lot!
Hi Martyn. I have the same problem as Anja as I find this plot. Thanks very much for your reply and this is useful. I wonder would it be possible to fit in a continuous distribution (using Spline for example) instead of a discrete approximation? Thanks a lot!
You may be able to get it through bottlenecks in R GUIs by running your script in terminal / command line (I never use GUIs for large-n or large-p Bayesian tasks, based on annoyances and time lost). But if that doesn't work, I would recommend trying CmdStan as a more scalable, prior- and init-robust, and faster alternative. Your model code would need to be amended, but it is not unfamiliar syntactically.
Hi all, I've been trying to build a very large N mixture model. When I try to run it, JAGS does not even reach the stage of telling me that it's compiling before throwing the following error: "Error in parse(text = paste("list(", str, ")")) : negative length vectors are not allowed" My understanding from googling is that this occurs in R when a vector is very large (depending on which skimmed source I believe, 2^32, 2^31, 2^30, or one of those minus one). In the past, my problem has always been too...
Dear Professor Or To Whom It May Concern, I have a problem with JAGS. I need to install version JAGS 4.3.2.exe so that the MixSiar package in R can work. Unfortunately, version 4.3.2.exe is not available on the https://sourceforge.net/ website. The latest version is 4.3.1.exe. What's more, after installing this version, the MixSiar package in R does not work. From what I know, after installing JAGS, both "jags.exe" and "jags-terminal.exe" should be in the "bin" folder. Unfortunately, the lack of...
Hi everyone, I am facing the same issue. Here is my code. Can some one please help me out? I would really appreciate it. Error: Error in jags.model(file = "nt_test1.txt", nt.jags.data, inits, n.chains = 3, : Error in node y_do[2,2,1] Error calculting log density Code: nt.jags.data <- list(nCells_do=nrow(doall_y),nSites_do=4, nCells_bc=nrow(bcall_y),nSites_bc=4,nDay=3, y_do=doall_y,alt_do=alt_do_scaled, y_bc=bcall_y, alt_bc=bcall_alt, grid_do_id=do_id, grid_bc_id=bc_id, forest=df$forest,grass=df$grass,slope=df$slope,elevation=df$elevation,...
I am trying to run a JAGS model to estimate diagnostic tests and I am getting the following error: Error in checkForRemoteErrors(val) : 2 nodes produced errors; first error: RUNTIME ERROR: Compilation error on line 8. Dimension mismatch taking subset of x I double checked all the dimensions and everything seems correct so I am not sure why this error is occuring. Here is my code: dat <- read.csv("diagnostics_data.csv", header = TRUE) dat_matrix <- as.matrix(dat) n <- nrow(dat_matrix) # number of...
Try downloading the JAGS installer from https://sourceforge.net/projects/mcmc-jags/files/JAGS/4.x/Windows/JAGS-4.3.1.exe/download Then double click on the downloaded file to install JAGS 4.3.1.
rjags error
Finally fix OpenMP configuration on Windows.
Libtool needs hint to add -lgomp when linking to FLIBS on Windows
Bug fix
Remove F77 wrappers
Moving blas/lapack code into the main library
Name change dic -> diag handled by terminal, not by library
Fixing bashism in configure script after CRAN warning
Fixing bashms in configure script to fix CRAN NOTE.
Use short path for default JAGS_ROOT
Moving the diag module to directory diag
Rename dic module to diag
Work around name change of dic module
Change PenaltyMonitor to LeverageMonitor
Renaming some monitors in the dic module
Allow monitoring of covariance matrix for ValueMonitors