plotSelected.sisal: Plotting Sets of Inputs Produced by Sequential Input...

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Draws a table depicting the inputs selected by a number of sisal runs, one row for each run.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## S3 method for class 'sisal'
plotSelected(x, useAllNames = TRUE,
             pickIntPart = FALSE, intTransform = function(x) x,
             formatCArgs = list(), xLabels = 1, yLabels = NULL,
             L.f.color = "black", L.v.color = "grey50",
             other.color = "white", naFill = other.color,
             naStripes = L.v.color, selectedLabels = TRUE,
             otherLabels = FALSE,
             labelPar = gpar(fontface = 1, fontsize = 20, cex = 0.35),
             nestedPar = gpar(fontface = 3),
             ranking = c("pairwise", "nested"), tableArgs = list(),
             ...)

## S3 method for class 'list'
plotSelected(x, ...)

Arguments

x

an object of class "sisal" or a list of such objects giving the results of input selection.

useAllNames

a logical flag. If TRUE, collects the names of input variables from all elements of a list x or from the single "sisal" object. Each unique name is represented by one column in the table. If FALSE, all elements of x are assumed to have the same set of input variables in the same order.

pickIntPart

a logical vector. If pickIntPart[k] is TRUE, the input names collected from x[[k]] (x is a list) or from x (x is a single "sisal" object and k == 1) are filtered so that any name containing an integer part is converted to that integer (the remaining part is dropped). If the length of the vector and the number of rows in the table differ, the values of the vector are recycled.

intTransform

a function that transforms integral valued input names to another integer. Used if and only if the relevant element of pickIntPart is TRUE. The function must accept a numeric vector argument and return a numeric vector. The default value is an identity function.

formatCArgs

a named list of arguments to formatC. If the relevant element of pickIntPart is TRUE, the integral valued column names are formatted with formatC using these arguments. For example, it is possible to add a sign with list(flag = "+").

xLabels

a numeric value, character vector or list affecting the column labels in the table. If useAllNames is TRUE, a named list or character vector can be used to rename inputs. In this case, the names in the vector must contain all the input names gathered from x. The new names (display names) are taken from the values in the vector, indexed with the names from x. If useAllNames is TRUE, a numeric value has no effect. If useAllNames is FALSE, a numeric value is an index to x indicating the object to be used when collecting input names. An unnamed list or character vector of column names can also be used when useAllNames is FALSE.

yLabels

a character vector or list giving the row labels in the table. NULL (the default) means no labels.

L.f.color

fill color for table cells representing an input variable in the L.f set.

L.v.color

fill color for table cells representing an input variable in the L.v set.

other.color

fill color for table cells representing an input variable outside both L.f and L.v.

naFill

background color for table cells representing a missing input variable.

naStripes

stripe color for table cells representing a missing input variable.

selectedLabels

a logical flag. If TRUE (the default), draw labels on table cells representing input variables in the L.f or L.v sets. The label shows the importance rank of the variable. See ‘Details’.

otherLabels

a logical flag. If TRUE, draw labels on table cells representing input variables not included the L.f or L.v sets. The label shows the importance rank of the variable. The default value is FALSE. See ‘Details’.

labelPar

graphical parameters for labels of table cells.

nestedPar

graphical parameters for labels on rows that represent input selection runs where the best nodes of each size are all nested. See ‘Details’. Only used if ranking includes "nested". These take precedence over values set in labelPar.

ranking

which input ranking method(s) to use. A character vector containing one or both of "pairwise" and "nested". Abbreviated versions can be used. See ‘Details’ for a description of the ranking methods. If both rankings are requested by the user and exist, they are both written on the label, but only where the ranks differ. The first element indicates the preferred primary ranking method, and any differing ranks produced by a possible secondary ranking method are presented in parentheses after the rank indicated by the primary method. The default is to use both methods when possible, preferring the always available "pairwise" method.

tableArgs

a named list of arguments passed to sisalTable. This can also be used when arguments of sisalTable and the "sisal" method of plotSelected have the same name.

...

