假设我有一个表单y=a_{i} + b_{i,1}*x_{1} + b_{2}*x_{2}的模型,i=1,2,...,12和我希望使用rstanarm来估计这个模型。
是否可以为每个拦截a_{i}设置不同的优先级(假设前4有normal(location = 0, scale = 1, autoscale = TRUE),下4有normal(location = 1, scale = 2, autoscale = TRUE),最后4 student_t(df = 1, location = 0, scale = NULL, autoscale = TRUE))。我还想为b_{i,1}和最后一个b_{2}~normal(location = 3, scale = 1, autoscale = TRUE)设置相同的优先级。
用rstanarm能做到这一点吗?
发布于 2017-08-07 15:15:11
在rstanarm支持的模型中最多有一个截距,但是您可以通过在公式中包含a-1并将虚拟变量上的系数作为系数来抑制拦截。对于系数,您可以做一些类似于prior = student_t(df = c(rep(Inf, 8), rep(1, 4)), location = c(rep(0, 4), rep(1, 4), rep(0, 4)), scale = c(rep(1, 4), rep(2, 4), rep(1, 4)), autoscale = TRUE)的事情,但似乎您打算建立某种层次模型,在这种情况下,偏离全局参数的先验只能是多元正态。见?prior_decov。
https://stackoverflow.com/questions/45543718
复制相似问题