pga<-function(y, X, m, N, B=100, mutation=1/ncol(X), start=NULL, prior = 0.3, ...) { # performs parallel genetic algorithm for variable selection # by Mu Zhu # first version = Jan 2002 # this version = Feb 2009 # # Inputs: # m = population size, default set to roughly ncol(X) # N = number of generations per path # B = number of parallel paths # mutation = mutation rate, default set to roughly 1/m # start = starting population, pretty much useless # prior = controls the density of 1's in the initial population # # Feb09 addition: # the use of 'shuffle' before and after calling sga b <- 0; p <- ncol(X) rslt <- matrix(0, B, p) cat("Starting PGA...\n") while (b < B) { print(b) b <- b + 1 shuffle=sample(1:ncol(X)) tmp <- sga(y, X[,shuffle], m, N, start, mutation, prior) rslt[b,] <- tmp$combo.gene[order(shuffle)] } return(rslt) }