疏通函数错误-R包MuMln [英] dredge function error - R package MuMln
本文介绍了疏通函数错误-R包MuMln的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须对数据集进行统计分析.我想创建所有可能的模型并使用挖泥功能测试它们,但它不起作用.事实上,当我输入:
I have to do statistical analyses on a data set. I would like to create all the possible models and to test them with the dredge function but it doesn't work. Indeed, when I type:
glm1<-glm(presabs~dca1+dca2+se1+se2, family=binomial(logit))
dredge(glm1)
我收到此错误:
Erreur in dredge(glm1) :
'global.model''s 'na.action' argument is not set and options('na.action') is "na.omit"
有人可以帮我吗?
推荐答案
使用 options(na.action = "na.fail")
的问题是它改变了 R 的全局设置. 如果您有一个大型脚本,更改全局设置可能会影响您隐式依赖 R
的默认设置的代码的其他部分.有两种方法可以避免这种情况:
The issue with using options(na.action = "na.fail")
is that it changes the global settings of R. If you have a large script, changing the global settings will potentially impact on other sections of your code where you implicitly rely on R
's default settings. There are two ways to avoid this:
- 使用
dredge
后,通过options(na.action = "na.omit")
更改设置.
- After using
dredge
change the settings back viaoptions(na.action = "na.omit")
.
或者更好的方法...
- 利用回归函数设置
na.action
参数的能力.在您的情况下:
- Utilise the regression function's ability to set the
na.action
argument. In your case:
glm1 <- glm(presabs ~ dca1+dca2+se1+se2,
family=binomial(logit),
na.action = "na.fail")
这篇关于疏通函数错误-R包MuMln的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文