【发布时间】:2018-04-26 11:52:56
【问题描述】:
我想获得每个预测点的分布,即对于因变量 y 的每个值。在因变量 y 中,我有 199 个观察值,对于每个观察值,我想要一个分布。所以我的输出应该是 199*100 的矩阵。我怎样才能得到它?我尝试了 T=100 的 Monte Carlo 模拟。但每次都是 199 的向量而不是矩阵 199*100。R-Code is here
【问题讨论】:
标签: r prediction montecarlo uncertainty
我想获得每个预测点的分布,即对于因变量 y 的每个值。在因变量 y 中,我有 199 个观察值,对于每个观察值,我想要一个分布。所以我的输出应该是 199*100 的矩阵。我怎样才能得到它?我尝试了 T=100 的 Monte Carlo 模拟。但每次都是 199 的向量而不是矩阵 199*100。R-Code is here
【问题讨论】:
标签: r prediction montecarlo uncertainty
你可以这样做
mc_pred <- matrix(nrow = 199, ncol = 100)
for (i in 1:100) {
mc_pred[, i] <- predict(model, x_test)
}
【讨论】: