由于我的 NA 值,我无法使用 predict() 函数从我的模型平均对象创建绘图

问题描述

我正在尝试使用 MuMin predict.averaging 函数修改本页底部示例中的代码https://www.rdocumentation.org/packages/MuMIn/versions/1.43.17/topics/predict.averaging from Burnham and Anderson (2002)。我正在为我的完整模型使用 PGLS(系统发育广义线性模型)。在我的原始数据库中,有很多不可避免的 NA 值,当我从工作示例中获得这行代码时,这给我带来了问题:

# Predictions from each of the models in a set,and with averaged coefficients
pred <- data.frame(
    model = sapply(confset.95p,predict,newdata = newdata),averaged.subset = predict(avgm,newdata,full = FALSE),averaged.full = predict(avgm,full = TRUE)
    )

然后我收到此错误消息:

Error in na.fail.default(list(migratory = c(0L,0L,1L,: 
  missing values in object

我曾尝试使用 na.action=na.exclude、na.fail=FALSE 和其他各种方法,但收到相同的错误消息。

我真的很感激任何帮助,谢谢。如果有帮助,我可以附上我的数据集和其余代码

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)