全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 经管代码库
3930 10
2015-03-02
名字叫“rethinking” ,可以作为RStan的前端使用,自动计算DIC和WAIC,非常方便。

rethinking



      This R package accompanies a course and book on Bayesian data analysis. It contains tools for conducting both MAP estimation and Hamiltonian Monte Carlo (through RStan). These tools force the user to specify the model as a list of explicit distributional assumptions.
For example, a simple Gaussian model could be specified with this list of formulas:
复制代码

      The first formula in the list is the likelihood; the second is the prior for mu; the third is the prior for sigma (implicitly a half-Cauchy, due to positive constraint on sigma).


MAP estimation


      Then to use maximum a posteriori (MAP) fitting:
复制代码

      The object fit holds the result.




Hamiltonian Monte Carlo estimation



            The same formula list can be compiled into a Stan (mc-stan.org) model:
复制代码

      The start list is optional, provided a prior is defined for every parameter. In that case, map2stan will automatically sample from each prior to get starting values for the chains. The chain runs automatically, provided rstan is installed. The Stan code can be accessed by using stancode(fit.stan):
复制代码

   
Multilevel model formulas


      While map is limited to fixed effects models for the most part, map2stan can specify multilevel models, even quite complex ones. For example, a simple varying intercepts model looks like:

复制代码

And with varying slopes as well:

复制代码


   Nice covariance priors




      And map2stan supports decomposition of covariance matrices into vectors of standard deviations and a correlation matrix, such that priors can be specified independently for each:
复制代码

    Semi-automated Bayesian imputation


          It is possible to code simple Bayesian imputations this way. For example, let's simulate a simple regression with missing predictor values:
复制代码

That removes 10 x values. Then the map2stan formula list just defines a distribution for x:
复制代码

       What map2stan does is notice the missing values, see the distribution assigned to the variable with the missing values, build the Stan code that uses a mix of observed and estimated x values in the regression. See the stancode(m) for details of the implementation.



二维码

扫码加我 拉你入群

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

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

全部回复
2015-5-10 03:54:31
提示: 作者被禁止或删除 内容自动屏蔽
二维码

扫码加我 拉你入群

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

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

2015-5-10 03:57:55
提示: 作者被禁止或删除 内容自动屏蔽
二维码

扫码加我 拉你入群

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

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

2015-5-10 09:45:19
谢谢分享,欢迎多多分享此类好帖。
二维码

扫码加我 拉你入群

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

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

2015-5-10 10:36:02
Nicolle 发表于 2015-5-10 03:54
二维码

扫码加我 拉你入群

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

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

2015-5-10 14:44:21
多谢分享!
二维码

扫码加我 拉你入群

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

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

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

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