Questions tagged [rjags]

149 questions
9
votes
1 answer

Weird output of poisson GLM with an iid random effect in r

I am trying run rjags in R (via Rstudio) to estimate parameters alpha&beta and hyperparameter tau.nu of the model following: y_i|x_i~pois(eta_i), eta_i=exp(alpha + beta*x_i + nu_i), nu_i~N(0,tau.nu) there is my code: #generating data N = 1000 x =…
Yuki
  • 125
  • 5
7
votes
1 answer

How to install Rjags on Ubuntu

I am trying to install Rjags on Ubuntu, I have first installed this sudo apt-get install JAGS Then I have tried R install.packages("rjags") I have the following error > install.packages("rjags") Installing package into…
glouis
  • 541
  • 1
  • 7
  • 22
6
votes
1 answer

Three-level nested mixed-effects model

I am trying to model a three-level nested linear mixed effects model in rjags (by three-level: multiple observations for multiple individuals within multiple groups). There are unique sets of individuals in the groups. The equivalent model in lme4…
user2957945
  • 2,353
  • 2
  • 21
  • 40
5
votes
1 answer

Bayesian Multinomial Regression using rjags package

I am trying to fit a multinomial logistic regression model using rjags for the outcome is a categorical (nominal) variable (Outcome) with 3 levels, and the explanatory variables are Age (continuous) and Group (categorical with 3 levels). In doing…
Minh Chau
  • 83
  • 4
5
votes
2 answers

Apply a Bayesian model (JAGS) for various iterations

Consider the following data frame: set.seed(5678) sub_df<- data.frame(clustersize= rep(1, 4), lepsp= c("A", "B", "C", "D"), dens= round(runif(4, c(0, 1)), 3), db= sample(1:10, 4, replace=TRUE)) Let's say I…
Danielle
  • 785
  • 7
  • 15
5
votes
1 answer

Differences between rjags and r2jags

I use both packages in order to do Bayesian analysis but there are some differences that I don't understand: First of all the package rjags allows the adaptation phase, with the jags.model function, while the package r2jags does not have this phase,…
zick094
  • 63
  • 1
  • 5
4
votes
1 answer

Error: package or namespace load failed for 'rjags'

In one of my conda environments in terminal, I am able to successfully install the package 'rjags'. However, when I run R within that environment and run library(rjags), I get the following error: Loading required package: coda Error: package or…
merryberry
  • 91
  • 1
  • 9
3
votes
1 answer

Error: package or namespace load failed for ‘rjags’

I have a M1 Macbook Pro running OS Big Sur and just tried to install rjags and JAGS. I downloaded JAGS from https://sourceforge.net/projects/mcmc-jags/ without a problem, and ran install_packages("rjags"), but when I run library(rjags) I get this…
AFH
  • 665
  • 1
  • 9
  • 28
3
votes
1 answer

rjags installation error, can't find JAGS path on Windows

I'm having an issue getting rjags to load & run. I can install rjags, but it doesn't run because it can't find JAGS. My versions are listed below and are all updated to the latest versions. I'm also using a Thinkpad. JAGS Version: 4.3.0 RStudio…
3
votes
2 answers

Why is the model output from a fit with rjags and R2Jags different?

I'm working on fitting a multi-level logistic regression model with group level predictors. I am using JAGS via R. I am getting different behaviors when I fit the model with the runjags versus the R2Jags packages. I've tried to write a reproducible…
gregor-fausto
  • 435
  • 2
  • 9
3
votes
1 answer

How to overwrite value of observed node?

New to JAGS and working with a model referred in this paper. Looks like the authors used a previous version of JAGS that was closer to BUGS since at some point, this appears in the model block (lines 28-29): z[i,1:(K-1)] ~ dmnorm(etas[i,], omega) …
Paco Cruz
  • 73
  • 1
  • 8
3
votes
1 answer

Mixture prior not working in JAGS, only when likelihood term included

The code at the bottom will replicate the problem, just copy and paste it into R. What I want is for the mean and precision to be (-100, 100) 30% of the time, and (200, 1000) for 70% of the time. Think of it as lined up in a, b, and p. So 'pick'…
RP18912
  • 33
  • 2
3
votes
1 answer

Multiplying a vector of parameters by a matrix of independent variables in JAGS

I am fitting a multivariate model in JAGS using the dirlichet distribution. I have a matrix y of 3 species proportional abundances. #generate 3 columns of species proprotional abundance data y <- matrix(ncol = 3, nrow = 100) y[,] <-…
colin
  • 2,606
  • 4
  • 27
  • 57
3
votes
1 answer

Fitting a multivariate dirlichet model in JAGS for R

I am trying to fit a a multivariate model to species composition data using JAGS, implemented in R. I have data on 3 species relative abundances (bounded between [0,1]), two of which are correlated. Here is code to generate similar data. #generate…
colin
  • 2,606
  • 4
  • 27
  • 57
3
votes
1 answer

Error: "Slicer stuck at value with infinite density" running binomial-beta model in JAGS

I'm trying to run a binomial-beta model in JAGS (see example code below). I keep getting the error: Error: The following error was encountered while attempting to run the JAGS model: Error in node a0 Slicer stuck at value with infinite…
C Yeates
  • 33
  • 1
  • 3
1
2 3
9 10