[R] how to selection model by BIC

Ben Bolker bbolker at gmail.com
Tue Aug 17 18:55:48 CEST 2010


Xin__ Li <msf09xl <at> mail.wbs.ac.uk> writes:

> 
> Hi All:
> the package "MuMIn" can be used to select the model based on AIC or AICc.
> The code is as follows:
> 
> data(Cement)
> lm1 <- lm(y ~ ., data = Cement)
> 
> dd <- dredge(lm1,rank="AIC")
> print(dd)
> 
> If I want to select the model by BIC, what code do I need to use?

  I was going to be grumpy at you for not using common sense, but it's
not quite as obvious as I thought.

library(stats4)
dd <- dredge(lm1, rank="BIC")

  And when
> to select the best model based on AIC, what the differences between the
> function "dredge" in package"MuMIn" and the function "stepAIC" in package
> "MASS"
> 

  stepAIC uses a stepwise procedure, dredge evaluates all (sensible)
model subsets.



More information about the R-help mailing list