全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 winbugs及其他软件专版
2296 1
2014-06-26
Attched please review my code for latent class model. Until I had done model check-up, there are no errors. However, when I tried to "update" the sample, suddenly the trap message said "undefined real result" popped up. How can I deal with this problem? Thanks
复制代码

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2014-6-26 21:38:10
Error messages in WinBugs are terrible to interpret. I believe that this message is indicating that the program is unable to perform the calculations of the model due to illogical or extreme values selected by the sampler.

The first thing I would do is calculate values wherever you use a function. For example calculate the logit transformation by hand instead of using the logit function. I have fixed this exact error by making this change once.

Secondly, I would carefully go over your priors to make sure that they don't allow parameter values that could cause an error in calculation. For example,
d~dnorm(0,1)
c <- log(d)
should cause a trap error because the prior allows for negative values which cannot be log transformed. Another example is if the prior allows for extremely positive values of a parameter that will later be exponentiated. I don't know what the limit is on this, but obviously exp(10000000) will cause an error.

I would try giving it the best initial values that you can come up with.

Provide slightly informed priors.

Make sure that the looping is as efficient as it can be. Marc Kery's book Introduction to Winbugs for Ecologist provides some tips on this (http://www.lce.esalq.usp.br/arquivos/aulas/2010/LCE5813/Introduction%20to%20WinBUGS%20for%20Ecologists.pdf)

Lastly, I would perform the analysis in JAGS. Subtle differences between bugs and jags means that some problems can be resolve by simply switching programs. Not very satisfying but may work.

I hope this helps you resolve your trap error and move forward!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群