476 questions
1
vote
1
answer
98
views
Cannot set value of non-variable node in JAGS Bayesian modelling for survival using CJS analysis
library(jagsUI); library(nimble)
data_complete <- read.csv("wd.csv", colClasses = c("ch" = "character"))
table_combo <- table(data_complete$mb, data_complete$fb)
...
1
vote
0
answers
38
views
JAGS model insensitive to data
I am new to JAGS and working on an assignment for a class. I have been trying to get my model to work for the past few hours and something just isn't clicking, and I hope someone here may be able to ...
0
votes
0
answers
53
views
Posterior Predictive Check for Dirichlet-Multinomial Model
Hi Bayesian modellers,
I have this model written in JAGS and I would like to conduct a Posterior Predictive Check.
model{
#loop observations
for (i in 1:numObs){
choice[i]~dcat(theta[catid[i],...
0
votes
0
answers
67
views
Log linear Bayesian hierarchical model specification in r using JAGS
Am familiar with model specification in this provided example with a Poisson distribution on N.lamb, N.ewe, and normal distribution on y.lamb, and y.ewe. I am interested in exploring this under a log-...
0
votes
1
answer
100
views
How to introduce a random error within a Bayesian count model?
I am trying to model counts distribute across groups in JAGS, but I need to add a random effect for the presence of multiple counts from the same individual.
The model is taken from here
enter link ...
1
vote
2
answers
41
views
R2JAGS output being placed in model text file instead of R object
I have been learning JAGS through Marc Kery's "Introduction to WinBUGS for Ecologists". When adapting the WinBUGS code from here for the first ch 5 example, I have been getting the odd ...
1
vote
0
answers
17
views
Pogit Model: Correlated or Orthogonal Covariates?
I’m working with the following Pogit model:
Y ~ Pois(lambdap)
log(lambda) = alpa_0 + alpha_1x_1 + alpha_2x_2
logit(p) = gamma_0+gamma_1t_1 + gamma_2*t_2
I’m conducting a simulation study with two ...
0
votes
0
answers
29
views
RJags Error: Index out of range of x when trying to calculate daily nest survival probability
I am attempting to create a daily nest survival probability that spans 4 years.
The model in question is the null model fitting only the intercept.
Model fitting in JAGs to estimate parameters using ...
1
vote
0
answers
45
views
Error using elements of D[i] inside a for-loop
I'm encountering an issue when trying to use the elements of the matrix D[i] inside a for loop in my JAGS model. The matrix D[i] is derived from a Wishart distribution, and when I try to use it within ...
0
votes
1
answer
224
views
JAGS n.adapt Parameter Not Working as Expected
I'm running a JAGS (JAGS 4.3.2) model in R using the rjags package (version 4.15), but I'm encountering an issue with the n.adapt parameter. Specifically, when I set n.adapt to any number like 1000, ...
0
votes
1
answer
57
views
JAGS: Just another GIbbs Sampler Possible Directed Cycle Error - Can't find
I'm adapting some open source code to look at how environmental and organismal variables effect infection probability. I have been getting an error that states that there is a possible directed cycle ...
0
votes
1
answer
158
views
How to convert WINBUGS code into JAGS/R code
I am trying to rerun the WinBugs code used in the paper 'A Bayesian Hierarchical Model for Risk Assessment of Methymercury'. I would like to be able to implement the same code but into JAGS (through ...
0
votes
1
answer
133
views
How to output sequence of hidden states on rjags after training the HMM model?
I am totally new in HMM and JAGS. My question is how can I get the hidden state sequence based on the trained model structure and parameters.
Specifically, I have trained a hidden Markov model by ...
0
votes
1
answer
36
views
" RUN TIME ERROR: Compilation error on line 12. Dimension mismatch taking subset of lambda"
I'm writing a model to use with JAGS but the return is :
" RUN TIME ERROR: Compilation error on line 12. Dimension mismatch taking subset of lambda"
But I dont know what to do more (I ...
0
votes
0
answers
54
views
Why is my JAGS output starting from 1000 not 0?
I am currently trying to use JAGS to do Bayesian analysis on the LakeHuron dataset on R. I cant seem to understand why when I plot the traceplots my iterations start from 1000 and run to 2000 even ...
1
vote
0
answers
107
views
Writing a hierarchical JAGS model for binomial data
I have binomial data that is split into several groups and data that corresponds to each data point, formatted like so:
df <- data.frame(bin=c(1,1,1,1,1,0,0,0,0,0), group1 = c(1,1,0,0,0,0,0,0,0,0), ...
1
vote
1
answer
70
views
Translating WINBUGS model to JAGS model: possible directed cycle
I am practicing Bayesian and trying to translate WINBUGS models into JAGS in R. I have looked the JAGS manual and still haven't been able to work out this one, which gives error - Possible directed ...
0
votes
0
answers
37
views
Fitting GLMMs in JAGS: Non-conforming parameters in function
I'm attempting to fit a Poisson GLMM in JAGS as per (AZuur, Hill & Reno 2013). I'm encountering the following error in R:
Error in jags.model(model.file, data = data, inits = init.values, n.chains ...
0
votes
1
answer
457
views
curl under Windows Server 2022 uses UNIX certificate store when called in GitHub action
I am using a GitHub Action in order to check an R package's functionality. In order to install a background dependeny (JAGS), I am using curl.exe:
- name: Install jags (Windows)
if: ...
2
votes
0
answers
55
views
define residuals in hierarchical jags model r
I have a jags model in R:
modelScript.name <- "rick.txt"
jagsscript <- cat("
model {
###priors####
alpha.m ~ dunif(1,100);
beta.m ~ dunif(0,1);
#FlowEff ~ dnorm(0,3);...
1
vote
1
answer
70
views
Shiny renderPrint don't capture all console output
I am trying to display the results from a JAGS model in my Shiny app. The functions show a progress bar in the console when called. I would like to display a summary of the results only and not the ...
1
vote
1
answer
173
views
Creating a derived parameter from sims.list within jags model
I am working on a combined integrated model/population viability analysis in jags, and am trying to create a derived parameter to use in my population projections.
In the current version of the model ...
0
votes
1
answer
127
views
JAGS compilation error: Invalid subset expression. Index expressions on the left hand side of a relation must define a contiguous
I'm trying to create a multi-species N-mixture model to calculate the abundance of animals using data from three repeated surveys at four different site types (with only one site surveyed for each of ...
0
votes
0
answers
84
views
Can you help me find why I get the "Error : Invalid parent values" in this JAGS code?
I'm fairly new to using JAGS and I'm trying to get a growth curve model over time with two levels of variable (drug test group + sex).
I'm running the following code but end up with : "Error in ...
0
votes
0
answers
342
views
how to obtain posterior predictives in rjags?
I would like to create a plot like this, where y is the observed data and yrep is the predictions using rjags:
I looked at the code from the example here: JAGS and R: Obtain posterior predictive ...
0
votes
1
answer
134
views
Failed to set trace monitor for X. Variable X not found
I'm trying to implement a Bayesian model for football score prediction (English Premier League). I assume the number of scores follows the Poisson distribution with parameter lambda and this is the ...
2
votes
2
answers
2k
views
How to install Rjags on Linux?
I am using my school's server, so I don't have admin power to install it through sudo-apt like here. So, I create a virtual environment Renv and used conda to install it as conda install -c conda-...
0
votes
1
answer
68
views
Rjags Compilation error dimensions mismatch
I am trying to code up a binomial Bayesian model and I get the following error:
Error in checkForRemoteErrors(val) :
3 nodes produced errors; first error: RUNTIME ERROR:
Compilation error on line 15.
...
0
votes
0
answers
58
views
Dimension mismatch in subset expression in R/JAGS
I am new to using rJags. I have a jags model in R (version 4.3.0 (2023-04-21 ucrt)) using rjags (rjags_4-14).
I am trying to add a random intercept of "creek" (Clean in the data below) to my ...
0
votes
0
answers
27
views
Rjags error: node inconsistent with parents works with one dataset but not the other
I have a jags model in R (version 4.3.0 (2023-04-21 ucrt)) using rjags (rjags_4-14).
The model runs without error for one dataset (named below: "works"). With a different dataset, which is ...
1
vote
0
answers
94
views
GAM in JAGS with missing data
I am trying to build a JAGS model that includes both cyclic smooths by week and covariate values that are estimated within the model. I can build a JAGS model that includes smooths using mgcv's jagam ...
0
votes
1
answer
54
views
Generating annual estimates of N of a binomial distribution
I'm trying to estimate N from a binomial distribution as in https://stats.stackexchange.com/questions/113851/bayesian-estimation-of-n-of-a-binomial-distribution. I have 40 years of counts and an ...
0
votes
1
answer
816
views
Categorical Data model with dirichlet prior using RJags
I am trying to write a model using jags. The problem is that I am really new to jags language. I have a dataset that is basically a survey with 6 questions and one predictive variable. All are ...
1
vote
1
answer
442
views
JAGS in R: Resulting MCMC chain does not start near initial values
I am running the code in this simple Rjags tutorial. Notice that the initial values of the parameters are specified by model.inits <- list(tau=1, beta0=1, beta1=0, beta2=0). I wanted to test that ...
0
votes
1
answer
346
views
Power prior in R2jags
In a fixed power prior model, the model is set up as:
Suppose that the event follows a Bernoulli distribution with probability p_i, what I want is to raise the Bernoulli likelihood to the power of w ...
1
vote
1
answer
290
views
How do I correct the error: RUNTIME ERROR: Compilation error on line 4. Index out of range taking subset of y
I've built a linear regression model using rjags but I am getting a runtime error saying the index is out of range. I've looked for advice online but can't find anything that I understand or addresses ...
0
votes
1
answer
56
views
Dimension mismatch taking subset in R/JAGS
I am trying to calculate transition probabilities from different states in R/JAGS. But I am getting the following error-
Error in jags.model(model.file, data = data, inits = init.values, n.chains = n....
0
votes
0
answers
47
views
Hidden state output from jags model in R
Does the "jags" function of R2jags give estimated states output when estimating a state space model?
Or is it to be derived manually using estimated mean/medians of parameter values.
0
votes
1
answer
114
views
Bayesian in R: Dimension mismatch in values supplied for betaA
I am working with a matrix that is 35 rows and 16 columns. I am trying to run a Bayesian Multistate Model but something in my model code prevents it from working. When I run the code in R, I get the ...
0
votes
0
answers
59
views
What's causing rjags "Node inconsistent with parents" error
I'm trying to run a bird occupancy model using rjags and I'm getting an error saying: Error in node ytb[1,2,9,1:5,1] Node inconsistent with parents. The vector that the error references is a vector of ...
0
votes
0
answers
256
views
What is causing a syntax error on last line of JAGS model?
I have created a model to investigate the effects of covariates on occupancy of different bird species at different points across different properties. However, when I try to run the model using rjags,...
0
votes
2
answers
291
views
No-Conforming parameters in inprod function in Jags
I am getting error. What does it mean by non-conforming parameters in Inprod()
Error in jags.model(model.file, data = data, inits = init.values, n.chains = n.chains, :
RUNTIME ERROR:
Non-...
0
votes
1
answer
297
views
jags model throwing error: "Index out of range taking subset of b1"
I'm trying to specify an occupancy model using rjags and I'm running into an error when it comes to running my model and the problem seems to be related to the specification my year effect which is ...
1
vote
1
answer
804
views
How to specify zero-inflated negative binomial model in JAGS
I'm currently working on constructing a zero-inflated negative binomial model in JAGS to model yearly change in abundance using count data and am currently a bit lost on how best to specify the model. ...
0
votes
0
answers
237
views
JAGS Hierarchical linear model - Extracting group mean for each parameter
I am creating a Bayesian linear regression model to predict points scored by players in a game using R and JAGS. I have 5 predictors, and the basic linear regression model is of the form:
points = ...
0
votes
1
answer
454
views
Latent variable estimation with binary and continuous indicators in JAGS
I am using R2jags to estimate latent factor using both binary and continuous variables. I was wondering wether jags command from R2jags can handle both binary and continuous variables at the same time....
1
vote
1
answer
249
views
Can JAGS (Just Another Gibbs Sampler) deal with ordinary differential equations?
I searched about the JAGS's manual and one post (here in 2012) about the ordinary differential equation (ode). I was thinking JAGS can because it's similar to WinBUGS (which does it through WBdiff ...
0
votes
1
answer
290
views
Syntax error when trying to parse Bayesian model using RJAGS
I'm running the following code to attempt Bayesian modelling using rjags but coming up with the syntax error below.
Error in jags.model(file = "RhoModeldef.txt", data = ModelData, inits
= ...
0
votes
1
answer
53
views
Bayesian Analysis in R: Compilation error on line 19
I am working with a dataframe with 234 rows of 4 variables: Fish Age, Mercury Concentration (Hg), Distance from Mouth, and Site #. I am trying to run a multi linear regression to see how Age and ...
2
votes
0
answers
902
views
most efficient way of using categorical independent variables in a JAGS bayesian model
I am trying to run a logistic regression model in JAGS, with a binomial response (rather than Bernoulli process) and wish to model month as a categorical variable. I can easily model month as a ...