winbugs14

WinBUGS Weibull Network Meta-Analysis

五迷三道 提交于 2019-12-22 04:15:08
问题 I am currently working on a meta-analysis of survival data across several clinical trials. To do this, I have code from a published analysis using the same methodology. However, when running this code using the data from the published analysis, I am unable to replicate their results. In fact, the results fail to converge to any kind of reasonable estimate. The code itself (not including the data) should be correct as it comes directly from the authors. I assume the problem has to do w/

How to code a matrix in WinBUGS?

a 夏天 提交于 2019-12-13 19:39:47
问题 I am trying to code the 2X2 matrix sigma with the 4 elements. Not sure how to code in WINBUGS. My goal is to get the posterior p's, their means and variances and create an ellipse region covered by the two posterior p's. Heres my code below: model{ #likelihood for(j in 1 : Nf){ p1[j, 1:2 ] ~ dmnorm(gamma[1:2], T[1:2 ,1:2]) for (i in 1:2){ logit(p[j,i]) <- p1[j,i] Y[j,i] ~ dbin(p[j,i],n) } X_mu[j,1]<-p[j,1]-mean(p[,1]) X_mu[j,2]<-p[j,2]-mean(p[,2]) v1<-sd(p[,1])*sd(p[,1]) v2<-sd(p[,2])*sd(p[,2

OpenBUGS: missing value in Bernoulli distribution

ⅰ亾dé卋堺 提交于 2019-12-10 16:50:42
问题 I'm trying to model the observation "time" as random variable with OpenBUGS via R (R2OpenBUGS). If all the observation times are available (no NA's) everything works, but if I set one of the times to NA, nothing happens. I tested the same code with WinBUGS, and I get trap error 'NIL dereference (read)'. So my question is that is there something really wrong in my code, or is my model too weird for BUGS? My model is like this: model{ for(i in 1:k){ obs[i] ~ dbern(p) #is the observation done at

R2WinBUGS - Warning messages

与世无争的帅哥 提交于 2019-12-10 10:12:52
问题 I am trying to use R2WinBUGS using this example: code (Please only consider the part: ### 5.4. Analysis using WinBUGS) I am getting this error message: Error in file(con, "wb") : cannot open the connection In addition: Warning messages: 1: In file.create(to[okay]) : cannot create file 'c:/Program Files/WinBUGS14//System/Rsrc/Registry_Rsave.odc', reason 'Permission denied' 2: In file(con, "wb") : cannot open file 'c:/Program Files/WinBUGS14//System/Rsrc/Registry.odc': Permission denied Warning

R2WinBUGS - Warning messages

北城余情 提交于 2019-12-06 04:36:23
I am trying to use R2WinBUGS using this example: code (Please only consider the part: ### 5.4. Analysis using WinBUGS) I am getting this error message: Error in file(con, "wb") : cannot open the connection In addition: Warning messages: 1: In file.create(to[okay]) : cannot create file 'c:/Program Files/WinBUGS14//System/Rsrc/Registry_Rsave.odc', reason 'Permission denied' 2: In file(con, "wb") : cannot open file 'c:/Program Files/WinBUGS14//System/Rsrc/Registry.odc': Permission denied Warning message: running command '"c:/Program Files/WinBUGS14//WinBUGS14.exe" /par "D:/R2WinBUGS/normal/script

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,

“Multiple definition of node a” error in Winbugs

牧云@^-^@ 提交于 2019-12-02 18:11:44
问题 okay i just rewrite my code. Now the problem is when i compile it, I get an error of "multiple definition of node a" . Do anyone know what wrong in my code. I create the variable a,b and c for the model not to have many constants. model{ for(i in 1:n){ a <- (k[1] + step(s1[i]-.9)*k[2] + step(s1[i]*.5-.9)*k[3]) b <- (r[1] + step(s2[i]-.9)*r[2] + step(s2[i]*.5-.9)*r[3]) c <- (s[1] + step(s3[i]-.9)*s[2] + step(s3[i]*.5-.9)*s[3]) dummy[i] <- 0 dummy[i] ~ dloglik(logLike[i]) # This is the log