r2winbugs

Avoiding rounding in R

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-28 09:22:30
问题 I am conducting a Bayesian analysis in R thorough "R2Winbugs" package. In the R output, teh estimated parameters are rounded. My question is how can I control this? Here is my command: bugs(data, inits=inits, model.file = "C:/Users/Gunal/Desktop/dummy/dummyw.txt", parameters, digits=5, n.chains = 3, n.iter = 1000, codaPkg = FALSE, bugs.directory = "D:/PROGRAMLAR/WinBUGS14/") and here is some part of my output mean sd 2.5% 25% 50% 75% 97.5% Rhat n.eff beta1 0.3 0.1 0.0 0.2 0.3 0.4 0.5 1.7 5

Writing conditional distribution in the WinBUGS using R2WinBUGS package in R

怎甘沉沦 提交于 2020-02-07 05:28:16
问题 For the following data, mydata ID Y x z 1 1 5.302956 1 1 2 1 3.358249 2 1 3 1 4.976734 3 1 4 1 4.290459 4 1 5 1 0.000000 5 0 6 2 5.975351 1 1 7 2 6.620773 2 1 8 2 8.045909 3 1 9 2 7.378384 4 1 10 2 6.908755 5 1 11 2 8.672657 6 1 12 2 8.284252 7 1 13 2 8.455531 8 1 14 2 7.415175 9 1 15 2 8.634265 10 1 16 3 7.356993 1 1 17 3 6.607598 2 1 18 3 0.000000 3 0 19 3 0.000000 4 0 20 3 0.000000 5 0 21 3 0.000000 6 0 22 3 0.000000 7 0 23 3 0.000000 8 0 24 3 6.398595 9 1 25 3 6.580639 10 1 26 4 5.525104

BUGS error messages

女生的网名这么多〃 提交于 2019-12-30 00:39:05
问题 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? 回答1: 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

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/

OpenBUGS error undefined variable

早过忘川 提交于 2019-12-13 13:20:31
问题 I'm working on a binomial mixture model using OpenBUGS and R package R2OpenBUGS . I've successfully built simpler models, but once I add another level for imperfect detection, I consistently receive the error variable X is not defined in model or in data set . I've tried a number of different things, including changing the structure of my data and entering my data directly into OpenBUGS. I'm posting this in the hope that someone else has experience with this error, and perhaps knows why

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

Passing variable to WinBugs model in R

人走茶凉 提交于 2019-12-07 19:09:31
问题 I am using the R2WinBugs package. I would like to pass two parameter that are calculated previously in the R script to the model function c0yy <- 0.1 syy <- 0.0001 #Model model <- function(c0yy,syy){ #Likelihood for(i in 1:n){ y[i] ~ dnorm(mu[i],cyy) } #Regression formula for(i in 1:n){ mu[i] <- alpha + gamma * x[i] } #Priors for the regression parameters alpha ~ dnorm(0,0.000001) gamma ~ dnorm(0,0.000001) #Priors for the precision parameter cyy ~ dnorm(c0yy,syy) #Monitored variables beta <-

Passing variable to WinBugs model in R

丶灬走出姿态 提交于 2019-12-06 12:16:44
I am using the R2WinBugs package. I would like to pass two parameter that are calculated previously in the R script to the model function c0yy <- 0.1 syy <- 0.0001 #Model model <- function(c0yy,syy){ #Likelihood for(i in 1:n){ y[i] ~ dnorm(mu[i],cyy) } #Regression formula for(i in 1:n){ mu[i] <- alpha + gamma * x[i] } #Priors for the regression parameters alpha ~ dnorm(0,0.000001) gamma ~ dnorm(0,0.000001) #Priors for the precision parameter cyy ~ dnorm(c0yy,syy) #Monitored variables beta <- gamma/(alpha-1) } filename <- file.path(tempdir(), "Olm.txt") write.model(model, filename) but I get

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