[R] automatic model selection based on BIC in MLE

Gavin Simpson gavin.simpson at ucl.ac.uk
Sat May 23 13:03:46 CEST 2009


On Thu, 2009-05-21 at 20:47 -0700, Michael wrote:
> Hi all,
> 
> Could anybody point me to an automatic model selection based on BIC
> for my MLE fitting problem, in R?

?stepAIC

> 
> I would imagine I just have to supply the MLE LLF function, and the
> dimension of the problem and the number of observations should be
> embedded in the definition of the LLF itself.

If you write a method for the logLik generic for your objects, then the
AIC() function in R can be used to compute BIC. Take a look at ?AIC and
getAnywhere(AIC.default) and then at the existing methods for logLik
functions to see what you need to copy for your object. Once you have
logLik and therefore AIC working, stepAIC will just work for your
objects.

Whether stepwise selection makes sense for your purposes is another
question.

G

> 
> And then the automatical model selection procedure will select the
> best model for me.
> 
> Thanks!
> 
> ______________________________________________
> 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.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%




More information about the R-help mailing list