编辑 - 我已经设法解决了这个问题。看我下面的评论
我正在使用我设置的先验使用 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
如有任何解决方案,我将不胜感激。谢谢你。