tag:blogger.com,1999:blog-24082283.post527643285621607820..comments2024-02-07T05:26:45.500-05:00Comments on Yu-Sung Su's Blog: Auto OpenBUGS fitting and checking for convergenceYu-Sung Suhttp://www.blogger.com/profile/16723440380040533242noreply@blogger.comBlogger36125tag:blogger.com,1999:blog-24082283.post-83120844309424738862024-02-07T05:26:45.500-05:002024-02-07T05:26:45.500-05:00Hi Yu-Sung,
I am new to WinBUGS/OpenBUGS and lear...Hi Yu-Sung,<br /><br />I am new to WinBUGS/OpenBUGS and learning to use it on my own. To me, WinBUGS/OpenBUGs is just like a black box and oftentimes I don't know how to fix the problem shown in the error message.<br /><br />Right now, I am trying to build a model in OpenBUGS and everything goes fine untill I want to updating model. I think it is a very simple model, but as soon as I try to Mozahttps://www.blogger.com/profile/08636250908437979327noreply@blogger.comtag:blogger.com,1999:blog-24082283.post-45074047537438565702020-07-22T11:25:25.526-04:002020-07-22T11:25:25.526-04:00Hello Yu-Sung, I am new to WinBUGS/OpenBUGS, and I...Hello Yu-Sung, I am new to WinBUGS/OpenBUGS, and I am learning to use it myself. I don't know how to solve the problem shown in the error message. For example, when the error "error for node y[1,1]of type graphmultinom,node must be integervalued" appears, the model is defined as follows:<br />model{<br /> for( i in 1 : N ) <br /> { y[i, 1:4] ~ dmulti( theta[i,1:4], 4) # Anonymoushttps://www.blogger.com/profile/06104702782974602818noreply@blogger.comtag:blogger.com,1999:blog-24082283.post-72311884226000920702014-06-27T16:57:42.621-04:002014-06-27T16:57:42.621-04:00Hello,
I was trying to build a poisson model in op...Hello,<br />I was trying to build a poisson model in openbugs with the following codes:<br />model{<br />for(i in 1:N){<br /><br />Y[i]~dpois(mu[i])<br />log(mu[i]) <- b[1]+b[2]*SU_WI[i]+b[3]*VMT[i]<br />}<br />for(j in 1:3){<br />b[j]~dnorm(0,0.001)<br />}<br />}<br />When i run these codes in OpenBUGS, the log file showing the following:<br />***Sorry something went wrong in procedure razaur rahmanhttps://www.blogger.com/profile/00038014877328582659noreply@blogger.comtag:blogger.com,1999:blog-24082283.post-66987630618895242562013-10-20T15:11:04.422-04:002013-10-20T15:11:04.422-04:00Hi again, this is the model related to my previous...Hi again, this is the model related to my previous comment, <br />model <br />{<br /><br />for (i in 1:N) {<br />LRF[i] ~ dnorm(mu[i], nugget.prec)<br /> mu[i] <- beta0 + beta1*X[i] +beta2*Y[i] + beta3*Z[i]+ beta4*XY[i] + beta5*YZ[i] + beta6*ZZ[i] + W[i]<br /> muW[i] <- 0.0<br /> }<br /> <br />nugget.prec~ dgamma(0.10,0.10)<br /> beta0 ~ dnorm(0,0.01)<br /> beta1 ~ dnorm(0,0.01)<br /> Anonymoushttps://www.blogger.com/profile/17134574599150441421noreply@blogger.comtag:blogger.com,1999:blog-24082283.post-88606174140900103822013-10-20T15:04:16.639-04:002013-10-20T15:04:16.639-04:00Hi, can you please help me to identify this error,...Hi, can you please help me to identify this error, 'Sorry something went wrong in procedure LUDecomp in module MathMatrix'Anonymoushttps://www.blogger.com/profile/17134574599150441421noreply@blogger.comtag:blogger.com,1999:blog-24082283.post-10327452632166863672012-11-03T21:09:39.278-04:002012-11-03T21:09:39.278-04:00Hi, Yu-Sung,
It is nice to meet you here; I com...Hi, Yu-Sung,<br /><br /> It is nice to meet you here; I come across this error message :<br /><br />****** Sorry something went wrong in procedure Sqrt in module Math ******<br /><br />The code I use is following:<br />model<br />{<br /> for (i in 1 : regions) {<br /> y[i]<- ma[i]/100<br /> y[i]~dlogis(mu[i],1)<br /> logit(mu[i]) <- beta0 +beta1*log(a[i]) + beta2* log(b[i]) +beta3Anonymoushttps://www.blogger.com/profile/14351155155821820286noreply@blogger.comtag:blogger.com,1999:blog-24082283.post-11104544380750784232012-05-31T20:17:54.462-04:002012-05-31T20:17:54.462-04:00Greetings! I was hoping you could assist me with ...Greetings! I was hoping you could assist me with a message in Wbugs when I'm trying to compile the data...the message states "made use of undefined node beta0". I'm trying to develop a spatiotemporal model to predict future cases of West Nile Virus using prior cases, temperature and precipitation as predictors...<br /><br />My Bugs code is the following:<br /><br />model<br />Anonymoushttps://www.blogger.com/profile/11223745923573048094noreply@blogger.comtag:blogger.com,1999:blog-24082283.post-46242920770643342912012-02-08T06:02:45.779-05:002012-02-08T06:02:45.779-05:00Hi Yu-Sung Su,
Thanks very much for providing thi...Hi Yu-Sung Su,<br /><br />Thanks very much for providing this code. I am working on a Linux machine with OpenBUGS and BRugs only (I don't have WinBUGS or WINE, and I don't have admin privileges to install them), and I was wondering if there's a way to modify your code for my environment. I think the only WinBUGS function you use is as.bugs.array. Do you know if there's an Danihttps://www.blogger.com/profile/02834624027959591639noreply@blogger.comtag:blogger.com,1999:blog-24082283.post-62648170519141859442011-06-20T15:15:45.603-04:002011-06-20T15:15:45.603-04:00Hi,
could someone help me with this one?
I made a...Hi,<br /><br />could someone help me with this one?<br />I made a model where I would like to test the influence of temperature on the number of flowers that open and I wanted tot add a random factor(area). The model is correct but when I want to update I get an error "Sample in module UpdaterRejection". What does it mean, and what do I need to do?<br />model{<br /><br />#specificatie studenthttps://www.blogger.com/profile/18192967324062148220noreply@blogger.comtag:blogger.com,1999:blog-24082283.post-89476409631277096922010-04-08T01:55:57.814-04:002010-04-08T01:55:57.814-04:00Try to rescale the predictors by standardizing it....Try to rescale the predictors by standardizing it. This will help convergence.Yu-Sung Suhttps://www.blogger.com/profile/16723440380040533242noreply@blogger.comtag:blogger.com,1999:blog-24082283.post-38874987729027088532010-04-07T23:59:53.385-04:002010-04-07T23:59:53.385-04:00Hi Yu-Sung,
Thanks for your reply. Yes, after I r...Hi Yu-Sung,<br /><br />Thanks for your reply. Yes, after I revise the model as you suggested, I can run it in WinBUGS now.<br /><br />But it seems that I am having some new problems. After 200,000 simulations, the model still does not converge. Previously when I wrote the model as an inverse logit function, the majority of the parameters converged pretty quickly.<br /><br />I also checked the Unknownhttps://www.blogger.com/profile/01644125003450183532noreply@blogger.comtag:blogger.com,1999:blog-24082283.post-73915493726900577792010-04-07T17:43:07.050-04:002010-04-07T17:43:07.050-04:00Hi Shali,
This is a well known problem in WinBUGS...Hi Shali,<br /><br />This is a well known problem in WinBUGS. The sampler for the logit model sometimes samples p out of the 0-1 bounds. So in the code, try this:<br /><br />y[i] ~ dbern (p.bound[i])<br />p.bound[i] <- max(0, min(1, p[i]))<br /><br />This should be able to pass the problem you are encountering now!Yu-Sung Suhttps://www.blogger.com/profile/16723440380040533242noreply@blogger.comtag:blogger.com,1999:blog-24082283.post-59829486161555059732010-04-07T14:06:17.791-04:002010-04-07T14:06:17.791-04:00Hi Yu-Sung,
I am new to WinBUGS/OpenBUGS and lear...Hi Yu-Sung,<br /><br />I am new to WinBUGS/OpenBUGS and learning to use it on my own. To me, WinBUGS/OpenBUGs is just like a black box and oftentimes I don't know how to fix the problem shown in the error message.<br /><br />Right now, I am trying to see if the parameters of interest in my model change over time and my model is defined as follows:<br /><br />model {<br /> for(i in 1:k)Unknownhttps://www.blogger.com/profile/01644125003450183532noreply@blogger.comtag:blogger.com,1999:blog-24082283.post-67547902548829839852008-04-10T11:48:00.000-04:002008-04-10T11:48:00.000-04:00Our argument is that with proper rescaling, the co...Our argument is that with proper rescaling, the coefficient of a logit model should be t-distributed with mean=0, scale=2.5. This is an informative empirical prior. In any event that you want to use an uninformative one, just set df=30 or bigger, which is mathematically equivalent to a flat normal prior.<BR/><BR/>If you have further question about whether your informative priors, you can also Yu-Sung Suhttps://www.blogger.com/profile/16723440380040533242noreply@blogger.comtag:blogger.com,1999:blog-24082283.post-65837565693101635382008-04-08T15:34:00.000-04:002008-04-08T15:34:00.000-04:00Hi Yu-SungI don't know whether you have read the a...Hi Yu-Sung<BR/>I don't know whether you have read the article of which I gave you the link, but wouldn't you expect that the way parameters are given priors in Gelman's article (dcauchy) also result in a non-uniform distribution on the p-scale? with a peak at both 0 and 1? My analysis runs fine, no separation what so ever (which should be an argument on its own) but I was hoping to use Gelman's Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-24082283.post-10118472376807986362008-04-07T22:33:00.000-04:002008-04-07T22:33:00.000-04:00The paper has been submitted for publication. How...The paper has been submitted for publication. However, we still don't know the publication information. So in the meantime, you can use the link I gave to use as the reference.Yu-Sung Suhttps://www.blogger.com/profile/16723440380040533242noreply@blogger.comtag:blogger.com,1999:blog-24082283.post-57305225642052044102008-04-07T16:04:00.000-04:002008-04-07T16:04:00.000-04:00Hi Yu-Sungyou gave me the link to that article on ...Hi Yu-Sung<BR/>you gave me the link to that article on prior distributions, the one that was not published. Can I refer to that as un-published and use the link you gave me in my reference list? or is it submitted somewhere now?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-24082283.post-66910335670277523522008-03-27T23:33:00.000-04:002008-03-27T23:33:00.000-04:00Yes, modelSaveState() is the way to go. And the p...Yes, modelSaveState() is the way to go. And the parameter inside the function should be a stem. So it is modelSaveState("c:/"). You will find 1.txt, 2.txt or something similar to that under "c:/".Yu-Sung Suhttps://www.blogger.com/profile/16723440380040533242noreply@blogger.comtag:blogger.com,1999:blog-24082283.post-4064916217999312512008-03-26T09:21:00.000-04:002008-03-26T09:21:00.000-04:00Hi Yu-Sung,just when you thought you got rid of me...Hi Yu-Sung,<BR/>just when you thought you got rid of me ;-). I have a practical case which goes back to the first discussion I saw on your blog: <BR/>1) I have been doing an analysis on 5000 people in 50 counties (which took extremely long!), and now I want to analyze another new county and use the information from the first 50 counties. I do not want to analyze all 51 counties in order to get anFranshttps://www.blogger.com/profile/06633819430717518916noreply@blogger.comtag:blogger.com,1999:blog-24082283.post-48026876320613296102008-03-20T09:24:00.000-04:002008-03-20T09:24:00.000-04:00Thanks for your help. I think I am ready to call t...Thanks for your help. I think I am ready to call this my final model and start writing my paper.<BR/>Maybe you have come across this report from a colleague of mine. <BR/><BR/>http://gbi.agrsci.dk/%7Eejo/publications/preprints/2003.03.i.pdf<BR/><BR/>Just for your information/interest.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-24082283.post-3060793110897449072008-03-20T02:19:00.000-04:002008-03-20T02:19:00.000-04:00Hi Frans,(1) Yes, a flat Normal prior is reasonabl...Hi Frans,<BR/>(1) Yes, a flat Normal prior is reasonable. <BR/><BR/>(2) Priors help resolve the separation problem through data augmentation. So any reasonable prior is ok.<BR/><BR/>(3) t-dist with df=1 is equivalent to cauchy, with df=30 is equivalent to Normal.<BR/><BR/>(4) No, you don't have to center your variables.<BR/><BR/>I don't think you have to change anything here. The code is cosherYu-Sung Suhttps://www.blogger.com/profile/16723440380040533242noreply@blogger.comtag:blogger.com,1999:blog-24082283.post-607882610725432052008-03-19T14:10:00.000-04:002008-03-19T14:10:00.000-04:00Hi Yu-SungThat was a very informative paper.Some f...Hi Yu-Sung<BR/>That was a very informative paper.<BR/>Some follow up questions<BR/>1)Since my N is very large and I don't have any indication of separation, a flat dnorm can be used for the intercept as well as all coefficients? Isn't that also what is done in the fourth collumn of figure 2 on page 9? <BR/>2)Since I dont have any separation, is there another downside / risk in using dnorm as Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-24082283.post-69003347712430665332008-03-18T17:59:00.000-04:002008-03-18T17:59:00.000-04:00Hi Frans,dnorm(0,.001) and unif(-100, 100) should ...Hi Frans,<BR/><BR/>dnorm(0,.001) and unif(-100, 100) should be very similar to each other. The sensitivity of priors is depended on your N. Also, if you really want a better prior, please check this paper.<BR/><BR/>http://www.stat.columbia.edu/~gelman/research/unpublished/priors7.pdfYu-Sung Suhttps://www.blogger.com/profile/16723440380040533242noreply@blogger.comtag:blogger.com,1999:blog-24082283.post-21179050506644872422008-03-18T11:36:00.000-04:002008-03-18T11:36:00.000-04:00Hi Yu-Sung,A short question for your opinion. I ha...Hi Yu-Sung,<BR/>A short question for your opinion. I have had some discussion about flat priors on the logit scale (as I have done), which result in priors with 2 peaks on the P-scale around 1 and 0. That should be avoided, since the model could get stuck in all 1 or all 0 solutions. However, in case the model clearly does not get stuck and converges fine, should you then worry about using dnorm(Franshttps://www.blogger.com/profile/06633819430717518916noreply@blogger.comtag:blogger.com,1999:blog-24082283.post-87301768969385232442008-03-07T09:31:00.000-05:002008-03-07T09:31:00.000-05:00Very clear, thanks!Very clear, thanks!Franshttps://www.blogger.com/profile/06633819430717518916noreply@blogger.com