Select: Apply a genetic algorithm to find the optimal co-variates in...

Description Usage Arguments Value Examples

Description

Select() is used to apply the genetic algorithm to some input dataset outputs a list containing a list of the indiivdials in the final generation' of the genetic algorithm, a matrix of the fitness values of all individuals in all generations and the fitted model from glm for the best individual

Usage

1
2
3
Select(dataset, response.name, userfunc = "AIC", user.family = "gaussian",
  flag.log.scale = TRUE, frac.replace = 0.2, Niter = 100, Nruns = 1,
  mutate.rate = FALSE, plot.flag = TRUE)

Arguments

dataset

A matrix, datatable, or dataframe

response.name

The name of the column in dataset that will act as the response variable to be predicted

userfunc

A fitness function that operates on a model that could be provided by the user. The default is the Aikake Information Criteria or "AIC".

user.family

Model family name to be passed to glm. Default is "gaussian"

flag.log.scale

Default is TRUE if the log of the predictor varaible is to be fit.

frac.replace

Fraction of worst parents to be replaced with the best children in each generation

Niter

Maximum number of iterations during each run. Default is 100

Nruns

Number of times genetic algorithm is run. Default is 1

mutate.rate

Genetic algorithm mutation rate. If set to FALSE it is automatically determined. A value of 0.01 is suggested

plot.flag

Set to TRUE to plot the evolution of the population of individuals over the progression of the algorithm

Value

Select() produces a single list each of whose elements are a list or vector of objects partaining to each of the Nruns times that the genetic algorithm was run. Each list element is named according the type of data it contains:

Examples

1
2
baseball = read.table(file.choose(),header=TRUE)
out <- Select(dataset=baseball, response.name="salary", Niter=50, Nruns=1, mutate.rate = 0.01)

stat243proj/GA documentation built on May 15, 2019, 5:03 a.m.