Description Usage Arguments Details Value Examples
This function performs a Genetic Algorithm based optimization on a user-supplied model.
1 2 |
data |
An object compatible with the model supplied by the user. The first column must be the dependent variable, the rest of the columns are explanatory variables. This is a data.frame() object under default parameters. |
model |
User specified fitting model. This must be compatible with the data and the scoreFunc parameters. The default is lm(). |
methodBreed |
Method for how the second parental chromosomes are chosen for crossovers. This takes one of three values.
|
Pop |
User defined population size. Otherwise, it is calculated as 1.5*(number of explanatory variables). |
mutRate |
Mutation rate used to increase diversity in the algorithm. If none is supplied, it is set as 1/(number of explanatory variables). If the model doesn't converge well, slowly increasing this parameter may help. |
scoreFunc |
Scoring function for the model. This function must be compatible with the output object of the model. Since the default is AIC(), all scores are treated as lowest=best. Therefore, user supplied score functions must have the lowest score as the best. |
generations |
How long to run the algorithm. Genetic algorithms typically don't have convergence critera, so this parameter is key for getting quality results. |
... |
Extra arguments to the model function. |
interation |
Interactions between explanatory variables are assumed independent (FALSE). If one wants more complex interactions to be explored, this parameter must be set to TRUE. |
This function attempts to maximize some score function over some model as supplied by the user. The default is to fit a linear model to the data and score each model using Aikake's Information Critera (AIC).
A labeled list containing 3 parts.
model: Best scoring model object.
score: Score for the model returned.
history: A list of the scores at each time point for the entire run.
1 2 3 4 5 6 | #Tree data provided in R
select(data=trees, model=lm, methohdBreed="oneScore", interaction=FALSE, Pop=NULL, mutRate=NULL, scoreFunc=AIC, generations=25)
#Orange data has a categorical in the first column. Reorder to test with.
OrangeData <- data.frame(Orange[2:3], Orange[1])
Select(data=OrangeData, model=lm, methodBreed="twoScore", interaction=TRUE, scoreFunc=AIC, generations=50)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.