Learn R Programming

cgam (version 1.6)

plot.shapeselect: Plot Routine for a SHAPESELECT Fit

Description

This routine is registered as the S3 plot method for a ShapeSelect fit.

Usage

# S3 method for shapeselect
plot(x, ...)

Arguments

x

A fitted object of the ShapeSelect routine.

...

Furhter possible arguments.

Value

The routine makes a plot for a ShapeSelect object, in which the xlab represents generations, i.e., iterations, a ShapeSelect routine goes through until it finds the best model by the genetic algorithm, and the ylab represents fitness values. Both the best fitness and the mean fitness in each generation is shown in the plot.

Details

Note that this routine only works on a ShapeSelect object fitted with the genetic algorithm; otherwise, if the object is found via brutal search, the routine will not work on it.

See Also

ShapeSelect

Examples

Run this code

  library(MASS)
  data(Rubber)

  # call ShapeSelect to find the best model by the genetic algorithm
  fit <- ShapeSelect(loss ~ shapes(hard, set = "s.9") + shapes(tens, set = "s.9"),
  data = Rubber, genetic = TRUE)

  # plot fitness values against generations
  plot(fit)

  # call plotpersp on the best fit 
  plotpersp(fit$best.fit, th = 120)
  

Run the code above in your browser using DataLab