\begin{comment}
A graphical display is a powerful tool to more thoroughly understand
data \cite{GraphicalMethods}, by assisting in such tasks as spotting outliers
and finding patterns in the data structure.  However, traditional computer
graphics  are limited to the two dimensional plane provided by the computer
screen.  This limitation is clearly a problem for visualizing multivariate
data.  Fortunately, there are many ideas about how to simulate
multi-dimensional views of data \cite{GraphicalMethods} including rotation,
the use of small multiples, scatter plot matrices, and
linking. 

Small multiples \cite{VisualDisplay} is an approach for viewing
multivariate data in which a series of graphics displays
the same combination of variables, but each graph in the series is
indexed by another variable \cite{VisualDisplay}.  For instance, the
series of graphics could be a series of county maps, where each map is
colored by the amount of pollution emissions at a particular time.
Thus, the user can see how the pollution emissions change over time by
studying how the graphs change through the series.  This idea is
spatially appealing, 
%%FIXME: (DTL) Is it the map that is spatial, or the layout of the plots.
%% There are two spatial aspects, so it would help to avoid any ambiguity.
but is limited in the number of variables that
can be displayed.

%\begin{figure}[!h]
%  \begin{center}    
%    \scalebox{0.33}{\includegraphics{SmallMultJudge.jpg}}
%    \caption{ Small multiples example }
%    \label{Fig:SMult}
%  \end{center}
%\end{figure}


%% The fact that we are using maps in this example as well as above 
%% may lead the reader to think we are talking about geographical/spatial
%% mutlivariate data.  It might be better to use a different example.
A similar idea to small multiples is an idea called conditioned
choropleth maps.  Conditioned choropleth maps are graphs that display
two explanatory variables and one dependent variable \cite{CC}.  An
example of a conditioned choropleth map is a series of maps of the
United States, where each map is indexed by an annual precipitation
level and a percent below poverty level, and on each map is shown
concentration of lung cancer mortality rates.  In this example, the
two explanatory variables are the annual precipitation level and the
percent below poverty level, and the dependent variable is the lung
cancer mortality rate.  

%% A picture would help here.




Other ideas that are similar to small multiples and conditioned
choropleth maps are conditioning plots and Trellis graphics.  In
conditioning plots, which are implemented in R with the function,
\Rfunction{coplot}, a series of graphs are conditioned on one or two
variables.  One example is a series of graphs showing latitude versus
longitude of earthquake locations while the depth of the earthquake is
the conditioning variable.  Thus, the graphs of latitude versus
longitude are shown at different ranges of depths (the conditioning
variable).  This example is shown below in Figure \ref{Fig:Quake}.
Trellis graphics \cite{Trellis} \cite{Rnews}, which were created to provide graphical
representation of the relationship between several variables through
conditioning, can produce multi-panel, multi-page graphs.
Thus, Trellis graphics are based on the same idea as conditioning plots.

%% FIXME:  If possible, make this and other figures wider to use the
%% full width of the page. 
\begin{figure}[!h]
  \begin{center}    
    \scalebox{0.33}{\includegraphics{Quake.jpg}}
    \caption{ Conditioning plots example }
    \label{Fig:Quake}
  \end{center}
\end{figure}

Another idea for displaying data with more than three variables is
called generalized draftsman's display, where an array of scatter plots
\cite{GraphicalMethods} is created.  If the data set had four
variables, then a four by four array of scatter plots is created
and any adjacent pairs of plots have an axis in common
\cite{GraphicalMethods}.  For example, in the first row of the four by
four array, the first scatter plot is variable 1 vs. variable 1,
the second scatter plot is variable 1 vs. variable 2, the third
scatter plot is variable 1 vs. variable 3, and the fourth
scatter plot is variable 1 vs. variable 4.  Then in the second
row of the four by four array, the first scatter plot is
variable 2 vs. variable 1, the second scatter plot is variable 2
vs. variable 2, and so on.  Generalized draftsman's display is the
plotting method used when plotting a data frame in R.  In Figure
\ref{Fig:USArrests}, an example of a generalized draftsman's display
is shown for a data frame called USArrests that has the four
variables: Murder, Assault, UrbanPop and Rape.  The
disadvantage with this method is that it can be difficult to determine
which points in different scatter plots refer to the same entity
(i.e. the same row in a data frame).  Also, the greater the number of
variables, the more scatter plots created, which can become overwhelming. 

