r2winbugs

How can I convert an mcmc.list to a bugs object?

一曲冷凌霜 提交于 2019-12-05 15:17:22
问题 I am using the rjags R library. The function coda.samples produces an mcmc.list , for example (from example(coda.samples) ): library(rjags) data(LINE) LINE$recompile() LINE.out <- coda.samples(LINE, c("alpha","beta","sigma"), n.iter=1000) class(LINE.out) [1] "mcmc.list" However, I would like to use the plot.bugs function, which requires a bugs object as input. Is it possible to convert an object from an mcmc.list to a bugs object, so that plot.bugs(LINE.out) ? Note that there is a similar

How can I convert an mcmc.list to a bugs object?

心不动则不痛 提交于 2019-12-04 01:27:36
I am using the rjags R library. The function coda.samples produces an mcmc.list , for example (from example(coda.samples) ): library(rjags) data(LINE) LINE$recompile() LINE.out <- coda.samples(LINE, c("alpha","beta","sigma"), n.iter=1000) class(LINE.out) [1] "mcmc.list" However, I would like to use the plot.bugs function, which requires a bugs object as input. Is it possible to convert an object from an mcmc.list to a bugs object, so that plot.bugs(LINE.out) ? Note that there is a similar question on stats.SE that has been unanswered for over a month. That question had a bounty that ended on

R2WinBUGS - logistic regression with simulated data

跟風遠走 提交于 2019-12-03 13:33:55
问题 I am just wondering whether anyone has some R code that uses the package R2WinBUGS to run logistic regression - ideally with simulated data to generate the 'truth' and two continous co-variates. Thanks. Christian PS: Potential code to generate artificial data (one dimensional case) and run winbugs via r2winbugs (it does not work yet). library(MASS) library(R2WinBUGS) setwd("d:/BayesianLogisticRegression") n.site <- 150 X1<- sort(runif(n = n.site, min = -1, max =1)) xb <- 0.0 + 3.0*X1 occ.prob

R2WinBUGS - logistic regression with simulated data

与世无争的帅哥 提交于 2019-12-03 03:30:51
I am just wondering whether anyone has some R code that uses the package R2WinBUGS to run logistic regression - ideally with simulated data to generate the 'truth' and two continous co-variates. Thanks. Christian PS: Potential code to generate artificial data (one dimensional case) and run winbugs via r2winbugs (it does not work yet). library(MASS) library(R2WinBUGS) setwd("d:/BayesianLogisticRegression") n.site <- 150 X1<- sort(runif(n = n.site, min = -1, max =1)) xb <- 0.0 + 3.0*X1 occ.prob <- 1/(1+exp(-xb)) plot(X1, occ.prob,xlab="X1",ylab="occ.prob") true.presence <- rbinom(n = n.site,

BUGS error messages

三世轮回 提交于 2019-11-30 03:59:22
I am new to WinBUGS/OpenBUGS and having difficulty debugging my code. Does anyone know of a list of potential error messages for BUGS models and their meanings in plain English? The WinBUGS manual has a list of some common error. I have added some additional notes from my own experience: expected variable name indicates an inappropriate variable name. I occasionally get this error in providing the data, might have used 1.02e04 instead of 1.02E04 . undefined variable - variables in a data file must be defined in a model (just put them in as constants or with vague priors). If a logical node is