【问题标题】:AUC of logistic and ordinal model following multiple imputation using MICE (with R)使用 MICE(使用 R)进行多重插补后的逻辑和有序模型的 AUC
【发布时间】:2022-11-23 02:00:11
【问题描述】:
我在问一个关于将变量包含到逻辑模型和有序模型中的附加预测好处的问题。我正在使用小鼠来估算缺失的协变量,并且很难找到计算合并估算模型的 AUC 和 R 平方的方法。有人有建议吗?
摘要读数仅提供术语、估计、std.error、统计、df、p.value
示例代码:
imputed_Data <- mice(Cross_sectional, m=10, predictorMatrix=predM, seed=500, method = meth)
Imputedreferecemodel <- with(imputed_Data, glm(Poor ~ age + sex + education + illness + injurycause, family = "binomial", na.action=na.omit) )
summary(pool(Imputedreferecemodel))
非常感谢。
【问题讨论】:
标签:
r
imputation
auc
r-mice
【解决方案1】:
在进行逻辑回归时,我认为使用 McFadden's 或 Tjur's R2 是一种很好的做法,因为这两种方法都倾向于与广义线性模型一起使用。 mice::pool.r.squared 仅适用于lm 型号。 A previous StackOverflow user 和你有同样的问题,看起来乘法插补glm() 模型的最佳函数是来自 Github 包 glmice 的mfc()。 looks fairly simple这个函数,虽然包几年没动了。以前的用户无法让mfc() 工作,但它对我有用。
# install.packages("remotes")
# remotes::install_github("noahlorinczcomi/glmice")
library(glmice)
library(mice)
data(nhanes)
nhanes$hyp <- ifelse(nhanes$hyp == 2, 1, 0)
imp <- mice(nhanes, m = 10, seed = 500, printFlag = FALSE)
mod <- with(imp, glm(hyp ~ age + bmi, family = "binomial"))
# summary(pool(mod))
mcf(mod)
#> [1] "34.9656%"
看起来用于计算乘法估算的 AUC 的资源较少glm()。我确实找到了一个vignette from the finalfit package,它计算了曲线下的面积。不幸的是,它计算了每个插补的 AUC。可能有一种方法可以汇集输出,但我不确定如何(希望另一个 SO 用户可以提出一个想法?)。
library(finalfit)
mod %>%
getfit() %>%
purrr::map(~ pROC::roc(.x$y, .x$fitted)$auc)
# not pasting the output because it's a lot