微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

rstanarm - 运行贝叶斯模型时出错

如何解决rstanarm - 运行贝叶斯模型时出错

编辑 - 我已经设法解决了这个问题。请参阅下面的评论

我使用 rstanarm 使用我设置的先验在 R 中运行贝叶斯回归,使用以下代码

priors <- rstanarm::normal(location = c(-1,0.5,2),scale = c(1,2,0.5))

bmd <- stan_glm(s01_1 ~ pc + a03 + l01,data=bes19,prior = priors,iter=1000,seed=6942)

这会输出以下错误,我不知道如何纠正:

  Exception: mismatch in dimension declared and found in context; processing stage=data initialization; variable name=prior_scale; position=0; dims declared=(19); dims found=(3)  (in '/data/hyperparameters.stan' at line 2; included from 'model_continuous' at line 56)

Failed to create the sampler; sampling not done
Error in check_stanfit(stanfit) : 
  Invalid stanfit object produced please report bug

如果有任何解决方案,我将不胜感激。谢谢。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。