rstanarm-线性混合模型需要太长时间才能拟合

时间:2018-07-27 06:45:59

标签: stan rstanarm

我正在使用

stan_lmer拟合线性混合模型
prior_fit_1 <- normal(location = c(2.0, 0.0, 0.0), scale = c(4.0, 9.0, 9.0))
fit_1 <- stan_lmer(response ~ predictor1 + predictor2 + predictor3
                              (1 + predictor1 + predictor2 | group1) 
                              (1 | group2),
                              data = dat, refresh = -1,
                              prior = prior_fit_1, chains = 3, cores = 3, iter=500)

其中数据集dat具有> 750k观测值。我确保了预测变量和响应的大致比例(通过比较它们的最小值和最大值)。这是数据集的摘要

         response   predictor1  predictor2  predictor3
count   773737      773737      773737      773737
mean    7.645656    4.766701    1.383317    4.147674
std     2.598273    4.388669    3.136783    2.274438
min    -3.688879    0.000000    0.000000    0.000000
25%     5.991465    0.000000    0.000000    2.639057
50%     7.681076    5.799093    0.000000    4.143135
75%     9.383201    8.476134    0.000000    5.673323
max    21.416413    20.706678   24.214083   8.942984

它告诉我

Gradient evaluation took 3.71 seconds
1000 transitions using 10 leapfrog steps per transition would take 37100 seconds.
Adjust your expectations accordingly!

Gradient evaluation took 3.66 seconds
1000 transitions using 10 leapfrog steps per transition would take 36600 seconds.
Adjust your expectations accordingly!

Gradient evaluation took 4.06 seconds
1000 transitions using 10 leapfrog steps per transition would take 40600 seconds.
Adjust your expectations accordingly!

因此,在最坏的情况下,大约需要12个小时才能完成一个链中的1000次迭代。该模型已经运行了12个小时,我还没有完成它,这使我有些惊讶,因为我每个链仅运行500次迭代。

关于这是为什么以及如何加快速度的任何建议?

感谢您的帮助

0 个答案:

没有答案