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

What I want is to see beta1 as 0.30000. I tried digits=5, but it did not work. Any one know what to do?

Any help would be greatly appreciated

Cheers

Günal


回答1:


Yeah, it's simple - use print(out, dig = 6) (or 7, 8, ...) to print the result:

out <- bugs(....)

print(out, dig = 6)


来源:https://stackoverflow.com/questions/13764258/avoiding-rounding-in-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!