How to succinctly write a formula with many variables from a data frame?

后端 未结 6 2086
一整个雨季
一整个雨季 2020-11-22 17:01

Suppose I have a response variable and a data containing three covariates (as a toy example):

y = c(1,4,6)
d = data.frame(x1 = c(4,-1,3), x2 = c(3,9,8), x3 =         


        
6条回答
  •  南笙
    南笙 (楼主)
    2020-11-22 17:46

    You can check the package leaps and in particular the function regsubsets() functions for model selection. As stated in the documentation:

    Model selection by exhaustive search, forward or backward stepwise, or sequential replacement

提交回复
热议问题