小编And*_*lis的帖子

使用PyMC 3进行Probit回归

我在这里发布了一个python笔记本:http://nbviewer.ipython.org/gist/awellis/9067358

我正在尝试使用PyMC 3创建一个probit回归模型,使用生成的数据来恢复已知参数(参见笔记本).拦截的估计几乎没有,但是斜率估计是偏离标记的.

我的模型看起来像这样:

with pm.Model() as model:

    # priors
    alpha = pm.Normal('alpha', mu=0, tau=0.001)
    beta = pm.Normal('beta', mu=0, tau=0.001)

    # linear predictor
    theta_p = (alpha + beta * x)

    # logic transform (just for comparison - this seems to work ok)
#     def invlogit(x):
#         import theano.tensor as t
#         return t.exp(x) / (1 + t.exp(x))
#     theta = invlogit(theta_p)


    # Probit transform: this doesn't work
    def phi(x):
        import theano.tensor as t
        return 0.5 * (1 …
Run Code Online (Sandbox Code Playgroud)

python bayesian pymc

7
推荐指数
1
解决办法
1874
查看次数

标签 统计

bayesian ×1

pymc ×1

python ×1