In the "sisal" method, arguments passed to sisalTable. In the "list" method, arguments passed to the next method, determined by the class of the first element in the list.

Details

Currently the "sisal" and "list" methods are the only methods for the generic function plotSelected defined by the sisal package.

Mathematical annotation can be used in text. See plotmath. If the same input is in both the L.f and the L.v sets, L.f.color and L.v.color are mixed in alternating stripes. See col2rgb for a description of possible color values.

The importance rank of input variables is determined using one or both of the following two methods (see ranking):

"nested"

This method requires that all the nodes with the smallest validation error among the nodes with the same number of input variables are nested. Let's imagine a path through the incrementally smaller best nodes (not necessarily a path in the search graph) where the edges are labeled with the ID of the input removed in order to create the smaller model. In this ranking method, the remaining input variable gets rank 1. Traversing the path in the reverse direction and printing the edge labels produces the rest of the input variables from smaller rank to larger. If hbranches = 1 in sisal, the models are always nested and the method agrees with "pairwise".

"pairwise"

This is Copeland's pairwise aggregation method. It can be used in all cases, unlike "nested". The score of an input variable is the number of pairwise victories minus the number of pairwise defeats when compared with other inputs. The inputs are ranked by their score. The method may result in ties. Tied nodes are ranked according to ties.method = "min" in rank.

The pairwise comparisons are performed in the following way: In sisal, at each stage of the search, input variables are ordered and inputs are removed starting from one or more (when hbranches > 1) of the worst ones according to that order. A record, let's say C[A, B], is kept of each pair of inputs (A, B) in order to keep track of how many times A was better than B. Let L be the set of inputs to remove at the current stage of the search in one of the branches and M the set of remaining inputs. Then, C[A, B] is incremented by one for all A in M and B in L, but also for all A in L and B in L such that A is better than B according to the order used for picking the inputs to remove. A gets a pairwise victory over B if C[A, B] > C[B, A].

For information on setting graphical parameters (labelPar, nestedPar), see gpar.

Value

The function is usually called for the side effect (a plot is drawn), but it also returns a grob representation of the plot.

Author(s)

Mikko Korpela

References

Pomerol, J.-C. and Barba-Romero, S. (2000) Multicriterion decision in management: principles and practice. Springer. p. 122. ISBN: 0-7923-7756-7.

See Also

sisal, sisalTable, plotmath, gpar

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
library(grDevices)
library(grid)
toy1.2 <- list(testSisal(Mtimes=10, stepsAhead=1, dataset="tsToy"),
               testSisal(Mtimes=10, stepsAhead=2, dataset="tsToy"))
## Resizing enabled:
## - mathematical expressions in titles
## - extracting the integer part of input variable names
grid.newpage()
plotSelected(toy1.2, yLabels = c("+1", "+2"),
             main = "Toy time series",
             xlab = expression(paste("input variables ",
                                     italic(y[t+l]))),
             ylab = expression(paste("output ", italic(y[t+k]))),
             pickIntPart = TRUE, intTransform = function(x) -x)
## Fixed size plot:
## - some graphical parameters adjusted
## - cex in labelPar adjusts the space around the text in table cells
## - new device the same size as the plot
grb <- plotSelected(toy1.2, resizeText = FALSE, resizeTable = FALSE,
                    axesPar = gpar(fontsize = 11, col = "red"),
                    labelPar = gpar(fontsize = 14/0.25, cex = 0.25),
                    fg = "wheat", outerRect = FALSE,
                    linePar = gpar(lty = "dashed"),
                    xAxisRot = 45, just = c("left", "top"),
                    tableArgs = list(x = 0, y = 1), draw = FALSE)
devWidth <- convertWidth(grobWidth(grb), unitTo = "inches",
                         valueOnly = TRUE)
devHeight <- convertHeight(grobHeight(grb), unitTo = "inches",
                           valueOnly = TRUE)
dev.new(width = devWidth, height = devHeight, units = "in", res = 72)
grid.draw(grb)
if (interactive()) {
    dev.set(dev.prev())
} else {
    dev.off()
}

sisal documentation built on May 29, 2017, 9:09 a.m.