View source: R/modelselection_lm.R
| modelselect.lm | R Documentation |
Description: use BIC to do variable selection.
modelselect.lm(
formula,
data,
GA_var = 16,
maxiterations = 2000,
runs_til_stop = 1000,
monitor = TRUE,
popSize = 100,
verbose = TRUE
)
formula |
an object of class "formula": a symbolic description of the model to be fitted.
A typical model has the form |
data |
an data frame containing the variables in the model. |
GA_var |
if the number of variables is smaller than |
maxiterations |
the maximum number of iterations to run before the GA search is halted. |
runs_til_stop |
the number of consecutive generations without any improvement in the best fitness value before the GA is stopped. |
monitor |
a logical defaulting to TRUE showing the evolution of the search. If monitor = FALSE, any output is suppressed. |
popSize |
the population size. |
verbose |
Logical; if TRUE, print a brief summary of results. |
modelselect.lm returns a list containing the following components:
modelsA data frame of candidate models' BIC and posterior probabilities, sorted by decreasing posterior probability
variablesA data frame of candidate variables' posterior inclusion probabilities
dataThe data with variables in the formula.
The function lm.best is used to obtain the linear fitting to the best model by posterior probability or by controlling variables' posterior inclusion probabilities.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.