%\clearpage

\begin{figure}[!h]
  \begin{center}    
    \scalebox{0.4}{\includegraphics{USArrests.jpg}}
    \caption{ Generalized draftsman's display example }
    \label{Fig:USArrests}
  \end{center}
\end{figure}
  
Using multiple-code symbols on a scatter plot \cite{GraphicalMethods}
is another method to display multivariate data.  Here, one scatter plot is
created, but different symbols are used for the data points to show
the value of that point in reference to a third variable.  For
instance, the scatter plot may show variable 1 vs. variable 2, but the
data points are drawn on the scatter plot with an X if they are from a
female or an O if they are from a male.  Thus, this scatter plot now
displays information for three variables.  Clearly, this method is
limited because as the number of variables increases, it requires
many different plotting characters to display so much information on
one plot.

Yet another possibility is to create multiple plots that are linked.
Linked plots mean that if a point on one plot changes its appearance,
such as it becomes colored red, then the corresponding point on a
second plot also changes its appearance to the color red.  For
points to be corresponding, the data displayed in the points must come
from the same entity.  As an example, one person's height, weight,
age, and cholesterol level are data from the same entity.  Thus,
if one plot had height versus weight and a second plot had age versus
cholesterol level, then the point on plot one and the point on plot two
which referred to the same person are corresponding points. 

Although creating linked plots allows more than two variables to be
studied visually at the same time, a tool that implemented this idea
is even more useful if it also allows these plots to be interactive.
Interactivity is an idea that is familiar from using an Internet browser.
Clicking on a hyperlink on a web page results in a new web page opening.
Another example is clicking on the login button after entering a user name and
password to view one's email.  Interactivity means that there is a response to
some user action.  This idea is used in many applications, not just the
Internet.  Another example is double clicking on an icon on one's
desktop to open a document or an application.

One particular model for creating interactive applications involves three
components: some user action or input, which is referred to as an event;
a response to that action, which is executed by a function that is called
a callback function; and a method that connects the event to the callback
function, which is referred to as the signal handler.  The events can
range from the user moving the cursor over a plot, to pressing a button on a
graphical user interface (GUI), to pressing certain keys.  Events are
interpreted based on which window has focus.  For example, in the XWindows
system, if a user types C on the keyboard and the window that has focus is a
text editor, then the letter C is printed on the text editor's screen.
Any other open windows that do not have focus do not respond to this event.
The callback function is a unique function because its signature is determined
by the event that the callback function is linked to.  The parameters passed
to the callback function may include information about the event, such as the
on screen location of the event, and information about the object that had
focus when the event occurred, such as a button on the GUI.  The signal
handler is the piece that must look to see if an event has occurred and then
when the event has occurred, the signal handler calls the appropriate callback
function. 

The strengths of this model of interactivity are that programmers can decide
which events to react to by deciding which signal handlers to implement,
programmers can change the response to an event by changing the callback
function that is linked to an event, and the system's event loop can continue
working on other things until a signal is emitted when an event occurs.  A
system's event loop controls how work is processed.  The event loop checks for
work to do and handles that work.  In the model of interactivity described
above when a signal handler is implemented by the programmer, this results in
the event loop periodically checking to see if an event has occurred.  Thus,
the event loop can perform other work and then check back to see if an event
has occurred.

These three pieces in this model of interactivity are ordered as follows:
an event occurs, the event causes a signal to be emitted that is caught by the
signal handler, and then the signal handler calls the callback function, which
results in the response to the user action.  A flowchart of these steps is
shown below in Figure \ref{Fig:Event}.  In the example of clicking on a
hyperlink mentioned above, the event is the user clicking on the
hyperlink and the callback function causes a new web page to open.
The signal handler, which is the method that connects the event to the
callback function, is handled by the system's event loop when a signal is
emitted. 

\begin{figure}[!h]
  \begin{center}    
    \scalebox{0.55}{\includegraphics{Event.jpg}}
    \caption{ Flow Chart of the Response to an Event }
    \label{Fig:Event}
  \end{center}
\end{figure}

In this paper, after reviewing the design and capabilities of current
software to visualize multivariate data, two new R packages, called
\Rpackage{iSPlot} and \Rpackage{MVCClass}, are discussed.  This discussion
includes why these packages were created, the goals of these packages, and
the design of these packages. 

\end{comment}


\begin{comment}
% this was Elizabeth's version
Many tools already exist to view multivariate data.  The tools that
are discussed here are: 

\begin{itemize}{}{\setlength{\leftmargin}{0.5in}
               \setlength{\itemsep}{0in}}
  \item \Rfunction{identify} and \Rfunction{locator}, which are R functions
  \item \Rpackage{iPlots}, which is an R package
  \item MANET, which is C++ software for a Macintosh
  \item MONDRIAN, which is a JAVA application
  \item GGobi, which is a stand-alone application written in C 
  \item XLisp-Stat, which is a statistical environment built on top of XLisp
\end{itemize}

Ideally, software for visualizing multivariate data also performs
statistical analyses and allows user interaction, linking of views, and future
extensions. 

\subsubsection{\Rfunction{Identify} and \Rfunction{Locator}}
\label{Sssec:Identify}

To support interactivity with plots, R contains the two functions,
\Rfunction{identify} and \Rfunction{locator}.  Both functions return
information about where the left mouse button was pressed on a plot.

The purpose of the \Rfunction{identify} function is to determine
(or identify) which points a user has clicked in a plot.  To do this,
\Rfunction{identify} reads the position of the graphics pointer when
the left mouse button is pressed.  \Rfunction{identify} either
requires the parameters, x and y, which are the vectors containing the
coordinates of the points in a scatter plot, or it requires only one
parameter, x, which is an object that defines coordinates on the plot,
such as a plotting structure or a time series object.  The return
value from \Rfunction{identify} is an integer vector containing the
indices of the identified points.  If no points were clicked, then the
vector is empty.  To identify a point, the position clicked on the
plot must be within 0.25 inches of the point. \Rfunction{identify} is
a modal function, which means that R's processor waits until
\Rfunction{identify} is finished before performing other computations.
\Rfunction{identify} stops when one of the following situations
occurs: the middle or right mouse button is pressed, all points have
been identified, or when the number of points identified is equal to
n, which is an optional parameter to \Rfunction{identify}.  The
default value for n is the length of the parameter x.

The purpose of the \Rfunction{locator} function is to read the position of
the cursor when the left mouse button is pressed.  Thus, unlike
\Rfunction{identify}, \Rfunction{locator} is not trying to identify
points.  \Rfunction{locator} is only returning the location of mouse clicks.
\Rfunction{locator} requires no parameters, though there is an
optional parameter, n, which is the maximum number of mouse clicks to
locate.  The default value for n is 512.  \Rfunction{locator} returns
a list of x and y components, which are the user coordinates of the
positions pressed.  As with \Rfunction{identify}, \Rfunction{locator}
is a modal function and it stops when the middle or right mouse button
is pressed, or when the number of positions clicked is equal to n. 

Both \Rfunction{identify} and \Rfunction{locator} are a good first
start at interactivity in R, but there are drawbacks.  Once either
function is called, it waits until a certain number of mouse
button press events have occurred and the programmer may not know ahead of
time how many times the user wants to click on a plot.  Since
these functions are modal, if the user presses the key ``Q''
while these functions have control of R's processor, the event
is not processed until after these functions are finished.  Although it is
possible for the user to end the functions by clicking on the second or third
mouse button, this action is not intuitive.  The user should be driving the
interactivity and that is not possible with these functions.

Also, these functions only recognize a mouse button press event so other
events, such as a mouse over event, cannot be responded to.  Thus, the amount
of interactivity that can be created in an application that depends only on
\Rfunction{identify} and \Rfunction{locator} is limited.

\subsubsection{\Rpackage{iPlots}}\label{Sssec:iPlots}

\Rpackage{iPlots} \cite{iPlots} is an R package that creates interactive,
linked plots using Java and can be found at the following URL,
http://stats.math.uni-augsburg.de/iPlots/.  The \Rpackage{SJava}
package is required by \Rpackage{iPlots} to access the plots created
using Java.  \Rpackage{iPlots} allows the user to create several types
of interactive plots, such as scatter plots, bar charts, and
histograms.  In addition, the creators of \Rpackage{iPlots} intend to
implement more plots in future releases of \Rpackage{iPlots}.  Once
multiple views have been created the user can interact with the views
with actions such as highlighting and brushing points.

\Rpackage{iPlots} gives the user the power to perform statistical
analyses on the data since \Rpackage{iPlots} is linked to R, but
there are limitations in the design of the package.  In
\Rpackage{iPlots}, data sets \cite{iPlots} are composed of an arbitrary number
of vectors, where each vector represents a variable.
Whenever the user creates a new plot, the data that the new plot uses
are compared to the length of the current data set.  If the lengths are
the same, then the new data are added to the current data set.  The
goal of this design is to reduce overhead for the user so the user is
not forced to bind data together in a data frame ahead of time.
However, comparing the length of the new data with the current data,
as the criterion for determining whether they are from the same
data set, may cause errors.

Also, the current implementation of \Rpackage{iPlots} defines all the
user interactions and thus, new responses to events cannot be changed
through R.  For example, clicking the mouse over a plot always selects
or highlights the object located at the mouse position.  This means
that if the mouse is clicked while the cursor is over a point on a
scatter plot, then that point is selected.  Allowing a user to
change what happens when a mouse click occurs makes the package
more flexible. 

Currently, the callback functionality \cite{iPlots} of the \Rpackage{SJava}
interface is not exposed to the user, which means that there is no
signal thrown to R when an event occurs and thus, the user cannot
connect an event with a callback function.  Recall that events and
callback functions were discussed in Section \ref{Ssec:Backg}.
Because the callback functionality is not exposed, the user cannot
create a function that is called whenever a mouse button press event
occurs and thus, the functionality that occurs when the mouse is
clicked is fixed. However, according to the \Rpackage{iPlots}
documentation this functionality will be available in future releases. 

\subsubsection{MANET and MONDRIAN}\label{Sssec:ManMon}

MANET \cite{MANET} is a software package written in C++ that runs on the
Macintosh Operating System.  MANET provides the capability to create
interactive plots of categorical data, particularly focusing on mosiac
plots, though other plots such as bar charts, histograms, trellis
plots and scatter plots are available.  Mosaic plots \cite{Mosaic} allow
visualization of n-way contingency tables by creating rectangular
regions whose area is proportional to the frequency in a cell.  An
example of a mosaic plot is shown in Figure \ref{Fig:Mosaic}.

\begin{figure}[!h]
  \begin{center}    
    \scalebox{0.6}{\includegraphics{titanic.jpg}}
    \caption{ A mosaic plot of survival on the Titanic }
    \label{Fig:Mosaic}
  \end{center}
\end{figure}

In Figure \ref{Fig:Mosaic} the survival on the Titanic is split based on
gender (male vs. female), class (1st, 2nd, 3rd, or crew) and
age (adult vs. child).  The coloring on the plot shows those who
survived as yellow and those who did not survive as red.  From this
visualization it is clear that women and children were more likely to
survive, but so were those in higher classes.

Although the mosaic plot is a powerful method for depicting
multivariate categorical data, the impact of the plot
depends on the order of the variables.  Figure \ref{Fig:Mosaic} is a
static depiction of a mosaic plot, but the MANET software lets the
user interact with a mosaic plot to change the order of the variables
\cite{MANET} in the plot through drag \& drop in a list or by keyboard
control.  Changing the order of the variables is similar to the
idea of rotating a 3-dimensional space for continuous data.  Thus, by
making the mosaic plot interactive, the user is quickly able to derive
more information about the structure of the data.

MANET also focuses on innovative methods for visually depicting
missing values.  For example in a histogram or bar chart an extra bar
\cite{MANETMV} can be added to show a missing value category.  Missing
values have also been incorporated into other plots, such as box plots
and scatter plots. 

MONDRIAN \cite{MONDRIAN}, which can be found at
http://www.theusrus.de/Mondrian/index.html, is an extension of the
MANET software, but MONDRIAN is written in JAVA so
that it is platform independent.  Similar to MANET, MONDRIAN focuses
on visualizing categorical data, but also now includes geographical
data \cite{MONDRIAN}.  Views that can be created in MONDRIAN include
bar charts, mosaic plots, maps, scatter plots, and parallel coordinate
plots.  As with MANET, the plots created in MONDRIAN are interactive
and some examples of interactivity include a right mouse button click
resulting in a popup window, zooming in and out using control-click
and drag on the plot, and brushing by creating a selection rectangle
on the plot and then dragging that rectangle over the plot.  Also,
plots that are based on the same data set are linked so a case
selected in one plot is selected in other plots.

Both MANET and MONDRIAN are powerful tools for visualizing categorical
data through the many views that can be created and through the large
number of options for interactivity of these views.  Also, since
MONDRIAN is written in JAVA, users on any operating system can use the
software.  However, since MANET and MONDRIAN focus on presenting
categorical data, users with continuous data need to use a
different software package to provide interactive, linked views of
their data.

\subsubsection{GGobi}\label{Sssec:Gobi}

GGobi \cite{GGobi}, which can be found at http://www.ggobi.org/, is a
stand-alone data visualization system that creates interactive and dynamic
views of data using C and Gtk.  In GGobi, users can create
multiple linked and interactive views of the data through a graphical
user interface that contains menus.  For example, using the Display menu,
views such as scatter plots, time series plots, parallel coordinate plots, dot
plots, spline plots, and bar charts can be produced.

Once one or more views have been created, the ViewMode \cite{GGobi} menu in
GGobi lets the user set the projection and the interaction type.  The
projection options set the view dimension.  For
example, one dimension views include dot plots and histograms, while two
dimension views include scatter plots.  Then tours of these views can
be performed using the ViewMode menu items, such as 1-D tour and 2-D
tour.  These options not only give the user different ways of
displaying the data, but also let the user see the data through
rotation. 

The other menu items available through the ViewMode menu in GGobi
allow the user to change what happens in response to interaction with
a view.  For example, the user can decide to scale axes, brush
rectangular regions, identify points and lines, and move points
through interacting with a view after setting these options in the
ViewMode menu.  Another example of interaction allowed by GGobi
includes allowing the user to pan and zoom views.  

GGobi also gives the user many options to manipulate the data and its views.  
These options include allowing a user to directly change data through a
spreadsheet view, to subset the data by case, and to manipulate variables,
such as performing a variable transformation.  Within each plot type,
such as scatter plot and bar chart, the user is given many options of altering
plotting parameters.  The user also has the option of changing how points are
linked.  Points can be linked \cite{GGobiMan} either through ID or by
variable.  Linking by ID, which is the default, means that points
representing records with the same ID are linked.  Linking by variable
\cite{GGobiMan} uses the levels of a categorical variable to link points so
points with the same value for a categorical variable are linked.  Because
the user has so much flexibility in how the data are displayed, GGobi is a
very powerful tool to view the data and find relationships among the
variables. 

Although GGobi allows the user many ways of viewing and interacting
with the data through its extensive menus, it does not include any
statistical analysis tools so the user cannot perform calculations on
the data.  This aspect of the design was deliberate as GGobi was
intended to be a stand-alone application that excelled in displaying
data.  However, having one location where data can be both analyzed
and displayed is helpful to users that want to perform both
tasks.  Theoretically, GGobi can be linked to R using the
\Rpackage{Rggobi} package, although in practice this has been difficult.  

\subsubsection{XLisp-Stat}\label{Sssec:Lisp}

Lisp-Stat is an object-oriented environment based on Lisp that allows
the user to perform statistical analyses as well as create dynamic
graphics.  Lisp-Stat \cite{Lisp} is a general specification while XLisp-Stat
is an implementation that is built on top of the XLisp programming
language, which is a dialect of Lisp.  XLisp-Stat runs on several operating
systems, including Macintosh, Windows, and Unix.  Information about obtaining
Lisp-Stat can be found at
http://www.stat.uiowa.edu/~luke/xls/xlsinfo/node1.html and XLisp-Stat is
available by anonymous ftp to ftp.stat.umn.edu/pub/xlispstat.

One of the primary reasons for creating XLisp-Stat was to produce an
environment \cite{XLisp} for experimenting with dynamic graphics while
integrating the capacity for statistical analyses.  Thus, this environment
needed to be built with a programming language and Lisp \cite{XLisp}, a well
understood functional language, was chosen.  XLisp \cite{XLisp}, in
particular, became the basis for the XLisp-Stat software because it is
available for unrestricted, non-commercial use, it is small for a Lisp system,
its source code is available in C, it is easily extensible, and it includes
support for object-oriented programming.

A session \cite{XLisp} with XLisp-Stat consists of the user typing in commands
at the prompt, though a user can use menus and
dialog boxes to create a GUI.  Static plots of data can
be created, such as scatter plots and histograms, but the user can also choose
to interact with these plots.  By interacting with these plots, the user can
start to explore three or more dimensions visually.  For example, the user can
spin a scatter plot to simulate a three-dimensional scatter plot.  The
spinning causes the points in the two-dimensional plot to rotate around some
axis.  The user can also choose the rotation speed through key press events.
For example, Command-F \cite{XLisp} speeds up the rotation.  Another example
of visualizing more than two dimensions is allowing scatter plots to be
linked.  This linking can be accomplished through selecting or brushing
points in one scatter plot and seeing corresponding points selected in the
other scatter plots.  Users can also remove subsets of points from plots and
they can also show labels over points in a plot.  

Yet another example is that users can create a dynamic simulation of their
data.  Here a list of indices is run through and any points corresponding
to those indices are highlighted as the indices are chosen.  Thus, the
user can focus on how the points in the different views are linked, rather
than focusing on interacting with one plot via the mouse. 

Even with the large amount of built-in functionality in the XLisp-Stat system,
the user can create additions because it is built on a programming language.
However, the syntax \cite{LispStat} of Lisp is not as familiar to many users
and thus, learning to program in Lisp is often perceived as an impediment.
Also, Lisp \cite{LispStat} does not provide a well-defined mechanism for
extending the language with domain-specific libraries, which limits the
amount of user supplied software to extend the capabilities of Lisp-Stat.

\end{comment}

\begin{comment}
FIXME: need to define what "delete" means. It is the deletion of
a widget, but some people might think it is the Delete key 
or deleting a  value in a sheet.

EAW: The delete event I'm referring to is when the Gtk window that contains the
drawing area (which becomes the device) is destroyed.  I've changed the
sentence below, which hopefully makes it clearer.
\end{comment}

