From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search


Selected variable plot, color-coded by RMSECV for GA results.


indices = genalgplot(fit,pop,spectrum,xaxis,xtitle)
indices = genalgplot(results,spectrum,xaxis,xtitle)


An interactive plotting routine which displays the results of a genetic algorithm (GA) analysis. GENALGPLOT can aid in identifying patterns of variables that improve model prediction (as estimated by RMSECV). The results of GA analysis include the final unique "population" which is a M by N matrix where M is the number of members in the population and N is the number of original variables in the predictor block. Each row (member) of the population corresponds to a regression model where a column with a "1" indicates that variable was included in the model and a "0" indicates that the variable was not included. The RMSECV for each model characterized its prediction performance.

The user selects a subset of the population from a plot of RMSECV versus the total number of included variables for each member of the population. The selected results are displayed in a plot that shows which variables were included for each member in the subset and its corresponding RMSECV. The plot is sorted with the best-performing individuals at the bottom of the plot and the worst at the top.

GENALGPLOT is most useful when many replicate GA runs have been performed (see GENALG and GASELCTR) with low settings on the maximum number of generations maxgenerations or Found at convergence convergence.

Required inputs are fit, the RMSECV fit results from GASELCTR (or the rmsecv field value from a GENALG results structure), and pop, the logical matrix of included variables for all individuals in the final population (or the icol field valuefrom a GENALG results structure). Optional inputs include spectrum, a spectrum to plot on the final "included variables" plot for reference, xaxis, the variable axis scale, and xtitle, the x-axis label for the final plot (e.g. xaxis units).

The one output is the indices of the selected individuals (rows of pop).


  • results = results structure from GASELCTR or GENALG, or
  • fit = RMSECV fit results from GASELCTR and
  • pop = logical matrix of included variables from GASELCTR

Optional Inputs

  • spectrum = spectrum to plot on final "included variables" plot for reference.
  • xaxis = variable axis scale.
  • xtitle = x-axis label for the final plot.


  • indices = indices of selected individuals (rows of pop or results.icol)


Given the GENALG results structure gamodel, the following would plot the results:


See Also

genalg, gaselctr