0

I'd like to set up half-Cauchy prior for rjags parallel fit. The prior is set in the model as:

model <- function(){
  ...
 # rho.b ~ dunif(-0.99, 0.99)
  tau_h ~ dt(0, 1, 1)T(0,)
  tau_b ~ dt(0, 1, 1)T(0,)
  precision_h <- 1/(pow(tau_h,2))
  precision_b <- 1/(pow(tau_b,2))
  rho.h ~ dnorm(0, precision_h)
  rho.b ~ dnorm(0, precision_b)
  ...
}

params <- c("lambda.adj","lambda.1","L.0","L.1","b.adj","b1","beta.adj","beta.0","rho.b","rho.h","sigma.hzd","sigma.b")

cl <- makePSOCKcluster(3)
tmp <- clusterEvalQ(cl, library(dclone))
parLoadModule(cl, 'glm')
parLoadModule(cl, 'lecuyer')
parLoadModule(cl, 'dic')

model.t1 <- jags.parfit(cl = cl, data = data, params = params, model = model,
                        n.chains = 3,
                        n.update = 10000,
                        n.iter = 7000,
                        thin = 1)

I received the error message saying:

Error: unexpected symbol in: " # rho.b ~ dunif(-0.99, 0.99) tau_h ~ dt(0, 1, 1)T"

The same error happened when I set

tau_h ~ dt(0, 1, 1) T(0,)

How can I set up the half-Cauchy prior in this case?

Chinyako
  • 35
  • 5

1 Answers1

0

I solved this question through dscaled.gamma. The specific explanation can be found in Pg. 61 of the user manual.

The revised code for the Rjags model is:

model <- function(){
  ...
  tau1 ~ dscaled.gamma(1, 1)
  tauh <- 1/sqrt(tau1)
  tau2 ~ dscaled.gamma(1, 1)
  taub <- 1/sqrt(tau2)
  precision_h <- 1/(pow(tauh,2))
  precision_b <- 1/(pow(taub,2))
  rho.h ~ dnorm(0, precision_h)
  rho.b ~ dnorm(0, precision_b)
  ...
}

The rest are the same.

Chinyako
  • 35
  • 5