jags

if/else statement for defining a distribution in JAGS

流过昼夜 提交于 2020-12-10 08:51:06
问题 In JAGS I'd like to define a Poisson distribution for parameter w[i] which is also truncated (greater than or equal to 2) if another parameter, e[i], is greater than 0. Essentially I want it to represent: w[i] ~ ifelse( e[i] > 0, dpois(mu) T(2,) , dpois(mu) ) I've tried using the step function by adapting the code that was given in response to someone else's post which was requesting something similar: Choosing Different Distributions based on if - else condition in WinBugs/JAGS But this

Installing rjags in R on OSX Mavericks

試著忘記壹切 提交于 2020-02-04 09:02:37
问题 I am trying to install the package "rjags" in R but am running into the following error: Loading required package: rjags Error : .onLoad failed in loadNamespace() for 'rjags', details: call: dyn.load(file, DLLpath = DLLpath, ...) error: unable to load shared object '/Library/Frameworks/R.framework/Versions/3.1/Resources/library/rjags/libs/rjags.so': dlopen(/Library/Frameworks/R.framework/Versions/3.1/Resources/library/rjags/libs/rjags.so, 10): Symbol not found: _

JAGS: unit-specific time trends

十年热恋 提交于 2020-01-06 14:59:43
问题 Using JAGS I am trying to estimate a model including a unit-specific time trend. However, the problem is that I don't know how to model this and so far I have been unable to find a solution. As an example, consider we have the following data: rain<-rnorm(200) # Explanatory variable n1<-rnorm(200) # Some noise gdp<-rain+n1 # Outcome variable ccode<-rep(1:10,20) # Unit codes year<-rep(1:20,10) # Years Using normal linear regression, we would estimate the model as: m1<-lm(gdp~rain+factor(ccode)

JAGS: unit-specific time trends

半世苍凉 提交于 2020-01-06 14:59:26
问题 Using JAGS I am trying to estimate a model including a unit-specific time trend. However, the problem is that I don't know how to model this and so far I have been unable to find a solution. As an example, consider we have the following data: rain<-rnorm(200) # Explanatory variable n1<-rnorm(200) # Some noise gdp<-rain+n1 # Outcome variable ccode<-rep(1:10,20) # Unit codes year<-rep(1:20,10) # Years Using normal linear regression, we would estimate the model as: m1<-lm(gdp~rain+factor(ccode)