【问题标题】:Error when predicting partial effects using new data for gamlss model使用 gamlss 模型的新数据预测部分效果时出错
【发布时间】:2022-12-19 23:46:08
【问题描述】:

我在这里重新提出使用 newdata 参数为 gamlss 模型预测 CI 的问题。更复杂的是我也对部分效果感兴趣。

一个密切相关的问题(没有部分影响)在 2018 年未解决:Error when predicting new fitted values from R gamlss object

我想知道是否有更新也扩展到部分效果。下面的示例重现了错误(注意 `type = "terms" 指定我对每个模型项的影响感兴趣)”。

library(gamlss)
library(tidyverse)

#example data 
test_df <- tibble(x = rnorm(1e4),
                  x2 = rnorm(n = 1e4),
                  y = x2^2 + rnorm(1e4, sd = 0.5)) 

#fitting gamlss model
gam_test = gamlss(formula = y ~ pb(x2) + x,
                  sigma.fo= y ~ pb(x2) + x,
                  data = test_df)
#data I want predictions for
pred_df <- tibble(x = seq(-0.5, 0.5, length.out = 300),
                  x2 = seq(-0.5, 0.5, length.out = 300)) 

#returns error when se.fit = TRRUE
pred <- predictAll(object = gam_test,
                   type = "terms",
                   se.fit = TRUE, #works if se.fit = FALSE
                   newdata = pred_df)

提前谢谢了!

【问题讨论】:

    标签: r prediction gamlss


    【解决方案1】:

    我与 gamlss 软件的主要开发人员(负责此功能的人)进行了交谈。 他说选项 se.fit=TRUE with type="terms" 尚未实施, 不幸的是他现在太忙了。

    一种想法是引导原始数据, 并预测每个引导样本的项, 然后使用结果获得 CI。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-10
      • 2018-07-24
      • 2014-01-03
      • 2019-12-29
      • 1970-01-01
      相关资源
      最近更新 更多