Firstly, thanks Matthew for creating such a useful and great package.
I've been exploring using autorun.jags in a simulation study. One thing I'd like to try is for autorun.jags to run long enough for Gelman's Rhat to be below the threshold (and I've figured out how to set this), but not to then bother running further, i.e. using the Raftery and Lewis diagnostics to ensure accurate centiles. I have tried passing raftery.options=list(r=1), so that the required margin of error is large, which I think does the trick, but I wondered if there was a more definitive way of turning off this second stage of the automatic running in autorun.jags.
Many thanks!
Jonathan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Glad to hear you find the package useful! I had not thought to do this before, so there is currently no better way than what you describe to prevent the final chain extension being done. But it would definitely be something I could add to the development version. I will have a think about it and let you know - thanks for the suggestion!
Best wishes,
Matt
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just to confirm that as of runjags version 2.0.2 the raftery.options argument accepts a FALSE value which definitevely turns off chain extension for sample size.
Thanks for the suggestion :)
Matt
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Could you specify how to put the argument? I tried raftery.options = FALSE but it requires a named list, but I don't know which name for that argument should be.
Thanks,
Ming
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
library('runjags')
N <-100
X <-1:N
Y <- rnorm(N,2*X +10,1)
model <-"model { for(i in 1 : N){ Y[i] ~ dnorm(true.y[i], precision) true.y[i] <- m * X[i] + c } m ~ dunif(-1000,1000) c ~ dunif(-1000,1000) precision ~ dexp(1) #monitor# m, c, precision #data# N, X, Y }"
results <- autorun.jags(model=model, raftery.options=FALSE)
This should also work in version 2.0.2 (currently on CRAN) as documented. Can you confirm the error you get, and the version of runjags you are trying this with?
Matt
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for your reply. I tried to installed version 2.0.2 but it still gives me the error:
Error in autoextend.jags(runjags.object = obj, add.monitor = character(0), :
Options to raftery.diag must be provided as a named list
Ming
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Again, I can confirm that the following does work on my system:
library('runjags')
N <-100
X <-1:N
Y <- rnorm(N,2*X +10,1)
model <-"model {for(i in 1 : N){ Y[i] ~ dnorm(true.y[i], precision) true.y[i] <- m * X[i] + c}m ~ dunif(-1000,1000)c ~ dunif(-1000,1000)precision ~ dexp(1)#monitor# m, c, precision#data# N, X, Y}"
results1 <- autorun.jags(model=model, raftery.options=FALSE)
results2 <- run.jags(model=model, sample=1000)
r2extended <- autoextend.jags(results2, raftery.options=FALSE)
Whatever you are passing to raftery.options must be evaluated as !identical(raftery.options, FALSE) but I have no idea why this might be the case. I can't reproduce your error without more details of your system and the function call you are using.
Also make sure to run the following to ensure that you have a recent enough package version:
stopifnot(packageVersion('runjags')>='2.0.2')
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Firstly, thanks Matthew for creating such a useful and great package.
I've been exploring using autorun.jags in a simulation study. One thing I'd like to try is for autorun.jags to run long enough for Gelman's Rhat to be below the threshold (and I've figured out how to set this), but not to then bother running further, i.e. using the Raftery and Lewis diagnostics to ensure accurate centiles. I have tried passing raftery.options=list(r=1), so that the required margin of error is large, which I think does the trick, but I wondered if there was a more definitive way of turning off this second stage of the automatic running in autorun.jags.
Many thanks!
Jonathan
Hi Jonathan
Glad to hear you find the package useful! I had not thought to do this before, so there is currently no better way than what you describe to prevent the final chain extension being done. But it would definitely be something I could add to the development version. I will have a think about it and let you know - thanks for the suggestion!
Best wishes,
Matt
Just to confirm that as of runjags version 2.0.2 the raftery.options argument accepts a FALSE value which definitevely turns off chain extension for sample size.
Thanks for the suggestion :)
Matt
Hi Matt,
Could you specify how to put the argument? I tried raftery.options = FALSE but it requires a named list, but I don't know which name for that argument should be.
Thanks,
Ming
The following works in runjags version 2.0.3:
This should also work in version 2.0.2 (currently on CRAN) as documented. Can you confirm the error you get, and the version of runjags you are trying this with?
Matt
Thanks for your reply. I tried to installed version 2.0.2 but it still gives me the error:
Error in autoextend.jags(runjags.object = obj, add.monitor = character(0), :
Options to raftery.diag must be provided as a named list
Ming
Again, I can confirm that the following does work on my system:
Whatever you are passing to raftery.options must be evaluated as !identical(raftery.options, FALSE) but I have no idea why this might be the case. I can't reproduce your error without more details of your system and the function call you are using.
Also make sure to run the following to ensure that you have a recent enough package version: