rjags

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

寵の児 提交于 2021-02-19 07:00:36
问题 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 density which I am struggling to make sense of. I thought perhaps the initial conditions were sending the beta distribution into infinite regions of parameter space but after some investigation that doesn't seem to be the case. Any thoughts on what this error

Dirichlet Multinomial model in JAGS with categorical X

南楼画角 提交于 2021-02-08 10:01:13
问题 Can someone help with JAGS code for a Bayesian multinomial logistic model with one categorical X variable (Dirichlet prior)? My representative sample is the matrix "z" in the code below that represents the 3 outcomes and "site", in the bottom line of code, is the categorical x variable. I can get the code that estimates each of the 3 outcomes but I'm stumped on how to add a categorical X (hospital site). I would like to use the first outcome, z[, 1], as the reference and 'a' as the reference

Dirichlet Multinomial model in JAGS with categorical X

时光总嘲笑我的痴心妄想 提交于 2021-02-08 10:00:22
问题 Can someone help with JAGS code for a Bayesian multinomial logistic model with one categorical X variable (Dirichlet prior)? My representative sample is the matrix "z" in the code below that represents the 3 outcomes and "site", in the bottom line of code, is the categorical x variable. I can get the code that estimates each of the 3 outcomes but I'm stumped on how to add a categorical X (hospital site). I would like to use the first outcome, z[, 1], as the reference and 'a' as the reference

Fitting a multivariate dirlichet model in JAGS for R

家住魔仙堡 提交于 2019-12-14 01:28:35
问题 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 some correlated fractional composition data. y1 <- runif(100,10,200) y2 <- y1*1.5 + rnorm(100, sd = 5) y3 <- runif(100,10,200) total <- y1+y2+y3 y1 <- y1/(total) y2 <- y2/(total) y3 <- y3/(total) y <- data.frame(y1,y2,y3) y is a data.frame of my

Fitting a poisson HMM JAGS model with RSTAN

别说谁变了你拦得住时间么 提交于 2019-12-11 18:12:02
问题 Walter Zucchini in his book Hidden Markov Models for Time Series An Introduction Using R, in chapter 8 page 129, adjusts a Poisson HMM using R2OpenBUGS, then I show the code. I am interested in adjusting this same model but with rstan, but since I am new using this package, I am not clear about the syntax any suggestion. data dat <- read.table("http://www.hmms-for-time-series.de/second/data/earthquakes.txt") RJAGS library(R2jags) library(rjags) HMM <- function(){ for(i in 1:m){ delta[i] <- 1