You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用newdata预测gamlss模型偏效应及置信区间时出错求助

关于gamlss模型使用newdata预测偏效应置信区间的问题

我需要解决gamlss模型中使用newdata参数预测偏效应置信区间(CI)的问题。2018年曾有一个未解决的相关问题(未涉及偏效应),现在想了解针对偏效应场景是否有更新。

以下是复现错误的代码:当设置se.fit=TRUE时会报错,设为FALSE则可正常运行:

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 = TRUE
pred <- predictAll(object = gam_test,
                   type = "terms",
                   se.fit = TRUE, # works if se.fit = FALSE
                   newdata = pred_df)

提前感谢帮助!

内容的提问来源于stack exchange,提问作者WiggyStardust

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.09 17:05:14