Learn R Programming

pgirmess (version 1.3.9)

selMod: Model selection according to information theoretic methods

Description

Handles lm, glm and list of e.g. lm, glm, nls, lme and nlme objects and provides parameters to compare models according to Anderson et al. (2001)

Usage

selMod(aModel, Order = "AICc", ...)

    ## S3 method for class 'lm':
selMod(aModel, Order = "AICc", dropNull = FALSE, selconv=TRUE, ...)
    ## S3 method for class 'list':
selMod(aModel, Order = "AICc", ...)

Arguments

aModel
a lm or glm model or a list of relevant models (see details)
dropNull
if TRUE, drops the simplest model (e.g. y$~$1)
Order
if set to "AICc" (default) sort the models on this parameter, otherwise "AIC" is allowed
selconv
if TRUE (default) keep the models for which convergence is obtained (glm object only) and with no anova singularity (lm and glm)
...
other parameters to be passed as arguments (not used here)

Value

  • A dataframe including:
  • LLthe maximized log-likelihood
  • Kthe number of estimated parameters
  • N2Kthe number of observations/K
  • AICthe Akaike index criterion
  • deltAICthe difference between AIC and the lowest AIC value
  • w_ithe Akaike weights
  • deltAICcthe difference between AICc and the lowest AICc value; advised to be used when n2K $<$ 40<="" description="">
  • w_icthe AICc weights
  • The models examined from first to last are stored as attribute

Details

This function provides parameters used in the information theoretic methods for model comparisons.
  • .
{lm and glm objects can be passed directly as the upper scope of term addition (all terms added). Every model from y$\sim$1 is computed adding one term at a time until the upper scope model is derived. This is a stepwise analysis where the terms are added sequentially and this does NOT provide all combinations of terms and interactions. Offset terms cannot be proceeded here. } .{A list of user specified lm, glm, nls, lme or nlme objects (actually any object for which AIC and logLik functions are applicable) to compare can alternately be passed. }

References

  • .
{Anderson, D.R., Link, W.A., Johnson, D.H. and Burnham, K.P. (2001). Suggestions for presenting the results of data analyses. Journal of Wildlife Management, 65, 373-378} .{Burnham, K.P. and Anderson, D.R. (2002) Model Selection and Multimodel Inference: a Practical Information-Theoretic Approach, 2nd edn., Springer-Verlag, New York. 353 pp}

See Also

AIC,logLik

Examples

Run this code
library(MASS)
 anorex.1 <- lm(Postwt ~ Prewt*Treat, data = anorexia)
 selMod(anorex.1)
 anorex.2 <- glm(Postwt ~ Prewt*Treat, family=gaussian,data = anorexia)
 selMod(anorex.2)
 anorex.3<-lm(Postwt ~ Prewt+Treat, data = anorexia)
 mycomp<-selMod(list(anorex.1,anorex.2,anorex.3))
 mycomp
 attributes(mycomp)$models

Run the code above in your browser using DataLab