dredge function error - R package MuMln

前端 未结 2 631
死守一世寂寞
死守一世寂寞 2021-01-01 15:15

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

2条回答
  •  隐瞒了意图╮
    2021-01-01 15:49

    I know this has been solved, however I came across the same issue and think there is a better way.

    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:

    1. After using dredge change the settings back via options(na.action = "na.omit").

    OR the better way...

    1. Utilise the regression function's ability to "set the argument". In your case:

    glm1<-glm(presabs~dca1+dca2+se1+se2, family=binomial(logit), na.action = "na.fail")

提交回复
热议问题