В Wed, 31 Jul 2024 11:56:55 +0000 c.bu...@posteo.jp пишет: > step() explore the model space with a step wise approach. > And dredge() try out all possible combinations of the variables. > > But isn't that the same? I might have a mental block on this. > > Which model (formula) would dredge() "test" that step() wouldn't?`
Suppose that the predictors a, b, c, d, e, f are arranged in the descending order of contribution to the model. Consider a forward stepwise algorithm that is asked to choose three variables. It starts by testing a, b, c, d, e, f, and chooses a. It continues by testing a + b, a + c, a + d, a + e, a + f, and chooses a + b. It continues by testing a + b + c, a + b + d, a + b + e, a + b + f, and chooses a + b + c. By being greedy, it doesn't consider, for example, the model d + e + f, because for that it would have to pick d before a. A greedy algorithm for K variables out N tests N + (N-1) + ... + (N-K+1) = N*K - K(K-1)/2 models. An exhaustive search would have to test choose(N,K) = N!/(N-K)!/K! models. -- Best regards, Ivan ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.