Skip to content
Back to formatted view

Raw Message

Message-ID: <49D27480.7060800@gmx.de>
Date: 2009-03-31T19:52:32Z
From: Stephan Kolassa
Subject: model selection using ANOVA
In-Reply-To: <f58db2700903310922kd463e0ei2082544be91fd6a5@mail.gmail.com>

Hi Alina,

your approach sounds problematic - you can always get a smaller RSS if 
you add terms to your model, so your approach will always go for larger 
models, and you will end up overfitting. Consider information criteria, 
e.g., AIC or BIC, which "penalize" larger models. References for AIC are 
Burnham & Anderson; other people prefer BIC.

Then you can do something like

models <- list()
AICs <- rep(NA, n)
models[[1]] <- lm(...); AICs[1] <- AIC(model[[1]])
...
models[[n]] <- lm(...); AICs[n] <- AIC(model[[n]])
which.min(AICs)

depending on your specific needs.

HTH,
Stephan


Alina Sheyman schrieb:
> I've created a number of models using lm and now want to pick one with the
> smallest standard error or the smallest RSS,
> I can get a list of RSS using anova function, but is the any way I can then
> select one with the smallest RSS from the list?
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> 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.
>