我正在通过rstanarm开发一个贝叶斯回归模型,它结合了尺度因变量上的多项式、二项式和标度预测器。作为一个常规模型,我的模型如下所示:
*
死亡-规模
性别二项式
小时-比例
时间-多项(即上午、晚上、下午)
*
硕士(死亡+性别+小时+时间)
I am attempting to create the same model through a Bayesian approach through rstanarm, however I am confused about how I would apply different priors to each of the predictor variables.
```javascriptFor example, lets say:
1. gender follows a beta prior
2. hours follows a normal prior
3. time follows a student_t
```我将如何实现这些信息?
任何帮助都是感激的,谢谢!
发布于 2019-04-04 18:47:54
x1 1∈(−15,−5是指(基于先验信息),我们期望β系数在-15到-5之间,因此我们选择了均值为-10和sd=5的正常先验,这使得大多数先验概率介于-15和-5之间,并且对超出该范围的值更持怀疑态度。同样地,x2 2∈(−1,1)意味着它的系数在-1 ~1之间,因此我们用mean=0和sd=2选择了一个正规先验,这些先验选择在小数中不表示为β∼正规(−10,0),(5,0,0,2)(均值和方差/协方差的矩阵形式)。
对于一个具体的例子,假设我们想将下面的模型与mtcars数据框架相匹配:
mpg ~ wt + hp + cyl我们希望为这三个预测变量指定优先级。假设高斯前项的均值分别为-1,0,1,标准差为4,2,3。
my_prior <- normal(location = c(-1, 0, 1), scale = c(4, 2, 3), autoscale = FALSE)类似地,我们可以为拦截和错误标准差(在本例中是prior_aux )创建优先级:
my_prior_intercept <- student_t(4, 0, 10, autoscale=FALSE)
my_prior_aux <- cauchy(0, 3, autoscale=FALSE)然后,模型函数是:
m1 = stan_glm(mpg ~ wt + hp + cyl, data = mtcars,
prior = my_prior,
prior_intercept=my_prior_intercept,
prior_aux=my_prior_aux)https://stackoverflow.com/questions/55522627
复制相似问题