Description Usage Arguments Examples
A genetic algorithm for variable selection in regression problems
1 |
data |
The input data in the form of a dataframe. Each row is one entry with columns as different variables and the last column as the outcome. |
model |
A formula object ( eg. data$y ~ x1 + x2^2 + x2:x3 ). Note: must specify data source for dependent variable |
conv_criterion |
Convergence criterion |
steps |
Maximum number of steps to run GA |
1 2 3 4 5 6 7 8 9 10 11 12 13 | # simulate data
initData <- matrix( rnorm( 2500 , sd = c(1, 5, 7 , 100 , 40 ) ) , ncol = 5 , byrow = TRUE )
initOutcome <- 10 - 15 * initData[ , 1 ] + 2 * initData[ , 3 ] + 1.1 * initData[ , 5 ]
# define input parameters
data <- data.frame( initData, initOutcome )
model <- data$initOutcome ~ X1 + X2 + X3 + X4 + X5
# call select function
GAresults <- select( data = data , model = model )
# plot convergence results
plot( GAresults[[ 2 ]] , pch = 16 , cex = 0.75 , xlab = "Step" , ylab = "Convergene Criterion")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.