How to run lm models using all possible combinations of several variables and a factor

前端 未结 2 1844
遇见更好的自我
遇见更好的自我 2020-11-30 09:29

this is not my subject so I am sorry if my question is badly asked or if the data is incomplete. I am trying to run 31 lineal models which have a single response variable (V

2条回答
  •  爱一瞬间的悲伤
    2020-11-30 10:10

    To deal with:

    'global.model''s 'na.action' argument is not set and options('na.action') is "na.omit"

    require(MuMIn)
    data(iris)
    options(na.action = "na.fail") # change the default "na.omit" to prevent models
    # from being fitted to different datasets in
    # case of missing values.
    globalmodel <- lm(Sepal.Length ~ Petal.Length + Petal.Width + Species, data = iris)
    combinations <- dredge(globalmodel)
    print(combinations)
    

提交回复
热议问题