Questions tagged [rjags]

149 questions
0
votes
0 answers

How to avoid overdispersed Poisson regression overfitting?

I have a dataset including three variables including company id (there are 96 companies), expert id (there are 38 experts) and points given by experts to companies. Points are discrete values from 0 to 100. I tried fitting an overdispersed poisson…
Amin Shn
  • 532
  • 2
  • 11
0
votes
0 answers

Error while running R code after submitting a job

If I simply run the R code then it works. However, it does not work when I submit a job. I am trying to run myRcode.R file by submitting a job. Following is the .sh file: #!/bin/bash #PBS -N myRexample # Set job name to myjob #PBS -l nodes=1:ppn=2 #…
Hello
  • 61
  • 1
  • 9
0
votes
0 answers

"Error: Attempt to redefine node" in Mixture that changes size every iteration

My data has three columns Time, Interval, Count. I have a mixture of Poissons that goes like this mod_string = " model{ for(i in 2:length(Count)){ Count[i] ~ dpois(lambda.hacked[i]*z[i]+0.0001) z[i] ~dbern(p) lambda.hacked[i] <- mu[ clust[i]…
A Doe
  • 301
  • 2
  • 14
0
votes
1 answer

forest(relative.effect()) / Error in result[["model"]] : subscript out of bounds

I am trying to plot the results of a network meta-analysis. I have successfully generated the rank probabilities for each treatment relative to placebo. However, when I call forest(relative.effect(results.rank)) I encounter the following…
Sandro
  • 101
  • 7
0
votes
2 answers

JAGS: variable number of clusters

I am trying to run a Bayesian clustering model where the number of clusters is random with binomial distribution. This is my Jags model: model{ for(i in 1:n){ y[ i ,1:M] ~ dmnorm( mu[z[i] , 1:M] , I[1:M, 1:M]) z[i] ~…
Davide Maran
  • 134
  • 1
  • 7
0
votes
1 answer

R error (JAGS) Cannot insert node into alpha[1:284]. Dimension mismatch

I am sure there's a lot of errors with this code. I'm fairly new to JAGS, and just can't figure out this model. write("model { #priors lamda ~ dunif(0,1) p ~ dunif(0,1) mu~ dnorm(0,0.001) tau ~ dgamma(.001,0.001) #likelihoods for (i in…
0
votes
1 answer

Attempt to redefine node compilation error in JAGS

I am trying to run the following JAGS code from R. I am just showing some part of the code where the error is occurring. for(mmm in 1 : p){ for(jj in 1 : K){ vv[jj] ~ dbeta(1,1); } pp[1]…
Hello
  • 61
  • 1
  • 9
0
votes
1 answer

How to install rjags when instalaltion is failing with undefined symbol: _ZN4jags7Console10setRNGnameERKNSt[...]

install.packages("rjags") and the install.packages("rjags", configure.args="--enable-rpath") recomended in rjags's INSTALL fails with the following error: ** testing if installed package can be loaded from temporary location Error: package or…
jan-glx
  • 7,611
  • 2
  • 43
  • 63
0
votes
1 answer

Why does rjags give Dimension mismatch taking subset of y error here?

I have written this model but rjags gives dimension mismatch error; What's happening? Error in jags.model(textConnection(model1), data = jags_data, n.chains = n_chains, : RUNTIME ERROR: Compilation error on line 8. Dimension mismatch taking subset…
ie86
  • 157
  • 5
0
votes
1 answer

homebrew not installing JAGS

I'm trying to install JAGS through homebrew so I can use it in R. I am getting the following warning every time I install: Warning: jags dependency gcc was built with a different C++ standard library (libstdc++ from clang). This may cause problems…
ADF
  • 522
  • 6
  • 14
0
votes
0 answers

Bayesian logistic regression using rjags

I want to perform Bayesian logistic regression using package rjags. Unfortunately I end up being frustrated with an error msg Error parsing model file: syntax error on line 9 near ") which I can't interpret. Can anyone help. I am new to stack…
0
votes
1 answer

Does JAGS have a log function for bases other than e?

I am trying to calculate a log with base 2 in JAGS, but can't find a way to implement this. In the documentation I can't find a way to do this, and I am hoping I am missing something, or that someone knows a workaround. Thanks in advance for any…
0
votes
1 answer

Error messgae in JAGS when defining constraints for priors Attempt to redefine node

I am trying to sample from prior distributions and constrain some of the sums and differences to be greater than 0, however, when I run this code that usually works in OpenBugs/WinBugs, I get the following error 'Attempt to redefine node '. I was…
Martin
  • 171
  • 1
  • 7
0
votes
1 answer

How to randomly initialize the chains with Rjags?

I'm trying initialize the chains of the bayesian model randomly, today i do it inserting the values manually, like this: inits1 <- list("alpha" = 10, "beta" = 3.2, "lambda" = 2) inits2 <- list("alpha" = 18, "beta" = 7, "lambda" = 4.6) inits3 <-…
0
votes
0 answers

JAGS not recognizing values stored in R's global environment

I'm running JAGS with R v3.6.1 and Rstudio v1.2 in Windows 10, using package R2jags. JAGS does not appear to find the stored values that I've created in R for MCMC settings such as n.iter, n.burn-in, etc. because my code: out2 <- jags.parallel…
jj1995
  • 1
1 2 3
9
10