\documentclass[12pt]{article}

\setlength{\textwidth}{6.5in}
 \setlength{\textheight}{8.5in}
\setlength{\topmargin}{0.0in}

\setlength{\oddsidemargin}{0.0in}

\setlength{\tabcolsep}{3pt}

\setcounter{tocdepth}{5}



\usepackage{alltt}


\usepackage{graphicx}
\usepackage{curves}

\begin{document}

\Huge

\begin{center}

\textbf{Uni- and Bi-Dimensional Scaling: A Toolbox for MATLAB}

\end{center}

\bigskip

\large


\begin{center}

\bigskip


\bigskip



\end{center}






 \noindent Version: \today


\large

\newpage


\tableofcontents

\newpage

\listoftables

\listoffigures

\newpage

\section{Introduction}

A broad characterization of unidimensional scaling can be given as the search for an
arrangement of $n$ objects from a set, say $S = \{O_{1}, \ldots, O_{n}\}$, along a
single dimension (for linear unidimensional scaling (LUS)), or around a closed
circular structure (for circular unidimensional scaling (CUS)), such that the induced
$n(n-1)/2$ interpoint distances between the objects reflect the given proximity
information. These latter proximities are assumed to be the data available to guide
the search, and in the form of an $n \times n$ symmetric matrix $\mathbf{P} =
\{p_{ij}\}$, where $p_{ij}$ (= $p_{ji} \ge 0$, and $p_{ii} = 0$) is a dissimilarity
measure for the objects $O_{i}$ and $O_{j}$ in which larger values indicate more
dissimilar objects. We begin by presenting several illustrative data sets that can be
carried along throughout this monograph for our numerical illustrations.  Later sections
introduce the basic LUS and CUS tasks and provide a variety of useful extensions and
generalizations of each.  In all instances, the MATLAB computational environment is
relied on to effect our analyses, using the Statistical Toolbox, for example, to carry
out some of the common (multi)dimensional scaling methods, and our own open-source
MATLAB M-files (freely available as a Toolbox from a web site listed later),
whenever the extensions go beyond what is currently available commercially, and/or if
the commercial methods fail to provide adequate analysis strategies.

\smallskip

The title given to this monograph includes the phrase ``bidimensional scaling.''  The prefix ``bi'' is justified by considering an additive combination of two distinct unidimensional scales --- or to use jargon common to the multidimensional scaling literature, a unidimensional model is extended to one involving a two-dimensional city-block metric.  In theory, city-block scaling can be extended to more than two dimensions, but the convenient planar graphical representation would be lost; we therefore choose to limit our discussion to just the two-dimensional case.


\subsection{The Primary Proximity Matrix for Illustrating Unidimensional Scaling: Agreement Among Supreme Court Justices}

On Saturday, July 2, 2005, the lead headline in \emph{The New York Times} read as
follows: ``O'Connor to Retire, Touching Off Battle Over Court.''  Opening the story
attached to the headline, Richard W. Stevenson wrote, ``Justice Sandra Day O'Connor,
the first woman to serve on the United States Supreme Court and a critical swing vote
on abortion and a host of other divisive social issues, announced Friday that she is
retiring, setting up a tumultuous fight over her successor.'' Our interests are in the
data set also provided by the \emph{Times} that day, quantifying the (dis)agreement
among the Supreme Court justices during the decade they had been together. We give
this in Table 1 in the form of the percentage of non-unanimous cases in which the
justices \emph{dis}agree, from the 1994/95 term through 2003/04 (known as the
\mbox{Rehnquist} Court).  The dissimilarity matrix (in which larger entries reflect
less similar justices) is listed in the same row and column order as the \emph{Times}
data set, with the justices obviously ordered from ``liberal'' to ``conservative'':

\smallskip

\hspace{10ex} 1: John Paul Stevens (St)

\hspace{10ex} 2: Stephen G. Breyer (Br)

\hspace{10ex} 3: Ruth Bader Ginsberg (Gi)

\hspace{10ex} 4: David Souter (So)

\hspace{10ex} 5: Sandra Day O'Connor (Oc)

\hspace{10ex} 6: Anthony M. Kennedy (Ke)

\hspace{10ex} 7: William H. Rehnquist (Re)

\hspace{10ex} 8: Antonin Scalia (Sc)

\hspace{10ex} 9: Clarence Thomas (Th)

\smallskip

\begin{table}[b]

\begin{center}

\begin{tabular}{c|ccccccccc}

 & St & Br & Gi & So & Oc & Ke & Re & Sc & Th \\ \hline

1 St & .00 & .38 & .34 & .37 & .67 & .64 & .75 & .86 & .85 \\

2 Br & .38 & .00 & .28 & .29 & .45 & .53 & .57 & .75 & .76 \\

3 Gi & .34 & .28 & .00 & .22 & .53 & .51 & .57 & .72 & .74 \\

4 So & .37 & .29 & .22 & .00 & .45 & .50 & .56 & .69 & .71 \\

5 Oc & .67 & .45 & .53 & .45 & .00 & .33 & .29 & .46 & .46 \\

6 Ke & .64 & .53 & .51 & .50 & .33 & .00 & .23 & .42 & .41 \\

7 Re & .75 & .57 & .57 & .56 & .29 & .23 & .00 & .34 & .32 \\

8 Sc & .86 & .75 & .72 & .69 & .46 & .42 & .34 & .00 & .21 \\

9 Th & .85 & .76 & .74 & .71 & .46 & .41 & .32 & .21 & .00 \\

\end{tabular}

\end{center}

\caption{Dissimilarities Among Nine Supreme Court Justices.}


\end{table}

\noindent We use the Supreme Court data matrix of Table 1 for various illustrations of
unidimensional scaling in the sections to follow. It will be loaded into a MATLAB
environment with the command: \verb+load supreme_agree.dat+

\noindent The
\verb+supreme_agree.dat+ file is in simple \verb+ascii+ form with verbatim contents as
follows:

\normalsize

\begin{verbatim}
  .00  .38  .34  .37  .67  .64  .75  .86  .85
  .38  .00  .28  .29  .45  .53  .57  .75  .76
  .34  .28  .00  .22  .53  .51  .57  .72  .74
  .37  .29  .22  .00  .45  .50  .56  .69  .71
  .67  .45  .53  .45  .00  .33  .29  .46  .46
  .64  .53  .51  .50  .33  .00  .23  .42  .41
  .75  .57  .57  .56  .29  .23  .00  .34  .32
  .86  .75  .72  .69  .46  .42  .34  .00  .21
  .85  .76  .74  .71  .46  .41  .32  .21  .00
\end{verbatim}


\large

\subsection{Additional Data Sets Used for Illustration}

In addition to the data on the Supreme Court just described, there are five more data sets used throughout this monograph to provide examples of usage for
 specific M-files introduced.  One is from Johnson and Tversky (1980) on perceptions
of risk, and is in the form of an $18 \times 18$ symmetric proximity matrix.
In our circular scaling representations, we will rely on the famous Morse Code digit data
from Rothkopf (1957). The third proximity
matrix for our discussion of multidimensional scaling (really, in two dimensions)
based on the Euclidean and/or city-block metric, was derived from an inter-town
distance matrix among twenty-seven Hampshire County cities (in England), published by
John Norden in 1625.  Penultimately, we give six (two-mode or rectangular) ($10 \times 15$) proximity
matrices from Osgood and Luria (1954) that provide semantic differential data on a
well-known case of multiple personality (the \emph{Three Faces of Eve}). There are two
replications given for each of the separate personalities of Eve White, Eve Black, and
Jane; we will chose one of these matrices for purposes of illustration.  Finally, to have two skew-symmetric matrices to scale these kinds of data unidimensionally, we use an old data set from Thurstone (1959) involving the comparison of relative seriousness of thirteen offenses.  These comparisons were done by school children before and after seeing a movie showing what the life of a gambler was like.

\subsubsection{Risk Perception}




\begin{table}[b]

\begin{center}

\begin{tabular}{c|cccccccccccccccccc}

  & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 \\
  \hline
 1 & 0.0 & 7.6 & 6.9 & 5.4 & 6.2 & 7.5 & 6.4 & 7.1 & 6.2 & 7.5 & 7.1 & 8.2 & 6.0 & 7.7 & 6.8 & 6.9 & 4.8 &
 7.5 \\
 2 & 7.6 & 0.0 & 7.0 & 7.0 & 5.8 & 8.1 & 6.9 & 7.9 & 5.8 & 7.9 & 6.5 & 8.0 & 7.6 & 5.7 & 6.6 & 6.4 & 4.7 &
 6.2 \\
 3 & 6.9 & 7.0 & 0.0 & 3.0 & 5.9 & 7.6 & 7.4 & 7.9 & 3.3 & 8.3 & 6.5 & 7.9 & 7.7 & 7.0 & 6.1 & 6.7 & 7.0 &
 7.1 \\
 4 & 5.4 & 7.0 & 3.0 & 0.0 & 7.0 & 8.3 & 6.1 & 7.4 & 3.8 & 7.3 & 6.5 & 7.7 & 7.2 & 6.3 & 5.4 & 5.7 & 5.8 &
 6.1 \\
 5 & 6.2 & 5.8 & 5.9 & 7.0 & 0.0 & 8.5 & 5.3 & 6.5 & 3.3 & 7.7 & 6.5 & 8.2 & 7.9 & 7.0 & 2.3 & 6.9 & 7.2 &
 7.3 \\
 6 & 7.5 & 8.1 & 7.6 & 8.3 & 8.5 & 0.0 & 7.5 & 4.4 & 5.8 & 6.9 & 8.1 & 4.1 & 3.0 & 8.2 & 8.1 & 7.6 & 6.7 &
 8.0 \\
 7 & 6.4 & 6.9 & 7.4 & 6.1 & 5.3 & 7.5 & 0.0 & 7.7 & 8.0 & 8.0 & 4.0 & 8.2 & 7.5 & 3.8 & 7.5 & 6.8 & 5.3 &
 3.0 \\
 8 & 7.1 & 7.9 & 7.9 & 7.4 & 6.5 & 4.4 & 7.7 & 0.0 & 8.1 & 6.1 & 6.9 & 3.8 & 4.8 & 8.4 & 8.0 & 6.7 & 7.7 &
 7.4 \\
 9 &  6.2 & 5.8 & 3.3 & 3.8 & 3.3 & 5.8 & 8.0 & 8.1 & 0.0 & 7.8 & 6.5 & 7.1 & 6.3 & 7.0 & 2.4 & 6.5 & 7.1 &
 7.0 \\
 10 & 7.5 & 7.9 & 8.3 & 7.3 & 7.7 & 6.9 & 8.0 & 6.1 & 7.8 & 0.0 & 8.0 & 4.3 & 4.1 & 7.7 & 8.6 & 7.0 & 6.9 &
 7.4 \\
 11 & 7.1 & 6.5 & 6.5 & 6.5 & 6.5 & 8.1 & 4.0 & 6.9 & 6.5 & 8.0 & 0.0 & 6.9 & 8.3 & 7.1 & 6.3 & 2.7 & 6.8 &
 4.3 \\
 12 & 8.2 & 8.0 & 7.9 & 7.7 & 8.2 & 4.1 & 8.2 & 3.8 & 7.1 & 4.3 & 6.9 & 0.0 & 7.1 & 8.1 & 7.9 & 7.0 & 7.8 &
 7.9 \\
 13 & 6.0 & 7.6 & 7.7 & 7.2 & 7.9 & 3.0 & 7.5 & 4.8 & 6.3 & 4.1 & 8.3 & 7.1 & 0.0 & 7.1 & 4.9 & 7.4 & 5.7 &
 7.8 \\
 14 & 7.7 & 5.7 & 7.0 & 6.3 & 7.0 & 8.2 & 3.8 & 8.4 & 7.0 & 7.7 & 7.1 & 8.1 & 7.1 & 0.0 & 7.1 & 6.4 & 7.1 &
 2.5 \\
 15 & 6.8 & 6.6 & 6.1 & 5.4 & 2.3 & 8.1 & 7.5 & 8.0 & 2.4 & 8.6 & 6.3 & 7.9 & 4.9 & 7.1 & 0.0 & 5.5 & 7.5 &
 7.8 \\
 16 & 6.9 & 6.4 & 6.7 & 5.7 & 6.9 & 7.6 & 6.8 & 6.7 & 6.5 & 7.0 & 2.7 & 7.0 & 7.4 & 6.4 & 5.5 & 0.0 & 5.8 &
 7.8 \\
 17 & 4.8 & 4.7 & 7.0 & 5.8 & 7.2 & 6.7 & 5.3 & 7.7 & 7.1 & 6.9 & 6.8 & 7.8 & 5.7 & 7.1 & 7.5 & 5.8 & 0.0 &
 7.0 \\
 18 & 7.5 & 6.2 & 7.1 & 6.1 & 7.3 & 8.0 & 3.0 & 7.4 & 7.0 & 7.4 & 4.3 & 7.9 & 7.8 & 2.5 & 7.8 & 7.8 & 7.0 &
 0.0 \\




\end{tabular}

\end{center}

\caption{Dissimilarities Among Eighteen Risks.}


\end{table}



The data set on risk perception (an $18 \times 18$ proximity matrix) is generated from Johnson and
Tversky (1984) and  given in Table 2.  It involves eighteen risks:

\smallskip

1: accidental falls

2: airplane accidents

3: electrocution

4: fire

5: flood

6: heart disease

7: homicide

8: leukaemia

9: lightning

10: lung cancer

11: nuclear accident

12: stomach cancer

13: stroke

14: terrorism

15: tornados

16: toxic chemical spill

17: traffic accidents

18: war

\smallskip

\noindent The original proximity matrix was obtained by averaging the ratings from a
group of subjects who evaluated risk pairs on a scale from one (very dissimilar) to
nine (very similar).  To key these as dissimilarities, the similarities were
subtracted from 10.0 to produce the entries given in Table 2 (the \verb+ascii+ data
file is called \verb+risk_rate.dat+).






\subsubsection{Morse Code Digit Data}

A different data set used to illustrate the fitting of (multiple) circular structures, given in the form of a rather
well-known proximity matrix in Table 3 (and called \verb+morse_digits+). The later
is a $10 \times 10$ proximity matrix for the ten Morse Code symbols that represent the
first ten digits: (0: $-$ $-$ $-$ $-$ $-$; 1: $\bullet$ $-$ $-$ $-$ $-$; 2: $\bullet$
$\bullet$ $-$ $-$ $-$; 3: $\bullet$ $\bullet$ $\bullet$ $-$ $-$; 4: $\bullet$
$\bullet$ $\bullet$ $\bullet$ $-$; 5: $\bullet$ $\bullet$ $\bullet$ $\bullet$
$\bullet$    ; 6: $-$ $\bullet$ $\bullet$ $\bullet$ $\bullet$   ; 7: $-$ $-$ $\bullet$
$\bullet$ $\bullet$ ; 8: $-$ $-$ $-$ $\bullet$ $\bullet$  ; 9: $-$ $-$ $-$ $-$
$\bullet$). (Note that the labeling of objects in the output is from 1 to 10; thus, a
translation back to the actual numbers corresponding to the Morse Code symbols
requires a subtraction of one.) The entries in Table 3 have a dissimilarity
interpretation and are defined for each object pair by 2.0 minus the sum of the two
proportions for a group of subjects used by Rothkopf in the 1950's, representing
``same'' judgments to the two symbols when given in the two possible presentation orders
of the signals. Based on previous multidimensional scalings of the complete data set
involving all of the Morse code symbols and in which the data of Table 3 are embedded,
it might be expected that the symbols for the digits would form a clear linear
unidimensional structure that would be interpretable according to a regular
progression in the number of dots to dashes. It turns out, as discussed in greater
detail in a later section, that a circular model (or better, the sum of two such circular models)
is probably more consistent with the patterning of the proximities in Table 3 than are
representations based on linear unidimensional scalings.



\begin{table}
\caption{A Proximity Matrix, morse\_digits, for the Ten Morse Code Symbols
Representing the First Ten Digits.}

\begin{center}

\begin{verbatim}
     0.00  .75 1.69 1.87 1.76 1.77 1.59 1.26  .86  .95
      .75 0.00  .82 1.54 1.85 1.72 1.51 1.50 1.45 1.63
     1.69  .82 0.00 1.25 1.47 1.33 1.66 1.57 1.83 1.81
     1.87 1.54 1.25 0.00  .89 1.32 1.53 1.74 1.85 1.86
     1.76 1.85 1.47  .89 0.00 1.41 1.64 1.81 1.90 1.90
     1.77 1.72 1.33 1.32 1.41 0.00  .70 1.56 1.84 1.64
     1.59 1.51 1.66 1.53 1.64  .70 0.00  .70 1.38 1.70
     1.26 1.50 1.57 1.74 1.81 1.56  .70 0.00  .83 1.22
      .86 1.45 1.83 1.85 1.90 1.84 1.38  .83 0.00  .41
      .95 1.63 1.81 1.86 1.90 1.64 1.70 1.22  .41 0.00
\end{verbatim}

\end{center}

\end{table}



\subsubsection{Hampshire County (in England) Inter-town Distances}



\begin{table}[b]


\begin{center}

\begin{tabular}{c|ccccccccccccccccccccccccccc}

& 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  \\ \hline
  1 & 0 & 12 & 24 & 20 & 16 & 10 & 35 & 32 & 22 & 18 & 18 & 13 & 25 & 43 & 38 & 37 & 25 & 24 & 20 & 17 & 12 &   6 &   8 & 16 & 20 & 23 &
  18 \\
 2 & 12 &   0 & 27 & 18 & 18 &   5 & 43 & 38 & 30 & 27 & 16 &   8 & 32 & 48 & 44 & 40 & 30 & 24 & 14 & 24 & 17   & 9 & 17 & 28 & 29 & 32 &
 24 \\
 3 & 24 & 27  & 0 & 10 &   9 & 22 & 20 & 17 & 18 & 15 & 12 & 18 & 13 & 25 & 19 & 15  & 7 & 16 & 16 & 13 &  8 & 20 & 20 & 23 & 18 & 23 &
 6 \\
 4 & 20 & 18 & 10   & 0 &  6 & 14 & 30 & 26 & 23 & 20 &   3  & 9 & 21 & 38 & 30 & 24 & 16 &   6   & 6 & 16 & 11 & 22 & 18 & 26 & 23 & 28 &
 11 \\
 5 & 16 & 18 &   9   & 6   & 0 & 13 & 25 & 23 & 18 & 15 &  6 &  9 & 17 & 32 & 27 & 23 & 13 &   8 & 10 & 12  & 6 & 11 & 13 & 21 & 18 & 22 &
 9 \\
 6 & 10 &   5 & 22 & 14 & 13  & 0 & 37 & 34 & 26 & 23 & 11   & 4 & 24 & 44 & 38 & 36 & 25 & 19 & 11 & 20 & 12   & 5 & 14 & 24 & 24 & 28 &
 19 \\
 7 & 35 & 43 & 20 & 30 & 25 & 37  & 0   & 4 & 13 & 16 & 30 & 34  & 9  & 9   & 8 & 11 & 13 & 25 & 35 & 20 & 24 & 32 & 26 & 20 & 15 & 16 &
 18 \\
 8 & 32 & 38 & 17 & 26 & 23 & 34   & 4 &   0 & 10 & 12 & 27 & 32   & 5 & 13 & 11 & 12 & 11 & 22 & 32 & 13 & 20 & 28 & 30 & 17 & 12 & 14 &
 16 \\
 9 & 22 & 30 & 18 & 23 & 18 & 26 & 13 & 10   & 0   & 3 & 26 & 25   & 6 & 21 & 20 & 19 & 11 & 21 & 27 &  6 & 14 & 21 & 14   & 9   & 2   & 7 &
 12 \\
 10 & 18 & 27 & 15 & 20 & 15 & 23 & 16 & 12   & 3   & 0 & 20 & 22   & 8 & 24 & 21 & 20 & 11 & 20 & 24 & 20 & 11 & 18 & 11   & 8   & 3  & 8 &
 10 \\
 11 & 18 & 16 & 12   & 3  & 6 & 11 & 30 & 27 & 26 & 20   & 0  & 7 & 22 & 36 & 30 & 26 & 17   & 8   & 5 & 16 & 10 & 12 & 17 & 26 & 22 & 27 &
 12 \\
 12 & 13   & 8 & 18   & 9   & 9 &   4 & 34 & 32 & 25 & 22 &   7  & 0 & 25 & 41 & 36 & 32 & 22 & 16   & 6 & 18 & 11   & 7 & 15 & 25 & 24 & 28 &
 16 \\
 13 & 25 & 32 & 13 & 21 & 17 & 24   & 9   & 5   & 6  & 8 & 22 & 25   & 0 & 17 & 14 & 13  & 7 & 19 & 26  & 8 & 15 & 23 & 17 & 14   & 8 & 12 &
 10 \\
 14 & 43 & 48 & 25 & 38 & 32 & 44  & 9 & 13 & 21 & 24 & 36 & 41 & 17  & 0  & 6 & 11 & 20 & 30 & 41 & 24 & 32 & 40 & 35 & 29 & 24 & 26 &
 26 \\
 15 & 38 & 44 & 19 & 30 & 27 & 38  & 8 & 11 & 20 & 21 & 30 & 36 & 14 &   6   & 0 &   5 & 14 & 24 & 36 & 22 & 27 & 26 & 39 & 28 & 22 & 23 &
 20 \\
 16 & 37 & 40 & 15 & 24 & 23 & 36 & 11 & 12 & 19 & 20 & 26 & 32 & 13 & 11   & 5   & 0 & 11 & 20 & 31 & 19 & 24 & 32 & 29 & 28 & 21 & 24 &
 17 \\
 17 & 25 & 30   & 7 & 16 & 13 & 25 & 13 & 11 & 11 & 11 & 17 & 22   & 7 & 20 & 14 & 11   & 0 & 12 & 22 & 10 & 13 & 22 & 19 & 20 & 13 & 18   &
 7 \\
 18 & 24 & 24 & 16 &   6 &   8 & 19 & 25 & 22 & 21 & 20 &   8 & 16 & 19 & 30 & 24 & 20 & 12   & 0 & 11 & 16 & 13 & 18 & 20 & 27 & 20 & 27 &
 10 \\
 19 & 20 & 14 & 16 &  6 & 10 & 11 & 35 & 32 & 27 & 24   & 5   & 6 & 26 & 41 & 36 & 31 & 22 & 11  & 0 & 21 & 13 & 13 & 20 & 29 & 26 & 32 &
 16 \\
 20 & 17 & 24 & 13 & 16 & 12 & 20 & 20 & 13 &   6 & 20 & 16 & 18   & 8 & 24 & 22 & 19 & 10 & 16 & 21 &   0  & 8 & 15 & 10 & 11   & 6 & 11 &
 6 \\
 21 & 12 & 17 &   8 & 11 &  6 & 12 & 24 & 20 & 14 & 11 & 10 & 11 & 15 & 32 & 27 & 24 & 13 & 13 & 13   & 8   & 0   & 8   & 8 & 16 & 14 & 18 &
 7 \\
 22 &   6 &   9 & 20 & 22 & 11 &   5 & 32 & 28 & 21 & 18 & 12  & 7 & 23 & 40 & 26 & 32 & 22 & 18 & 13 & 15   & 8   & 0   & 8 & 19 & 20 & 23 &
 15 \\
 23 &   8 & 17 & 20 & 18 & 13 & 14 & 26 & 30 & 14 & 11 & 17 & 15 & 17 & 35 & 39 & 29 & 19 & 20 & 20 & 10  & 8  & 8  & 0 & 11 & 12 & 15 &
 13 \\
 24 & 16 & 28 & 23 & 26 & 21 & 24 & 20 & 17 &   9   & 8 & 26 & 25 & 14 & 29 & 28 & 28 & 20 & 27 & 29 & 11 & 16 & 19 & 11   & 0   & 7   & 8 &
 17 \\
 25 & 20 & 29 & 18 & 23 & 18 & 24 & 15 & 12 &   2 &   3 & 22 & 24  & 8 & 24 & 22 & 21 & 13 & 20 & 26   & 6 & 14 & 20 & 12   & 7  & 0  & 5 &
 13 \\
 26 & 23 & 32 & 23 & 28 & 22 & 28 & 16 & 14 &  7 &  8 & 27 & 28 & 12 & 26 & 23 & 24 & 18 & 27 & 32 & 11 & 18 & 23 & 15 &  8 &   5 &   0 &
 22 \\
 27 & 18 & 24  & 6 & 11  & 9 & 19 & 18 & 16 & 12 & 10 & 12 & 16 & 10 & 26 & 20 & 17  & 7 & 10 & 16  & 6  & 7 & 15 & 13 & 17 & 13 & 22 &
 0 \\

 \end{tabular}

\end{center}

\caption{A Dissimilarity Matrix Among Twenty-seven Hampshire County Towns.}


\end{table}



Table 4 provides a $27 \times 27$ dissimilarity matrix among twenty-seven Hampshire
County towns (the first name listed is from Figure 1; current spellings are given in
parentheses):

\smallskip

1: Bramfhot (Bramshott)

2: Hertford bridge (Hartfordbridge)

3: Stoke-bridge (Stockbridge)

4: Whit-church (Whitchurch)

5: Micheldouer (Micheldever)

6: Odyam (Odiham)

7: Lymington (Lymington)

8: Beaulieu (Beaulieu)

9: Titchefeild (Titchefield)

10: Wickham (Wickham)

11: Ouerton (Overton)

12: Bafingftoke (Basingstoke)

13: S. Hampton (Southhamption)

14: Chrift-Church (ChristChurch)

15: Ryngwood (Ringwood)

16: Fording-Bridge (Fordingbridge)

17: Rumfey (Romsey)

18: Andouer (Andover)

19: Kingefelere (Kingsclere)

20: B. Waltham (Bishops Waltham)

21: Alresforde (Alresford)

22: Alton (Alton)

23: Petersfeild (Petersfield)

24: Hauant (Havant)

25: Fareham (Fareham)

26: Portefmouth (Portesmouth)

27: Winchefter (Winchester)



\smallskip

\noindent These data are from John Norden's book (published 1625), \emph{England, an
Intended Guyde for English Travailers}.  A facsimile page is given in Figure 1 (with
its interesting reverse column order compared to Table 4); a (more or less current
map) of the county appears in Figure 2 (Cobbett's Hampshire Map from 1830) that  shows
many of the twenty-seven county towns.  Hampshire County is in south-central England
and borders on the English Channel.  It includes the port of Southampton (from whence
the Titanic sailed on its maiden voyage (April 10, 1912; see Figure 3)) (the
\verb+ascii+ data file is called \verb+hampshire_proximities.dat+).



\begin{figure}

\hfil \scalebox{.75}{\includegraphics{hampshire_distances.eps}} \hfil

\caption{Facsimile of John Norden's Distance Map for Hampshire County (1625).}

\end{figure}

\newpage

\begin{figure}

\hfil \scalebox{.75}{\includegraphics{Cobbett's_Hampshire_1830.eps}} \hfil

\caption{Cobbett's 1830 Map of Hampshire County.}

\end{figure}

\newpage

\begin{figure}

\hfil \scalebox{.75}{\includegraphics{titanic.eps}} \hfil

\caption{A Famous Sailing from Southampton.}

\end{figure}





\begin{table}[b]

\begin{center}

\begin{tabular}{c|ccccccccccccccc}

 concepts & 1(a) & 2(b) & 3(c) & 4(d) & 5(e) & 6(f) & 7(g) & 8(h) & 9(i) & 10(j) & 11(k) & 12(l) & 13(m) & 14(n) & 15(o)\\ \hline

scales & & & & & & & & & & & & & & & \\

 1 & 4.0 & 1.0 & 7.0 & 7.0 & 1.0 & 1.0 & 1.0 & 7.0 & 6.5 & 2.5 & 3.5 & 6.0 & 7.0 & 4.0 &
 1.0 \\
 2 & 7.0 & 7.0 & 1.0 & 1.0 & 7.0 & 7.0 & 4.5 & 1.0 & 2.0 & 7.0 & 4.5 & 1.5 & 1.0 & 7.0 &
 7.0 \\
 3 & 1.0 & 1.0 & 7.0 & 7.0 & 4.0 & 2.5 & 4.0 & 7.0 & 6.0 & 4.0 & 2.0 & 6.5 & 1.0 & 1.5 &
 1.0 \\
 4 & 1.0 & 7.0 & 7.0 & 4.0 & 5.5 & 4.0 & 4.0 & 7.0 & 6.5 & 2.5 & 6.0 & 6.5 & 1.0 & 4.0 &
 1.0 \\
 5 & 7.0 & 4.0 & 1.0 & 1.0 & 7.0 & 1.0 & 1.0 & 1.0 & 1.5 & 7.0 & 2.0 & 1.0 & 4.0 & 4.5 &
 4.0 \\
 6 & 2.0 & 1.0 & 7.0 & 7.0 & 4.0 & 1.5 & 7.0 & 7.0 & 5.0 & 4.0 & 4.5 & 6.0 & 7.0 & 1.5 &
 4.0 \\
 7 & 1.0 & 7.0 & 7.0 & 7.0 & 1.0 & 1.0 & 4.0 & 7.0 & 6.0 & 4.0 & 5.0 & 6.5 & 1.0 & 1.0 &
 1.0 \\
 8 & 7.0 & 7.0 & 1.5 & 1.0 & 7.0 & 7.0 & 7.0 & 1.0 & 2.0 & 5.5 & 3.5 & 2.0 & 1.0 & 4.0 &
 7.0 \\
 9 & 7.0 & 7.0 & 1.0 & 1.0 & 7.0 & 4.0 & 7.0 & 1.0 & 1.5 & 4.0 & 2.0 & 1.5 & 7.0 & 4.0 &
 7.0 \\
 10 & 7.0 & 7.0 & 1.0 & 1.0 & 7.0 & 7.0 & 1.0 & 1.0 & 1.5 & 7.0 & 4.5 & 1.5 & 1.0 & 4.0 &
 7.0 \\
\end{tabular}

\end{center}

\caption{A Two-Mode Dissimilarity Matrix for Eve Black Between Ten Scales and Fifteen
Concepts.}

\end{table}




\clearpage

\subsubsection{Semantic Differential Data on the ``Three Faces of Eve''}

To have available a two-mode ($10 \times 15$) matrix for purposes of illustration, we
chose the first replication of Eve Black's Semantic Differential data  given in Table
5 (\verb+eve_black_one.dat+).  There are six such exemplars available:

 \verb+multistructuralanalysis_mfiles+:

\verb+eve_white_one.dat+; \verb+eve_white_two.dat+; \verb+eve_black_one.dat+

\verb+eve_black_two.dat+; \verb+jane_one.dat+; \verb+jane_two.dat+

\noindent Readers are welcome to experiment with these as they see fit. All have the
same ten rows (or scales) with the table entries being dissimilarities for the
left-most member of the bipolar pair:

\smallskip

1) cold-hot

2) valuable-worthless

3) tense-relaxed

4) small-large

5) fast-slow

6) dirty-clean

7) weak-strong

8) tasty-distasteful

9) deep-shallow

10) active-passive

\smallskip

\noindent The fifteen columns correspond to the concepts being rated:

1(a): love

2(b): child

3(c): my doctor

4(d): me

5(e): my job

6(f): mental sickness

7(g): my mother

8(h): peace of mind

9(i): fraud

10(j): my spouse

11(k): self-control

12(l): hatred

13(m): my father

14(n): confusion

15(o): sex

\smallskip




To provide some background for these data, we give a short plot summary for the 1957
movie, \emph{The Three Faces of Eve}; Joanne Woodward won an Oscar for her portrayal
of Eve White/Eve Black/Jane:

\bigskip

Eve White is a quite, mousy, unassuming wife and mother who keeps suffering from
headaches and occasional black outs. Eventually she is sent to see psychiatrist
 Dr.\ Luther, and, while under hypnosis, a whole new personality emerges: the racy, wild,
fun-loving Eve Black. Under continued therapy, yet a third personality appears, the
relatively stable Jane. This film, based on the true-life case of a multiple
personality, chronicles Dr.\ Luther's attempts to reconcile the three faces of Eve's
multiple personalities.

\bigskip

\noindent

The real reason, however, that this particular data matrix exemplar is used from among
the six we have available, is to give two quotes from the movie:

\bigskip

Ralph White: I've never seen you take a drink in your life.

Eve Black: Honey, there are a lot of things you ain't never seen me do; that's no sign
I don't do 'em.

\bigskip

The Soldier: When I spend eight bucks on a dame, I don't just go home with the morning
paper, y'know what I mean?

\subsubsection{Skew-Symmetric Matrices from Thurstone}

To have (two) skew-symmetric matrices for use in our examples, we begin with a very old data set, originally collected in 1929 in a study of the influence of motion pictures on children's attitudes (see Thurstone, 1959, pp.\ 309--319).  Both before and after seeing a film entitled \emph{Street of Chance}, which depicted the life of a gambler, 240 school children were asked to compare the relative seriousness of thirteen offenses presented in all 78 possible pairs:

\bigskip

1): bankrobber

2): gambler

3): pickpocket

4): drunkard

5): quack doctor

6): bootlegger

7): beggar

8): gangster

9): tramp

10): speeder

11): petty thief

12): kidnaper

13): smuggler

\bigskip

\noindent The data are given below, where the entries show the proportion of the school children who rated the offense listed in the column to be more serious than the offense listed in the row.  The above-diagonal entries were obtained before the showing of the film; those below were collected after. The obvious substantive question here involves the effect of the film on the assessment of the offense of being a gambler.

\bigskip

\begin{tabular}{llllllllllllll}




 1:bankrobber    & x   & .07  & .08  & .05  & .27  & .29  & .01  & .50  & .00  & .06 & .02  & .73  & .21   \\
 2:gambler    & .79   & x  & .71  & .52  & .76  & .92  & .07  & .92  & .05  & .41 &  .49 & .90  & .81   \\
 3:pickpocket    & .93   & .51  & x  & .25  & .67  & .75  & .02  & .86  & .02  & .39 & .42  & .87  & .68   \\
 4:drunkard    &  .95  & .70  & .70  & x  & .81  & .95  & .01  & .92  & .03  & .37 & .62  & .91  & .87   \\
 5:quack doctor    &  .67  & .36  & .28  & .16  &  x  & .49  & .02  & .70  & .02  & .12 & .22  & .64  & .55   \\
 6:bootlegger    & .70   & .31  & .30  & .13  & .50  & x  & .00  & .79  & .01  & .09 & .26  & .68  & .50   \\
 7:beggar    &  .98  & .95  & .97  & .94  & .98  & .98  & x  & .96  & .42  & .86 & .96  & 1.0  & .99   \\
 8:gangster    & .50   & .18  & .13  & .11  & .32  & .27  & .01  & x  & .02  & .08 & .08  & .36  & .31   \\
 9:tramp    &  1.0  & .96  & .98  & .96  & .99  & .98  & .64  & .99  & x  & .91 & .97  & .99  & 1.0   \\
 10:speeder    & .94   & .73  & .68  & .67  & .89  & .90  & .21  & .94  & .13  & x & .58  & .90  & .92   \\
 11:petty thief    & .97   & .64  & .62  & .47  & .81  & .76  & .06  & .89  & .05  & .36 & x  & .98  & .78   \\
 12:kidnaper    & .38   & .27  & .16  & .08  & .35  & .30  & .02  & .62  & .01  & .08 & .03  & x  & .27   \\
 13:smuggler    &  .73  & .31  & .30  & .16  & .46  & .49  & .02  & .66  & .02  & .11 & .24  & .64  & x   \\



  \end{tabular}

  \bigskip

  To generate two skew-symmetric matrices from the data just given, the entry defined for each pair of offenses in the ``before'' and ``after'' skew-symmetric matrices, is a difference in the proportions of rating one offense more serious than the other.  For example, because the proportion judging a bootlegger more serious than a bankrobber is .29 before the movie was shown, an entry of $.29 - .79 = -.42$ is present for the (bankrobber,  bootlegger) above-diagonal pair in the before matrix: the negative value above the diagonal indicates that the second member (bootlegger) is less serious than the first (bankrobber) (the two data matrices are called

  \verb+thurstone_skew_symmetric_before.dat+;

   \verb+thurstone_skew_symmetric_after.dat+.












\section{The Basics of  Linear Unidimensional Scaling (LUS)}

The LUS task can be characterized as arranging the objects in $S$
along a single dimension such that the induced $n(n-1)/2$ interpoint
distances between the objects reflect the proximities in
$\mathbf{P}$. The most common formalization of this task  is through
a least-squares criterion and finding $n$ coordinates, $x_{1},
x_{2}, \ldots, x_{n}$, so

\begin{equation}
\sum_{i<j}(p_{ij} - |x_{j} - x_{i}|)^{2}
\end{equation}

\noindent is minimized.  In turn, this optimization suggested by (1)
can be rephrased as two separate problems to be solved
simultaneously: find a set of $n$ numbers, $x_{1} \le x_{2} \le
\cdots \le x_{n}$, \emph{and} a permutation on the first $n$
integers, $\rho(\cdot) \equiv  \rho$, for which

\begin{equation}
\sum_{i<j}(p_{\rho(i) \rho(j)} - (x_{j} - x_{i}))^{2}
\end{equation}

\noindent is minimized.  Thus, a set of locations (coordinates) is
defined along a continuum as represented in ascending order by the
sequence $x_{1}, x_{2}, \ldots, x_{n}$; the $n$ objects are
allocated to these locations by the permutation $\rho$, so object
$O_{\rho(i)}$ is placed at location $i$.

\smallskip

The minimization of (2) can be carried out directly by the
maximization of the single term, $\sum_{i}(t_{i}^{(\rho)})^{2}$
(under the mild regularity condition that all off-diagonal
proximities in $\mathbf{P}$ are positive and not merely
nonnegative), where

\[ t_{i}^{(\rho)} = (u_{i}^{(\rho)} - v_{i}^{(\rho)})/n ,\]

\noindent for

\[ u_{i}^{(\rho)} = \sum_{j=1}^{i-1} p_{\rho(i) \rho(j)}, \ \mathrm{when} \ i \ge 2 ; \]

\[ v_{i}^{(\rho)} = \sum_{j = i+1}^{n} p_{\rho(i) \rho(j)}, \ \mathrm{when} \ i < n , \]

\noindent

\noindent and

\[ u_{1}^{(\rho)} =  v_{n}^{(\rho)} = 0 .\]

\noindent In words, $u_{i}^{(\rho)}$ is the sum of the entries within row $\rho(i)$ of
$\{p_{\rho(i) \rho(j)}\}$ from the extreme left up to the main diagonal;
$v_{i}^{(\rho)}$ is the sum from the main diagonal to the extreme right.  If
$\rho^{*}$ denotes the permutation that maximizes $\sum_{i}(t_{i}^{(\rho)})^{2}$, then
we can let $x_{i} = t_{i}^{(\rho^{*})}$, with the order induced by
$t_{1}^{(\rho^{*})}, \ldots, t_{n}^{(\rho^{*})}$ being consistent with the constraint,
$x_{1} \le x_{2} \le \cdots \le x_{n}$.  In short, the minimization of (2) reduces to
the combinatorial optimization of the single term $\sum_{i}(t_{i}^{(\rho)})^{2}$, and
where the coordinate estimation is completed as an automatic byproduct.

\subsection{Iterative Quadratic Assignment}

Because the measure of loss in (2) can be reduced algebraically to
\begin{equation}
\sum_{i < j} p_{ij}^{2} + n(\sum_{i} x_{i}^{2} - 2\sum_{i} x_{i}
t_{i}^{(\rho)}) ,
\end{equation}
subject to the constraints that $x_{1} \le \cdots \le x_{n}$ and
$\sum_{i} x_{i} = 0$, or as
\begin{equation}
\sum_{i < j} p_{ij}^{2} + n \left( \sum_{i} (x_{i} -
t_{i}^{(\rho)})^{2} - \sum_{i} (t_{i}^{(\rho)})^{2} \right) ,
\end{equation}
the two optimization subproblems to be solved simultaneously of
identifying an optimal permutation and a set of coordinates can be
separated:

\smallskip

(a)  assuming that an ordering of the objects is known (and denoted,
say, as $\rho^{0}$ for the moment), find those values $x_{1}^{0} \le
\cdots \le x_{n}^{0}$ to minimize $\sum_{i} (x_{i}^{0} -
t_{i}^{(\rho^{0})})^{2}$.  If the permutation $\rho^{0}$ produces a
\emph{monotonic} form for the matrix $\{p_{\rho^{0}(i)
\rho^{0}(j)}\}$ in the sense that $t_{1}^{(\rho^{0})} \le
t_{2}^{(\rho^{0})} \le \cdots \le t_{n}^{(\rho^{0})}$, the
coordinate estimation is immediate by letting $x_{i}^{0} =
t_{i}^{(\rho^{0})}$, in which case $\sum_{i} (x_{i}^{0} -
t_{i}^{(\rho^{0})})^{2}$ is zero.


\smallskip

(b) assuming that the locations $x_{1}^{0} \le \cdots \le x_{n}^{0}$ are known, find
the permutation $\rho^{0}$ to maximize $\sum_{i} x_{i} t_{i}^{(\rho^{0})}$.  Any such
permutation which even only locally maximizes $\sum_{i} x_{i} t_{i}^{(\rho^{0})}$, in
the sense that no adjacently placed pair of objects in $\rho^{0}$ could be
interchanged to increase the index, will produce a monotonic form for the nonnegative
matrix $\{p_{\rho^{0}(i) \rho^{0}(j)}\}$. Also, the task of finding the permutation
$\rho^{0}$ to maximize $\sum_{i} x_{i} t_{i}^{(\rho^{0})}$ is actually a quadratic
assignment (QA) task, discussed extensively in the literature of operations research.
As usually defined, a QA problem involves two $n \times n$ matrices, $\mathbf{A} =
\{a_{ij}\}$ and $\mathbf{B} = \{b_{ij}\}$, and we seek a permutation $\rho$ to
maximize
\begin{equation} \Gamma(\rho) = \sum_{i,j} a_{\rho(i) \rho(j)}
b_{ij}.
\end{equation}
If we define $b_{ij} = |x_{i} - x_{j}|$ and let $a_{ij} = p_{ij}$, then \[
\Gamma(\rho) = \sum_{i,j} p_{\rho(i) \rho(j)} |x_{i} - x_{j}| = 2n \sum_{i} x_{i}
t_{i}^{(\rho)}, \] and thus, the permutation that maximizes $\Gamma(\rho)$ also
maximizes $\sum x_{i} t_{i}^{(\rho)}$.



\subsection{An M-file for Performing LUS Through Iterative QA}

To carry out the unidimensional scaling of proximity matrix, we will rely on the
M-file, \verb+uniscalqa.m+, downloadable (as are all the other M-files we mention
throughout this monography) as open-source code from

\verb+http://cda.psych.uiuc.edu/new_unidimensionalscaling_mfiles+.

\noindent  We give the output from a MATLAB session below using the data of Table 1.
We note that these Supreme Court data were first written into a text file called
\verb+supreme_agree.dat+ and placed into the MATLAB workspace with the \verb+load+
command.  Also, from the help file written as part of the output for \verb+uniscalqa.m+ (and which is also
given in the Appendix), the proximity input
matrix is called \verb+supreme_agree+; we use an equally-spaced target matrix
\verb+targlin(9)+ (available from the same site that \verb+uniscalqa.m+ was obtained);
the built-in MATLAB random permutation generator, \verb+randperm(9)+, is invoked for a
starting permutation.

\small
\begin{verbatim}
>> load supreme_agree.dat
>> supreme_agree

supreme_agree =

     0    0.3800    0.3400    0.3700    0.6700    0.6400    0.7500    0.8600    0.8500
0.3800         0    0.2800    0.2900    0.4500    0.5300    0.5700    0.7500    0.7600
0.3400    0.2800         0    0.2200    0.5300    0.5100    0.5700    0.7200    0.7400
0.3700    0.2900    0.2200         0    0.4500    0.5000    0.5600    0.6900    0.7100
0.6700    0.4500    0.5300    0.4500         0    0.3300    0.2900    0.4600    0.4600
0.6400    0.5300    0.5100    0.5000    0.3300         0    0.2300    0.4200    0.4100
0.7500    0.5700    0.5700    0.5600    0.2900    0.2300         0    0.3400    0.3200
0.8600    0.7500    0.7200    0.6900    0.4600    0.4200    0.3400         0    0.2100
0.8500    0.7600    0.7400    0.7100    0.4600    0.4100    0.3200    0.2100         0

>> help uniscalqa.m

   UNISCALQA carries out a unidimensional scaling of a symmetric
   proximity matrix using iterative quadratic assignment.

   syntax: [outperm, rawindex, allperms, index, coord, diff] = ...
    uniscalqa(prox, targ, inperm, kblock)

   PROX is the input proximity matrix (with a zero main diagonal
   and a dissimilarity interpretation);
   TARG is the input target matrix (usually with a zero main
   diagonal and a dissimilarity interpretation representing
   equally spaced locations along a continuum);
   INPERM is the input beginning permutation (a permutation of the
   first $n$ integers). OUTPERM is the final permutation of PROX
   with the cross-product index RAWINDEX
   with respect to TARG redefined as
   $ = \{abs(coord(i) - coord(j))\}$;
   ALLPERMS is a cell array containing INDEX entries corresponding
   to all the permutations identified in the optimization from
   ALLPERMS{1} = INPERM to ALLPERMS{INDEX} = OUTPERM.
   The insertion and rotation routines use from 1 to KBLOCK
   (which is less than or equal to $n-1$) consecutive objects in
   the permutation defining the row and column order of the data
   matrix.  COORD is the set of coordinates of the unidimensional
   scaling in ascending order;
   DIFF is the value of the least-squares loss function for the
   coordinates and object permutation.



>> [outperm, rawindex, allperms, index, coord, diff] = ...
    uniscalqa(supreme_agree, targlin(9), randperm(9), 1);

>> outperm

outperm =

     1     2     3     4     5     6     7     8     9

>> coord

coord =

   -0.5400
   -0.3611
   -0.2967
   -0.2256
    0.0622
    0.1611
    0.2567
    0.4478
    0.4956

>> diff

diff =

    0.4691
\end{verbatim}

\large





\noindent As might be expected given the \emph{Times} presentation of Table 1 using
the order from ``liberal'' to ``conservative,'' the obtained unidimensional scaling was
for the identity permutation in \verb+outperm+ with the (ordered) coordinates given in
\verb+coord+ with a least-squares loss value of .4691 (in \verb+diff+).

\subsection{A Useful Utility for the QA Task Generally}



For the QA problem in (5), the attempt to find $\rho$ to maximize $\Gamma(\rho)$,
reorganizes the (proximity) matrix as $\mathbf{A}_{\rho} = \{a_{\rho(i) \rho(j)}\}$,
which hopefully shows the same pattern, more or less, as (the fixed target)
$\mathbf{B}$; equivalently, we maximize the usual Pearson product-moment correlation
between the off-diagonal entries in $\mathbf{B}$ and $\mathbf{A}_{\rho}$.  Another way
of rephrasing this search when $\mathbf{B}$ is given by the equally-spaced target
matrix,
 $\{|i- j|\}$, is to say that we seek a permutation $\rho$ that provides a structure ``close''
as possible to what is called an anti-Robinson (AR) form for $\mathbf{A}_{\rho}$,
i.e., the degree to which the entries in $\mathbf{A}_{\rho}$, moving away from the
main diagonal in either direction never decrease (and usually increase); this is
exactly the pattern exhibited by the equally-spaced target matrix, $\mathbf{B} =
\{|i-j|\}$.

\smallskip

The type of heuristic optimization strategy we  use for the QA task in \verb+order.m+,
implements simple object interchange/rearrangement operations. Based on given matrices
$\mathbf{A}$ and $\mathbf{B}$, and beginning with some permutation (possibly chosen at
random), local interchanges and rearrangements of a particular type are implemented
until no improvement in the index can be made.  By repeatedly initializing such a
process randomly, a distribution over a set of local optima can be achieved. Three
different classes of local operations are used in the M-file, \verb+order.m+: (i) the
pairwise interchanges of objects in the current permutation defining the row and
column order of the data matrix $\mathbf{A}$.  All possible such interchanges are
generated and considered in turn, and whenever an increase in the cross-product index
would result from a particular interchange, it is made immediately.  The process
continues until the current permutation cannot be improved upon by any such pairwise
object interchange.  The procedure then proceeds to (ii): the local operations
considered are all reinsertions of from 1 to \verb+kblock+ (which is less than $n$ and
set by the user) consecutive objects somewhere in the permutation defining the current
row and column order of the data matrix.  When no further improvement can be made, we
move to (iii): the local operations are now all possible rotations (or inversions) of
from 2 to \verb+kblock+ consecutive objects in the current row/column order of the
data matrix. (We suggest a use of \verb+kblock+ equal to  3 as a reasonable compromise
between the extensiveness of local search, speed of execution, and quality of
solution.)  The three collections of local changes are revisited (in order) until no
alteration is possible in the final permutation obtained.

\smallskip

The use of \verb+order.m+ is illustrated in the verbatim recording below on the
\verb+supreme_agree+ data. There are \verb+index+ permutations stored in the MATLAB
cell-array \verb+allperms+, from the first randomly generated one in
\verb+allperms{1}+, to the found local optimum in \verb+allperms{index}+.  (These have
been suppressed in the output.) Notice that retrieving entries in a cell-array
requires the use of curly braces, \verb+{,}+. The M-file, \verb+targlin.m+, provides
the equally-spaced target matrix as an input.  Starting with a random permutation and
the \verb+supreme_agree+ data matrix, the identity permutation is found (in fact, it
would be the sole local optimum identified upon repeated starts using random
permutations).

\small
\begin{verbatim}
>> load supreme_agree.dat

>> [outperm,rawindex,allperms,index] = order(supreme_agree,targlin(9),randperm(9),3);

outperm =

     1     2     3     4     5     6     7     8     9


rawindex =

  145.1200


index =

    19
\end{verbatim}



\large




\section{Confirmatory and Nonmetric LUS}

In developing linear unidimensional scaling (as well as other types of)
representations for a proximity matrix, it is convenient to have a general mechanism
available for solving linear (in)equality constrained least-squares tasks.  The two
such instances discussed in this section involve (a) the confirmatory fitting  of a
given object order to a proximity matrix (through an M-file called \verb+linfit.m+),
and (b) the construction of an optimal monotonic transformation of a proximity matrix
in relation to a given unidimensional ordering (through an M-file called
\verb+proxmon.m+). In both these cases, we rely on what can be called the
Dykstra-Kaczmarz method for solving linear inequality constrained least-squares
problems (the latter solution strategy is developed in greater detail in Section 9.9).

\subsection{The Confirmatory Fitting of a Given Order}

The  M-function, \verb+linfit.m+, fits a set of coordinates to a given proximity
matrix based on some given input permutation, say, $\rho^{(0)}$. Specifically, we seek
$x_{1} \le x_{2} \le \cdots \le x_{n}$ such that $\sum_{i < j} (p_{\rho^{0}(i)
\rho^{0}(j)} - |x_{j} - x_{i}|)^{2}$ is minimized (and where the permutation
$\rho^{(0)}$ may not even put the matrix $\{p_{\rho^{0}(i) \rho^{0}(j)}\}$ into a
monotonic form).  Using the syntax
\begin{verbatim}
[fit,diff,coord] = linfit(prox,inperm)
\end{verbatim}
the matrix $\{|x_{j} - x_{i}|\}$ is referred to as the fitted matrix (\verb+fit+);
\verb+coord+ gives the ordered coordinates; and \verb+diff+ is the value of the
least-squares criterion. The fitted matrix is found through the Dykstra-Kaczmarz
method
 where the equality constraints
defined by distances along a continuum are imposed to construct the fitted matrix,
i.e., if $i < j < k$, then $|x_{i} - x_{j}| + |x_{j} - x_{k}| = |x_{i} - x_{k}|$. Once
found, the actual ordered coordinates are retrieved by the usual $t_{i}^{(\rho^{0})}$
formula but computed on \verb+fit+. In the example below of the use of
\verb+linfit.m+,  the \mbox{identity} permutation obtained from the use of
\verb+uniscalqa.m+ is used as the input permutation.

\small
\begin{verbatim}
>> load supreme_agree.dat
>> [fit,diff,coord] = linfit(supreme_agree,[1 2 3 4 5 6 7 8 9])

fit =

         0    0.1789    0.2433    0.3144    0.6022    0.7011    0.7967    0.9878    1.0356
    0.1789         0    0.0644    0.1356    0.4233    0.5222    0.6178    0.8089    0.8567
    0.2433    0.0644         0    0.0711    0.3589    0.4578    0.5533    0.7444    0.7922
    0.3144    0.1356    0.0711         0    0.2878    0.3867    0.4822    0.6733    0.7211
    0.6022    0.4233    0.3589    0.2878         0    0.0989    0.1944    0.3856    0.4333
    0.7011    0.5222    0.4578    0.3867    0.0989         0    0.0956    0.2867    0.3344
    0.7967    0.6178    0.5533    0.4822    0.1944    0.0956         0    0.1911    0.2389
    0.9878    0.8089    0.7444    0.6733    0.3856    0.2867    0.1911         0    0.0478
    1.0356    0.8567    0.7922    0.7211    0.4333    0.3344    0.2389    0.0478         0


diff =

    0.4691


coord =

   -0.5400
   -0.3611
   -0.2967
   -0.2256
    0.0622
    0.1611
    0.2567
    0.4478
    0.4956
\end{verbatim}
\large

\subsection{The Monotonic Transformation of a Proximity Matrix}

The function, \verb+proxmon.m+, provides a mono\-ton\-ically
transformed proximity matrix that is closest in a least-squares
sense to a given input matrix. The syntax is
\begin{verbatim}
[monproxpermut,vaf,diff] = proxmon(proxpermut,fitted)
\end{verbatim}
Here, \verb+proxpermut+ is the input proximity matrix (which may have been subjected
to an initial row/column permutation, hence the suffix ``\verb+permut+'');
\verb+fitted+ is a given target matrix; the output matrix \verb+monproxpermut+ is
closest to \verb+fitted+ in a least-squares sense and obeys the order constraints
obtained from each pair of entries in (the upper-triangular portion of)
\verb+proxpermut+ (and where the inequality constrained optimization is carried out
using the Dykstra-Kaczmarz iterative projection strategy); \verb+vaf+ denotes
``var\-i\-ance-\-ac\-coun\-ted-\-for'' and indicates how much variance in
\verb+monproxpermut+ can be accounted for by \verb+fitted+; finally, \verb+diff+ is
the value of the least-squares loss function and is the sum of squared differences
between the entries in \verb+fitted+ and \verb+monproxpermut+ (actually, \verb+diff+
is one-half of such a sum because the loss function is over $i < j$).

\smallskip

 When fitting a given order, \verb+fitted+ would correspond to the matrix
$\{|x_{j} - x_{i}|\}$, where $x_{1} \le x_{2} \le \cdots \le x_{n}$; the input
\verb+proxpermut+ would be $\{p_{\rho^{0}(i) \rho^{0}(j)}\}$; \verb+monproxpermut+
would be $\{f(p_{\rho^{0}(i) \rho^{0}(j)})\}$, where the function $f(\cdot)$ satisfies
the monotonicity constraints, i.e., if $p_{\rho^{0}(i) \rho^{0}(j)} < p_{\rho^{0}(i')
\rho^{0}(j')}$ for $1 \le i  < j \le n$ and $1 \le i' < j' \le n$, then
$f(p_{\rho^{0}(i) \rho^{0}(j)}) \le f(p_{\rho^{0}(i') \rho^{0}(j')})$.  The
transformed proximity matrix $\{f(p_{\rho^{0}(i) \rho^{0}(j)})\}$ minimizes the
least-squares criterion (\verb+diff+) of
\[ \sum_{i < j} (f(p_{\rho^{0}(i) \rho^{0}(j)}) - |x_{j} - x_{i}|)^{2} , \]
over \emph{all} functions $f(\cdot)$ that satisfy the monotonicity constraints.  The
\verb+vaf+ is a normalization of this loss value by the sum of squared deviations of
the transformed proximities from their mean:
\[ \mbox{VAF} = 1 - \frac{\sum_{i < j} (f(p_{\rho^{0}(i) \rho^{0}(j)}) -
|x_{j} - x_{i}|)^{2}}{\sum_{i < j} (f(p_{\rho^{0}(i) \rho^{0}(j)}) - \bar{f})^{2}} , \]
where $\bar{f}$ denotes the mean of the off-diagonal entries in
$\{f(p_{\rho^{0}(i) \rho^{0}(j)})\}$.


\subsubsection{An Application Incorporating proxmon.m}

The script M-file listed below gives an application of \verb+proxmon.m+ using the
identity permutation for our \verb+supreme_agree+ matrix. First, \verb+linfit.m+ is
invoked to obtain a fitted matrix (\verb+fit+); \verb+proxmon.m+ then generates the
monotonically transformed proximity matrix (\verb+monprox+) with \verb+vaf+ = .9869
and \verb+diff+ = .0349.  The strategy is then repeated one-hundred times (i.e.,
finding a fitted matrix based on the monotonically transformed proximity matrix,
finding a new monotonically transformed matrix, and so on). To avoid degeneracy (where
all matrices would converge to zeros), the sum of squares of the fitted matrix is
normalized.  As indicated in the output below, the final \verb+vaf+ is .9934 with a
\verb+diff+ of .0190. (Although the permutation found earlier for \verb+supreme_agree+
remains the same throughout the construction of the optimal monotonic transformation,
in this particular example it would also remain optimal with the same VAF if the
unidimensional scaling were repeated with \verb+monprox+ now considered the input
proximity matrix.  Even though probably rare, other data sets might not have such an
invariance, and it may be desirable to initiate an iterative routine that finds
a unidimensional scaling [i.e., an object ordering] in addition to monotonically
transforming the proximity matrix.)

\small
\begin{verbatim}
>> type uniscale_monotone_test

load supreme_agree.dat
inperm = [1 2 3 4 5 6 7 8 9];
proxpermut = supreme_agree(inperm,inperm);
[fit,diff,coord] = linfit(proxpermut,1:9)
[monprox,vaf,diff] = proxmon(proxpermut,fit)
sumfitsq = sum(sum(fit.^2));

for i = 1:100

    [fit,diff,coord] = linfit(monprox,1:9);

    sumnewfitsq = sum(sum(fit.^2));

    fit = sqrt(sumfitsq)*(fit/sumnewfitsq);

    [monprox,vaf,diff] = proxmon(proxpermut,fit);

end

fit
coord
vaf
diff
monprox


disparities = squareform(monprox);

dissimilarities = squareform(proxpermut);

distances = squareform(fit);

[dum, ord] = sortrows([disparities(:) dissimilarities(:)]);

plot(dissimilarities, distances, 'bo', dissimilarities(ord),disparities(ord),'r.-')

xlabel('Dissimilarities')

ylabel('Distances/Disparities')

legend({'Distances' 'Disparities'},'Location','NorthWest');





>> uniscale_monotone_test

fit =

         0    0.1789    0.2433    0.3144    0.6022    0.7011    0.7967    0.9878    1.0356
    0.1789         0    0.0644    0.1356    0.4233    0.5222    0.6178    0.8089    0.8567
    0.2433    0.0644         0    0.0711    0.3589    0.4578    0.5533    0.7444    0.7922
    0.3144    0.1356    0.0711         0    0.2878    0.3867    0.4822    0.6733    0.7211
    0.6022    0.4233    0.3589    0.2878         0    0.0989    0.1944    0.3856    0.4333
    0.7011    0.5222    0.4578    0.3867    0.0989         0    0.0956    0.2867    0.3344
    0.7967    0.6178    0.5533    0.4822    0.1944    0.0956         0    0.1911    0.2389
    0.9878    0.8089    0.7444    0.6733    0.3856    0.2867    0.1911         0    0.0478
    1.0356    0.8567    0.7922    0.7211    0.4333    0.3344    0.2389    0.0478         0


diff =

    0.4691


coord =

   -0.5400
   -0.3611
   -0.2967
   -0.2256
    0.0622
    0.1611
    0.2567
    0.4478
    0.4956


monprox =

         0    0.2467    0.2433    0.2467    0.6517    0.6517    0.7967    1.0117    1.0117
    0.2467         0    0.0800    0.1356    0.4044    0.5022    0.6178    0.8089    0.8567
    0.2433    0.0800         0    0.0711    0.4092    0.4092    0.5533    0.7444    0.7922
    0.2467    0.1356    0.0711         0    0.3030    0.4092    0.5022    0.6733    0.7211
    0.6517    0.4044    0.4092    0.3030         0    0.1774    0.1774    0.4044    0.4092
    0.6517    0.5022    0.4092    0.4092    0.1774         0    0.0800    0.3030    0.3030
    0.7967    0.6178    0.5533    0.5022    0.1774    0.0800         0    0.1911    0.1774
    1.0117    0.8089    0.7444    0.6733    0.4044    0.3030    0.1911         0    0.0478
    1.0117    0.8567    0.7922    0.7211    0.4092    0.3030    0.1774    0.0478         0


vaf =

    0.9869


diff =

    0.0349


fit =

         0    0.2234    0.2463    0.2643    0.6338    0.7235    0.8021    1.0067    1.0067
    0.2234         0    0.0228    0.0409    0.4103    0.5001    0.5787    0.7832    0.7832
    0.2463    0.0228         0    0.0180    0.3875    0.4773    0.5559    0.7604    0.7604
    0.2643    0.0409    0.0180         0    0.3695    0.4592    0.5378    0.7424    0.7424
    0.6338    0.4103    0.3875    0.3695         0    0.0898    0.1684    0.3729    0.3729
    0.7235    0.5001    0.4773    0.4592    0.0898         0    0.0786    0.2831    0.2831
    0.8021    0.5787    0.5559    0.5378    0.1684    0.0786         0    0.2046    0.2046
    1.0067    0.7832    0.7604    0.7424    0.3729    0.2831    0.2046         0         0
    1.0067    0.7832    0.7604    0.7424    0.3729    0.2831    0.2046         0         0


coord =

   -0.1226
   -0.0724
   -0.0672
   -0.0632
    0.0199
    0.0401
    0.0578
    0.1038
    0.1038


vaf =

    0.9934


diff =

    0.0190


monprox =

         0    0.2447    0.2447    0.2447    0.6787    0.6787    0.7927    1.0067    1.0067
    0.2447         0    0.0474    0.0474    0.3854    0.5001    0.5787    0.7832    0.7927
    0.2447    0.0474         0    0.0180    0.4414    0.4414    0.5559    0.7604    0.7604
    0.2447    0.0474    0.0180         0    0.3695    0.4414    0.5378    0.7424    0.7424
    0.6787    0.3854    0.4414    0.3695         0    0.1542    0.1542    0.3854    0.3854
    0.6787    0.5001    0.4414    0.4414    0.1542         0    0.0474    0.2831    0.2831
    0.7927    0.5787    0.5559    0.5378    0.1542    0.0474         0    0.2046    0.1542
    1.0067    0.7832    0.7604    0.7424    0.3854    0.2831    0.2046         0         0
    1.0067    0.7927    0.7604    0.7424    0.3854    0.2831    0.1542         0         0
\end{verbatim}


\large

\begin{flushleft}
\begin{figure}[!h]

\hfil\scalebox{.75}{\includegraphics{monprox_and_fit_versus_supreme_agree.eps}}\hfil

\caption{Plot of the Monotonically Transformed Proximities (Disparities) and Fitted Values (Distances) (y-axis) Against the
Original Supreme Court Proximities (Dissimilarities) (x-axis).}

\end{figure}
\end{flushleft}




There are several items to point out about the example just given.  First, it was
actually run by invoking a script M-file, \verb+uniscale_monotone_test+, the contents
of which can be seen by issuing the simple command,

 \verb+type uniscale_monotone_test+

 \noindent The commands are performed by typing the script file name in
the command window.  We also note that a rather arbitrary number of iterations of the
fitting process were carried out (i.e., one-hundred).  An alternative strategy would
have been to exit upon a minimal change in, say, the VAF value.  Second, we show how
to plot the entries in the various matrices (\verb+monprox+, \verb+supreme_agree+, and
\verb+fit+) by first changing them to vector form through the MATLAB M-function,
\verb+squareform.m+. Figure 4 then shows the plot of both \verb+monprox+ (called ``disparities'') and \verb+fit+ (called ``distances'' against
\verb+supreme_agree+ (called ``dissimilarities'').  Such a (joint) plot is called a Shepard diagram in the literature of multidimensional scaling.


\subsection{Using the MATLAB Statistical Toolbox M-file for Metric and Nonmetric
(Multi)dimensional scaling}

There is an M-file, \verb+mdscale.m+, within the MATLAB Statistical Toolbox that
performs various types of metric and nonmetric multidimensional scaling analyses. When
the dimensionality is set at ``1'', and the loss criterion is set to
``\verb+metricstress+'', the LUS task in (1) is being solved but with a different type
of optimization strategy based on gradients. The criterion reported is \verb+stress+,
defined by the square-root of our \verb+diff+ divided by the sum-of-squares for the
original proximities. As can be seen from the MATLAB session below, the gradient-based
method has a very difficult time in finding the best solution defined by the identity
permutation, and only two out of one-hundred random starts produced it.  (We have
suppressed most of the output; the best solution out of the one-hundred is reported
automatically, and is identical [given the same coordinates] to that obtained with a
single random start of \verb+uniscalqa.m+).  It is true generally that gradient-based
methods have an extremely hard time avoiding purely local optima when used in one
dimension.  A reliance on \verb+uniscalqa.m+ is a much better option for approaching
the LUS task.

\small
\begin{verbatim}>> load supreme_agree.dat

>> opts = statset('Display','final','Maxiter',1000);

>> [coord,stress] = mdscale(supreme_agree,1,'Criterion','metricstress','Start','random','Replicates',100,'Options',opts)

6 iterations, Final stress criterion = 0.213021

4 iterations, Final stress criterion = 0.511745

4 iterations, Final stress criterion = 0.213232

4 iterations, Final stress criterion = 0.222266

5 iterations, Final stress criterion = 0.373536

2 iterations, Final stress criterion = 0.607790

2 iterations, Final stress criterion = 0.579076

2 iterations, Final stress criterion = 0.567206

3 iterations, Final stress criterion = 0.459125

2 iterations, Final stress criterion = 0.602695

*remaining starts deleted*


coord =

   -0.5400
   -0.3611
   -0.2967
   -0.2256
    0.0622
    0.1611
    0.2567
    0.4478
    0.4956


stress =

    0.2125
\end{verbatim}



\large

\subsection{A Convenient Utility for Plotting a LUS Representation}

To actually plot a LUS representation, we provide an M-file, \verb+linearplot.m+, with
usage syntax
\begin{verbatim}
[linearlength] = linearplot(coord,inperm)
\end{verbatim}
\noindent Here, \verb+linearlength+ is the total length of representation from the
smallest coordinate to the largest; \verb+coord+ is the ordered set of coordinates
that get labeled with the values in \verb+inperm+.  As can be seen from the output
below and Figure 3, the LUS representation separates the far left, \{Stevens:1\}, from
the moderate liberals, \{Breyer:2, Ginsberg:3, Souter:4\}; and the far right,
\{Scalia:8, Thomas:9\}, from the moderate right, \{O'Connor:5, Kennedy:6,
Rehnquist:7\}.

\normalsize
\begin{verbatim}
>> [fit,diff,coord] = linfit(supreme_agree,[1 2 3 4 5 6 7 8 9])

fit =

         0    0.1789    0.2433    0.3144    0.6022    0.7011    0.7967    0.9878    1.0356
    0.1789         0    0.0644    0.1356    0.4233    0.5222    0.6178    0.8089    0.8567
    0.2433    0.0644         0    0.0711    0.3589    0.4578    0.5533    0.7444    0.7922
    0.3144    0.1356    0.0711         0    0.2878    0.3867    0.4822    0.6733    0.7211
    0.6022    0.4233    0.3589    0.2878         0    0.0989    0.1944    0.3856    0.4333
    0.7011    0.5222    0.4578    0.3867    0.0989         0    0.0956    0.2867    0.3344
    0.7967    0.6178    0.5533    0.4822    0.1944    0.0956         0    0.1911    0.2389
    0.9878    0.8089    0.7444    0.6733    0.3856    0.2867    0.1911         0    0.0478
    1.0356    0.8567    0.7922    0.7211    0.4333    0.3344    0.2389    0.0478         0


diff =

    0.4691


coord =

   -0.5400
   -0.3611
   -0.2967
   -0.2256
    0.0622
    0.1611
    0.2567
    0.4478
    0.4956

>> [linearlength] = linearplot(coord,[1 2 3 4 5 6 7 8 9])

linearlength =

    1.0356
\end{verbatim}

\large

\begin{flushleft}
\begin{figure}[!h]

\hfil\scalebox{.75}{\includegraphics{sc_linear_plot.eps}}\hfil

\caption{The LUS Representation Using linearplot.m with the Coordinates Obtained from
linfit.m on the supreme\_agree Proximities.}

\end{figure}
\end{flushleft}





\section{Incorporating an Additive Constant in LUS}


A generalization to the basic LUS task that incorporates an additional additive
constant will prove extremely convenient when extensions to multiple unidimensional
scales are proposed. In this section we emphasize a single LUS structure through the
more general least-squares loss function of the form
\begin{equation}
 \sum_{i < j} (p_{ij} - \{|x_{j} - x_{i}| - c \})^{2} ,
\end{equation}
where $c$ is some constant to be estimated along with the coordinates $x_{1}, \ldots,
x_{n}$. Much later,  the restriction to fitting only a single unidimensional structure
to a symmetric proximity matrix is removed; the latter will rely heavily on a
computational approach that includes the augmentation by an estimated additive
constant and a procedure of successive residualization of the original proximity
matrix. For example, the fitting of two LUS structures to a proximity matrix
$\{p_{ij}\}$ could be rephrased as the minimization of a  loss function generalizing
(6) to the form
\begin{equation}
\sum_{i < j} (p_{ij} - [|x_{j1} - x_{i1}| - c_{1}] - [|x_{j2} - x_{i2}| - c_{2}])^{2}.
\end{equation}
The attempt to minimize (7) could proceed with the fitting of a single LUS structure
to $\{p_{ij}\}$, $[|x_{j1} - x_{i1}| - c_{1}]$, and once obtained, fitting a second
LUS structure, $[|x_{j2} - x_{i2}| - c_{2}]$, to the residual matrix, $\{p_{ij} -
[|x_{j1} - x_{i1}| - c_{1}]\}$.  The process would then cycle by repetitively fitting
the residuals from the second linear structure by the first, and the residuals from
the first linear structure by the second, until the sequence converges.  In any case,
obvious extensions would also exist for the inclusion of more than two LUS structures.


\smallskip

The explicit inclusion of two constants, $c_{1}$ and $c_{2}$, in (7) rather than
adding these two together and including a single additive constant, $c$, deserves some
additional introductory explanation.  As would be the case in fitting a single LUS
structure using the loss function in (6), two interpretations exist for the role of
the additive constant, $c$.  We could consider $\{|x_{j} -  x_{i}|\}$ to be fitted to
the translated proximities $\{p_{ij} + c \}$, or alternatively, $\{|x_{j} -  x_{i}| -
c \}$ to be fitted to the original proximities $\{p_{ij}\}$, where the constant $c$
becomes part of the actual model.  Although these two interpretations do not lead to
any algorithmic differences in how we would proceed with minimizing the loss function
in (6), a consistent use of the second interpretation suggests that we frame
extensions to the use of multiple LUS structures as we did in (7), where it is
explicit that the constants $c_{1}$ and $c_{2}$ are part of the actual models to be
fitted to the (untransformed) proximities $\{p_{ij}\}$.  Once $c_{1}$ and $c_{2}$ are
obtained, they could be summed as $c = c_{1} + c_{2}$, and an interpretation made that
we have attempted to fit a transformed set of proximities $\{p_{ij} + c \}$ by the sum
$\{|x_{j1} - x_{i1}| + |x_{j2} - x_{i2}|\}$ (and in this latter case, a more usual
terminology would be one of a two-dimensional scaling (MDS) based on the city-block
distance function).  However, such a further interpretation is unnecessary and could
lead to at least some small terminological confusion in further extensions that we
might wish to pursue.  For instance, if some type of (optimal nonlinear)
transformation, say $f(\cdot)$, of the proximities is also sought (e.g., a monotonic
function of some form as we did in Section 3.2), in addition to fitting multiple LUS
structures, and where $p_{ij}$ in (7) is replaced by $f(p_{ij})$, and $f(\cdot)$ is to
be constructed, the first interpretation would require the use of a `doubly
transformed' set of proximities $\{f(p_{ij}) + c \}$ to be fitted by the sum
$\{|x_{j1} - x_{i1}| + |x_{j2} - x_{i2}|\}$.  In general, it seems best to avoid the
need to incorporate the notion of a double transformation in this context, and instead
merely consider the constants $c_{1}$ and $c_{2}$ to be part of the models being
fitted to a transformed set of proximities $f(p_{ij})$.






\subsection{The Incorporation of an Additive Constant in LUS Through the M-file, linfitac.m}

We present and illustrate an M-function, \verb+linfitac.m+, that fits a given single
unidimensional scale (by providing the coordinates $x_{1}, \ldots, x_{n}$) and the
additive constant ($c$) for some fixed input object ordering along the continuum
defined by a permutation $\rho^{(0)}$.  This approach directly parallels the
M-function given earlier as \verb+linfit.m+, but now  with an included additive
constant estimation.
 The usage syntax of
\begin{verbatim}
[fit,vaf,coord,addcon] = linfitac(prox,inperm)
\end{verbatim}
is similar to that of \verb+linfit.m+  except for the inclusion (as output) of the
additive constant \verb+addcon+, and the replacement of the least-squares criterion of
\verb+diff+ by the variance-accounted-for (\verb+vaf+) given by the general formula
\[ \mbox{VAF} = 1 - \frac{\sum_{i < j} (p_{\rho^{(0)}(i) \rho^{(0)}(j)} + c -
|x_{j} - x_{i}|)^{2}}{\sum_{i < j} (p_{ij} - \bar{p})^{2}} ,\]
where $\bar{p}$ is the mean of the proximity values under consideration.


\smallskip

To illustrate the invariance of \verb+vaf+ to the use of linear transformations of the
proximity matrix (although \verb+coord+ and \verb+addcon+ obviously will change
depending on the transformation used), the identity permutation was fitted using two
different matrices: the original proximity matrix for \verb+supreme_agree+, and one
standardized to mean zero and variance one.  The latter matrix is obtained with the
utility \verb+proxstd.m+, with usage explained in its M-file header comments given in
the Appendix.
 Note that for the two
proximity matrices employed, the VAF values are exactly the same (.9796) but the
coordinates and additive constants differ; a listing of the standardized proximity
matrix is given in the output to show explicitly how negative proximities pose no
problem for the fitting process that allows the incorporation of additive constants
within the fitted model.

\normalsize
\begin{verbatim}
>> load supreme_agree.dat
>> inperm = [1 2 3 4 5 6 7 8 9];
>> [fit,vaf,coord,addcon] = linfitac(supreme_agree,inperm)

fit =

         0    0.1304    0.1464    0.1691    0.4085    0.4589    0.5060    0.6483    0.6483
    0.1304         0    0.0160    0.0387    0.2780    0.3285    0.3756    0.5179    0.5179
    0.1464    0.0160         0    0.0227    0.2620    0.3124    0.3596    0.5019    0.5019
    0.1691    0.0387    0.0227         0    0.2393    0.2898    0.3369    0.4792    0.4792
    0.4085    0.2780    0.2620    0.2393         0    0.0504    0.0976    0.2399    0.2399
    0.4589    0.3285    0.3124    0.2898    0.0504         0    0.0471    0.1894    0.1894
    0.5060    0.3756    0.3596    0.3369    0.0976    0.0471         0    0.1423    0.1423
    0.6483    0.5179    0.5019    0.4792    0.2399    0.1894    0.1423         0         0
    0.6483    0.5179    0.5019    0.4792    0.2399    0.1894    0.1423         0         0


vaf =

    0.9796


coord =

   -0.3462
   -0.2158
   -0.1998
   -0.1771
    0.0622
    0.1127
    0.1598
    0.3021
    0.3021


addcon =

   -0.2180

>> supreme_agree_stan = proxstd(supreme_agree,0.0)

supreme_agree_stan =

         0   -0.6726   -0.8887   -0.7266    0.8948    0.7326    1.3271    1.9216    1.8676
   -0.6726         0   -1.2130   -1.1590   -0.2942    0.1381    0.3543    1.3271    1.3812
   -0.8887   -1.2130         0   -1.5373    0.1381    0.0300    0.3543    1.1650    1.2731
   -0.7266   -1.1590   -1.5373         0   -0.2942   -0.0240    0.3003    1.0028    1.1109
    0.8948   -0.2942    0.1381   -0.2942         0   -0.9428   -1.1590   -0.2402   -0.2402
    0.7326    0.1381    0.0300   -0.0240   -0.9428         0   -1.4832   -0.4564   -0.5104
    1.3271    0.3543    0.3543    0.3003   -1.1590   -1.4832         0   -0.8887   -0.9968
    1.9216    1.3271    1.1650    1.0028   -0.2402   -0.4564   -0.8887         0   -1.5913
    1.8676    1.3812    1.2731    1.1109   -0.2402   -0.5104   -0.9968   -1.5913         0

>> [fit,vaf,coord,addcon] = linfitac(supreme_agree_stan,inperm)

fit =

         0    0.7050    0.7914    0.9139    2.2073    2.4799    2.7345    3.5037    3.5037
    0.7050         0    0.0864    0.2089    1.5024    1.7750    2.0295    2.7987    2.7987
    0.7914    0.0864         0    0.1225    1.4159    1.6885    1.9431    2.7123    2.7123
    0.9139    0.2089    0.1225         0    1.2935    1.5661    1.8206    2.5898    2.5898
    2.2073    1.5024    1.4159    1.2935         0    0.2726    0.5272    1.2964    1.2964
    2.4799    1.7750    1.6885    1.5661    0.2726         0    0.2546    1.0238    1.0238
    2.7345    2.0295    1.9431    1.8206    0.5272    0.2546         0    0.7692    0.7692
    3.5037    2.7987    2.7123    2.5898    1.2964    1.0238    0.7692         0         0
    3.5037    2.7987    2.7123    2.5898    1.2964    1.0238    0.7692         0         0


vaf =

    0.9796


coord =

   -1.8710
   -1.1661
   -1.0796
   -0.9572
    0.3363
    0.6089
    0.8635
    1.6327
    1.6327


addcon =

    1.5480
\end{verbatim}
\large

\smallskip

\subsection{Increasing the Computational Speed of the M-file, linfitac.m}

The iterative projection optimization process implemented in \verb+linfitac.m+, alternates between finding the additive constant and the coordinates.  As discussed in Section 8.7, it is also possible to fit the LUS model through partitions consistent with a given object order, and without alternating between the additive constant and coordinate estimation. This can dramatically increase the speed of \verb+linfitac.m+ if this alternative computational routine is used for the optimization engine (e.g., some 75 times as fast in a few test problems we have tried).  We have implemented this alternative in the M-file, \verb+linfitac_altcomp.m+, with exactly the same syntax as \verb+linfitac.m+ (note that for usage elsewhere and in comparison to \verb+linfitac.m+, the \verb+addcon+ in \verb+linfitac_altcomp.m+ is opposite in sign and is also included in \verb+fit+).  The reader is encouraged to use this alternative M-file whenever the problem size warrants and computational quickness is at a high premium.

\section{Circular Unidimensional Scaling (CUS)}



Circular unidimensional scaling (CUS) has the objective of placing $n$ objects around
a closed continuum such that the reconstructed distance between each pair of objects,
defined by the minimum length over the two possible paths that join the objects,
reflects the  given proximities as well as possible. Explicitly, and in analogy with
the loss function for linear unidimensional scaling (LUS), we wish to find a set of
coordinates, $x_{1}, \ldots , x_{n}$, plus an $(n+1)^{st}$ value (a circumference), $x_{0} \ge |x_{j} -
x_{i}|$  for all $1 \le i \ne   j \le n$, minimizing
\begin{equation}
       \sum_{i<j} (p_{ij} + c - \min\{|x_{j} - x_{i}| , x_{0} -  |x_{j} - x_{i}|\})^{2} ,
\end{equation}
or equivalently,
\begin{equation}
       \sum_{i<j} (p_{ij} - [\min\{|x_{j} - x_{i}|, x_{0} -  |x_{j} - x_{i}|\} - c])^{2} ,
\end{equation}
where $c$ is again some constant to be estimated. The value $x_{0}$ represents the
total length of the closed continuum, and the expression, $ \min\{|x_{j} - x_{i}|,
x_{0} -  |x_{j} -  x_{i}|\}$, gives the minimum length over the two possible paths
joining objects $O_{i}$ and $O_{j}$.

\smallskip

Because the \verb+supreme_agree+ proximity matrix is so well-represented by LUS, we
use a different data set here for illustration of CUS, given in the form of a rather
well-known proximity matrix in Table 2 (and called `\verb+morse_digits+'). The later
is a $10 \times 10$ proximity matrix for the ten Morse Code symbols that represent the
first ten digits: (0: $-$ $-$ $-$ $-$ $-$; 1: $\bullet$ $-$ $-$ $-$ $-$; 2: $\bullet$
$\bullet$ $-$ $-$ $-$; 3: $\bullet$ $\bullet$ $\bullet$ $-$ $-$; 4: $\bullet$
$\bullet$ $\bullet$ $\bullet$ $-$; 5: $\bullet$ $\bullet$ $\bullet$ $\bullet$
$\bullet$    ; 6: $-$ $\bullet$ $\bullet$ $\bullet$ $\bullet$   ; 7: $-$ $-$ $\bullet$
$\bullet$ $\bullet$ ; 8: $-$ $-$ $-$ $\bullet$ $\bullet$  ; 9: $-$ $-$ $-$ $-$
$\bullet$). (Note that the labeling of objects in the output is from 1 to 10; thus, a
translation back to the actual numbers corresponding to the Morse Code symbols
requires a subtraction of one.)  The entries in Table 2 have a dissimilarity
interpretation and are defined for each object pair by 2.0 minus the sum of the two
proportions for a group of subjects used by Rothkopf in the 1950's, representing
`same' judgments to the two symbols when given in the two possible presentation
orders of the signals. Based on previous multidimensional scalings of the complete
data set involving all of the Morse code symbols and in which the data of Table 2 are
embedded, it might be expected that the symbols for the digits would form a clear
linear unidimensional structure that would be interpretable according to a regular
progression in the number of dots to dashes. It turns out, as discussed in greater
detail below, that a circular model  is probably more consistent with the patterning
of the proximities in Table 2 than are representations based on linear unidimensional
scalings.

\normalsize
\begin{table}
\caption{A Proximity Matrix, morse\_digits, for the Ten Morse Code Symbols
Representing the First Ten Digits.}

\begin{center}

\begin{verbatim}
     0.00  .75 1.69 1.87 1.76 1.77 1.59 1.26  .86  .95
      .75 0.00  .82 1.54 1.85 1.72 1.51 1.50 1.45 1.63
     1.69  .82 0.00 1.25 1.47 1.33 1.66 1.57 1.83 1.81
     1.87 1.54 1.25 0.00  .89 1.32 1.53 1.74 1.85 1.86
     1.76 1.85 1.47  .89 0.00 1.41 1.64 1.81 1.90 1.90
     1.77 1.72 1.33 1.32 1.41 0.00  .70 1.56 1.84 1.64
     1.59 1.51 1.66 1.53 1.64  .70 0.00  .70 1.38 1.70
     1.26 1.50 1.57 1.74 1.81 1.56  .70 0.00  .83 1.22
      .86 1.45 1.83 1.85 1.90 1.84 1.38  .83 0.00  .41
      .95 1.63 1.81 1.86 1.90 1.64 1.70 1.22  .41 0.00
\end{verbatim}

\end{center}

\end{table}

\large


\subsection{The Circular Unidimensional Scaling Utilities}

The two circular unidimensional scaling utilities that implement the mechanics of
fitting the CUS model, parallel the LUS utilities of \verb+linfit.m+ and
\verb+linfitac.m+. The M-files, \verb+cirfit.m+ and \verb+cirfitac.m+, carry out
confirmatory fittings of a given order (assumed to be an object ordering around a
closed unidimensional structure), and have syntax:
\begin{verbatim}
[fit, diff] = cirfit(prox,inperm)
\end{verbatim}
\begin{verbatim}
[fit,vaf,addcon] = cirfitac(prox,inperm)
\end{verbatim}
\noindent where \verb+inperm+ is the given order; \verb+fit+ is an $n \times n$ matrix
fitted to the matrix \verb+prox(inperm,inperm)+ with a least-squares value
\verb+diff+. The syntax for the routine, \verb+cirfitac.m+, is the same except for the
inclusion of an additive constant, \verb+addcon+, and the use of \verb+vaf+  rather
than \verb+diff+.


\smallskip


In brief, then, the type of matrix being fitted to the proximity matrix has the form
\[ \{ \min(\mid x_{\rho(j)} - x_{\rho(i)} \mid
, \  x_{0} \ - \mid x_{\rho(j)} - x_{\rho(i)} \mid ) \ - c\} ,\] where $c$ is an
estimated additive constant (assumed equal to zero in \verb+cirfit.m+), $x_{\rho(1)}
\leq x_{\rho(2)} \leq \cdots \leq x_{\rho(n)} \leq x_{0}$, and the last coordinate,
$x_{0}$, is the circumference of the circular structure.  We can obtain these latter
coordinates from the adjacent spacings in the output matrix \verb+fit+.
As an example, we applied \verb+cirfit.m+ to the \verb+morse_digits+ proximity matrix
with an assumed identity input permutation; the spacings around the circular structure
between the placements for objects 1 and 2 is .5337; 2 and 3: .7534; 3 and 4: .6174; 4
and 5: .1840; 5 and 6: .5747; 6 and 7: .5167; 7 and 8: .3920; 8 and 9: .5467; 9 and
10: .1090; and back around between 10 and 1: .5594 (the sum of all these adjacent
spacings is 4.787 and is the circumference ($x_{0}$) of the circular structure).  For
\verb+cirfitac.m+, the additive constant was estimated as -.8031 with a \verb+vaf+ of
.7051; here, the spacings around the circular structure between the placements for
objects 1 and 2 is .2928; 2 and 3: .4322; 3 and 4: .2962; 4 and 5: .0234; 5 and 6:
.3338; 6 and 7: .2758; 7 and 8: .2314; 8 and 9: .2800; 9 and 10: .0000; and back
around between 10 and 1: .2124 (here, $x_{0}$ has a value of 2.378).

\normalsize

\begin{verbatim}
>> load morse_digits.dat
>> morse_digits

morse_digits =

         0    0.7500    1.6900    1.8700    1.7600    1.7700    1.5900    1.2600    0.8600    0.9500
    0.7500         0    0.8200    1.5400    1.8500    1.7200    1.5100    1.5000    1.4500    1.6300
    1.6900    0.8200         0    1.2500    1.4700    1.3300    1.6600    1.5700    1.8300    1.8100
    1.8700    1.5400    1.2500         0    0.8900    1.3200    1.5300    1.7400    1.8500    1.8600
    1.7600    1.8500    1.4700    0.8900         0    1.4100    1.6400    1.8100    1.9000    1.9000
    1.7700    1.7200    1.3300    1.3200    1.4100         0    0.7000    1.5600    1.8400    1.6400
    1.5900    1.5100    1.6600    1.5300    1.6400    0.7000         0    0.7000    1.3800    1.7000
    1.2600    1.5000    1.5700    1.7400    1.8100    1.5600    0.7000         0    0.8300    1.2200
    0.8600    1.4500    1.8300    1.8500    1.9000    1.8400    1.3800    0.8300         0    0.4100
    0.9500    1.6300    1.8100    1.8600    1.9000    1.6400    1.7000    1.2200    0.4100         0

>> [fit,diff] = cirfit(morse_digits,1:10)

fit =

         0    0.5337    1.2871    1.9044    2.0884    2.1237    1.6071    1.2151    0.6684    0.5594
    0.5337         0    0.7534    1.3707    1.5547    2.1294    2.1407    1.7487    1.2021    1.0931
    1.2871    0.7534         0    0.6174    0.8014    1.3761    1.8927    2.2847    1.9554    1.8464
    1.9044    1.3707    0.6174         0    0.1840    0.7587    1.2754    1.6674    2.2141    2.3231
    2.0884    1.5547    0.8014    0.1840         0    0.5747    1.0914    1.4834    2.0301    2.1391
    2.1237    2.1294    1.3761    0.7587    0.5747         0    0.5167    0.9087    1.4554    1.5644
    1.6071    2.1407    1.8927    1.2754    1.0914    0.5167         0    0.3920    0.9387    1.0477
    1.2151    1.7487    2.2847    1.6674    1.4834    0.9087    0.3920         0    0.5467    0.6557
    0.6684    1.2021    1.9554    2.2141    2.0301    1.4554    0.9387    0.5467         0    0.1090
    0.5594    1.0931    1.8464    2.3231    2.1391    1.5644    1.0477    0.6557    0.1090         0


diff =

    7.3898

>> [fit,vaf,addcon] = cirfitac(morse_digits,1:10)

fit =

         0    0.2928    0.7250    1.0212    1.0446    0.9996    0.7238    0.4924    0.2124    0.2124
    0.2928         0    0.4322    0.7284    0.7518    1.0856    1.0166    0.7852    0.5052    0.5052
    0.7250    0.4322         0    0.2962    0.3196    0.6534    0.9292    1.1606    0.9374    0.9374
    1.0212    0.7284    0.2962         0    0.0234    0.3572    0.6330    0.8644    1.1444    1.1444
    1.0446    0.7518    0.3196    0.0234         0    0.3338    0.6096    0.8410    1.1210    1.1210
    0.9996    1.0856    0.6534    0.3572    0.3338         0    0.2758    0.5072    0.7872    0.7872
    0.7238    1.0166    0.9292    0.6330    0.6096    0.2758         0    0.2314    0.5114    0.5114
    0.4924    0.7852    1.1606    0.8644    0.8410    0.5072    0.2314         0    0.2800    0.2800
    0.2124    0.5052    0.9374    1.1444    1.1210    0.7872    0.5114    0.2800         0    0.0000
    0.2124    0.5052    0.9374    1.1444    1.1210    0.7872    0.5114    0.2800    0.0000         0


vaf =

    0.7051


addcon =

   -0.8031
\end{verbatim}
\large


\subsubsection{The  M-function, unicirac.m}

The  function M-file, \verb+unicirac.m+,  carries out a circular unidimensional
scaling of a symmetric dissimilarity matrix (with the estimation of an additive
constant) using an iterative quadratic assignment strategy (and thus, can be viewed an
analogue of \verb+uniscalqa.m+ for the LUS task). We begin with an equally-spaced
circular target constructed using the M-file, \verb+targcir.m+ (that could be invoked
with the command \verb+targcir(10)+), a (random) starting permutation, and then use a
sequential combination of the pairwise interchange/rotation/insertion heuristics; the
target matrix is re-estimated based on the identified (locally optimal) permutation.
The whole process is repeated until no changes can be made in the target or the
identified (locally optimal) permutation. The explicit usage syntax is
\begin{verbatim}
 [find,vaf,outperm,addcon] = unicirac(prox,inperm,kblock)
\end{verbatim}
where the various terms should now be familiar. The given starting permutation,
\verb+inperm+, is of the first $n$ integers (assumed to be around the circle);
\verb+find+ is the least-squares optimal matrix (with variance-accounted-for of
\verb+vaf+) to \verb+prox+ having the appropriate circular form for the row and column
object ordering given by the final permutation, \verb+outperm+.  The spacings between
the objects are given by the entries immediately above the main diagonal in
\verb+find+ (and  the extreme $(1,n)$ entry in \verb+find+).  The block size in the
use the iterative quadratic assignment routine is \verb+kblock+; the additive constant
for the model is given by \verb+addcon+.


\smallskip


The problem of local optima is much more severe in CUS than in LUS.  Given the
heuristic identification of inflection points (i.e., the clock- or counterclockwise
change of direction  for  the calculation of distances between object pairs),  the
relevant spacings can vary somewhat depending on the `equivalent' orderings identified
around a circular structure.  The example given below was identified as the best
achievable (and for some multiple number of times) over 100 random starting
permutations for \verb+inperm+;  with its \verb+vaf+ of 71.90\%, it is apparently the
best attainable.  Given the (equivalent to the) identity permutation identified for
\verb+outperm+, the substantive interpretation for this representation is fairly clear
--- we have a nicely interpretable ordering of the Morse code symbols around a
circular structure involving a regular replacement of dashes by dots moving clockwise
until the symbol containing all dots is reached, and then a subsequent replacement of
the dots by dashes until the initial symbol containing all dashes is reached.

\normalsize
\begin{verbatim}
>> [find,vaf,outperm,addcon] = unicirac(morse_digits,randperm(10),2)

find =

         0    0.0247    0.3620    0.6413    0.9605    1.1581    1.1581    1.0358    0.7396    0.3883
    0.0247         0    0.3373    0.6165    0.9358    1.1334    1.1334    1.0606    0.7643    0.4131
    0.3620    0.3373         0    0.2793    0.5985    0.7961    0.7961    1.0148    1.1016    0.7503
    0.6413    0.6165    0.2793         0    0.3193    0.5169    0.5169    0.7355    1.0318    1.0296
    0.9605    0.9358    0.5985    0.3193         0    0.1976    0.1976    0.4163    0.7125    1.0638
    1.1581    1.1334    0.7961    0.5169    0.1976         0    0.0000    0.2187    0.5149    0.8662
    1.1581    1.1334    0.7961    0.5169    0.1976    0.0000         0    0.2187    0.5149    0.8662
    1.0358    1.0606    1.0148    0.7355    0.4163    0.2187    0.2187         0    0.2963    0.6475
    0.7396    0.7643    1.1016    1.0318    0.7125    0.5149    0.5149    0.2963         0    0.3513
    0.3883    0.4131    0.7503    1.0296    1.0638    0.8662    0.8662    0.6475    0.3513         0


vaf =

    0.7190

outperm =

     4     5     6     7     8     9    10     1     2     3


addcon =

   -0.7964
\end{verbatim}

\large

\subsubsection*{The plotting function circularplot.m}


To assist in the visualization of the results from a circular unidimensional scaling,
the M-function called \verb+circularplot.m+, provides the coordinates of a scaling
around a circular structure plus a plot of the (labeled) objects around the circle.
The usage syntax is
\begin{verbatim}
[circum,radius,coord,degrees,cumdegrees] = ...
  circularplot(circ,inperm)
\end{verbatim}
\noindent The coordinates are derived from the $n \times n$ interpoint distance matrix
(around a circle) given by \verb+circ+; the positions are labeled by the order of
objects given in \verb+inperm+. The output consists of a plot, the circumference of
the circle (\verb+circum+) and radius (\verb+radius+); the coordinates of the plot
positions (\verb+coord+), and the degrees and cumulative degrees induced between the
plotted positions (in \verb+degrees+ and \verb+cumdegrees+).  The positions around the
circle are numbered from 1 (at the `noon' position) to $n$, moving clockwise around
the circular structure.

As an example, Figure 4 provides an application of \verb+circularplot.m+ to the just
given example of \verb+unicirac.m+.  The text output also appears below:

\normalsize
\begin{verbatim}>> [circum,radius,coord,degrees,cumdegrees] = circularplot(find,outperm)

circum =

    2.4126


radius =

    0.3840


coord =

         0    0.3840
    0.0247    0.3832
    0.3107    0.2256
    0.3821   -0.0380
    0.2293   -0.3080
    0.0481   -0.3810
    0.0481   -0.3810
   -0.1649   -0.3468
   -0.3600   -0.1336
   -0.3254    0.2038


degrees =

    0.0644
    0.8783
    0.7273
    0.8315
    0.5146
    0.0000
    0.5695
    0.7716
    0.9148
    1.0113


cumdegrees =

    0.0644
    0.9428
    1.6700
    2.5015
    3.0161
    3.0161
    3.5856
    4.3571
    5.2719
    6.2832
\end{verbatim}



\begin{figure}

\centerline{\includegraphics{morseplot.eps}}

\caption{Two-dimensional Circular Plot for the morse\_digits Data Obtained Using
circularplot.m.}

\end{figure}

\large



\subsection{Increasing the Computational Speed for CUS}

For larger proximity matrices, the M-file, \verb+unicirac.m+, can be painfully slow.  Unfortunately, the same type of trick implemented for LUS within the M-file \verb+linfitac_altcomp.m+, cannot be used for CUS.  As an alternative strategy for improving on \verb+unicirac.m+ we used the converter, \verb+matlab2fmex.m+, developed by Ben Barrowes.  In effect, a routine is created that is callable from MATLAB and based on a Fortran implementation (and complilation) of the M-file of interest.  These routines under Windows used to be called \verb+*.dll+ (for dynamic link library).  In MATLAB under Windows, they now have the extension \verb+mexw32+.  The \verb+mexw32+ files of interest here (all compiled with Intel Fortran 9.1), are identified with the prefix `\verb+ms_+'.  Thus, we have \verb+ms_unicirac.mexw32+, which should run much faster than \verb+unicirac.m+.  The same general syntax is used:
\begin{verbatim}
[find,vaf,outperm,addcon] = ms_unicirac(prox,inperm,kblock)
\end{verbatim}
Similarly, the component \verb+mexw32+ files are also available:

 \verb+ms_cirfitac.mexw32+; \verb+ms_cirfit.mexw32+; \verb+ms_order.mexw32+.

\section{LUS for Two-Mode (Rectangular) Proximity Data}

The proximity data considered thus far for obtaining some type of structure, such as a
LUS or CUS, have been assumed to be on one intact set of objects, $S = \{O_{1},
\ldots, O_{n}\}$, and complete in the sense that proximity values are present between
all object pairs. Suppose now that the available proximity data are two-mode, and
between two distinct object sets, $S_{A} = \{O_{1A}, \ldots, O_{n_{a}A}\}$ and $S_{B}
= \{O_{1B}, \ldots, O_{n_{b}B}\}$, containing $n_{a}$ and $n_{b}$ objects,
respectively, given by an $n_{a} \times n_{b}$ proximity matrix $\mathbf{Q} =
\{q_{rs}\}$. Again, we assume that the entries in $\mathbf{Q}$ are keyed as
dissimilarities, and a joint structural representation is desired for the combined set
$S_{A} \cup S_{B}$.  We might caution at the outset of the need to have legitimate
proximities to make the analyses to follow very worthwhile or interpretable.  There
are many numerical elicitation schemes where subjects (e.g., raters) are asked to
respond to some set of objects (e.g., items).  If the elicitation is for, say,
preference, then proximity may be a good interpretation for the numerical values.  If,
on the other hand, the numerical value is merely a rating given on some more-or-less
objective criterion where only errors of observation induce the variability from rater
to rater, then probably not.

\smallskip

To have an example of a two-mode data set that might be used in our illustrations, we
extracted a $5 \times 4$ section from our \verb+supreme_agree+ proximity matrix.  The
five rows correspond to the judges, \{St,Gi,Oc,Re,Th\}; the four columns to
\{Br,So,Ke,Sc\}; the corresponding file, \verb+supreme_agree5x4.dat+,  has contents:

\normalsize
\begin{verbatim}
    0.3000    0.3700    0.6400    0.8600
    0.2800    0.2200    0.5100    0.7200
    0.4500    0.4500    0.3300    0.4600
    0.5700    0.5600    0.2300    0.3400
    0.7600    0.7100    0.4100    0.2100
\end{verbatim}


\large

\noindent Because of the way  the joint set of row and columns objects is numbered,
the five rows are labeled from 1 to 5 and the four columns from  6 to 9.  Thus, the
correspondence between the justices and numbers differs from earlier applications:
1:St; 2:Gi; 3:Oc; 4:Re; 5:Th; 6:Br; 7:So; 8:Ke; 9:Sc





\subsection{Reordering Two-Mode Proximity Matrices}

Given an $n_{a} \times n_{b}$ two-mode proximity matrix, $\mathbf{Q}$, defined between
the two distinct sets, $S_{A}$ and $S_{B}$, it may be desirable to reorder separately
the rows and columns of $\mathbf{Q}$ to display some type of pattern that may be
present in its entries, or to obtain some joint permutation of the $n \ ( = n_{a} +
n_{b} )$ row and column objects to effect some further type of simplified
representation.  These kinds of reordering tasks will be approached with a variant of
the quadratic assignment heuristics of the earlier LUS discussion applied to a square,
$(n_{a} + n_{b}) \times (n_{a} + n_{b})$, proximity matrix, $\mathbf{P}^{(tm)}$, in
which a two-mode matrix, $\mathbf{Q}_{(dev)}$ and its transpose (where
$\mathbf{Q}_{(dev)}$ is constructed from $\mathbf{Q}$ by deviating its entries from
the mean proximity), form the upper-right- and lower-left-hand portions, respectively,
with zeros placed elsewhere.  (This use of zero in the presence of deviated
proximities, appears a reasonable choice generally in identifying good reorderings of
$\mathbf{P}^{(tm)}$.  Without this type of deviation strategy, there would typically
be no `mixing' of the row and column objects in the permutations that we would
identify for the combined [row and column] object set.)  Thus, for $\mathbf{0}$
denoting (an appropriately dimensioned) matrix of all zeros,
\[ \mathbf{P}^{(tm)} = \left[ \begin{array}{cc}
\mathbf{0}_{n_{a} \times n_{a}} & \mathbf{Q}_{(dev) n_{a} \times n_{b}} \\
 \mathbf{Q}'_{(dev) n_{b} \times n_{a}} &    \mathbf{0}_{n_{b} \times n_{b}} \end{array}
\right] , \] is the (square) $n \times n$ proximity matrix subjected to a simultaneous
row and column reordering, which in turn will induce separate row and column
reorderings for the original two-mode proximity matrix $\mathbf{Q}$.


\smallskip

The M-file, \verb+ordertm.m+, implements a quadratic assignment reordering heuristic
on the derived matrix $\mathbf{P}^{(tm)}$, with usage
\begin{verbatim}
[outperm,rawindex,allperms,index,squareprox] = ...
 ordertm(proxtm,targ,inperm,kblock)
\end{verbatim}
\noindent where the two-mode proximity matrix \verb+proxtm+ (with its entries deviated
from the mean proximity within the use of the M-file) forms the upper-right- and
lower-left-hand portions of a defined square ($n \times n$) proximity matrix
(\verb+squareprox+) with a dissimilarity interpretation, and with zeros placed
elsewhere ($n$ = number of rows +  number of columns of \verb+proxtm+ = $n_{a} +
n_{b}$); three separate local operations are used to permute the rows and columns of
the square proximity matrix to maximize the cross-product index with respect to a
square target matrix \verb+targ+: (a) pairwise interchanges of objects in the
permutation defining the row and column order of the square proximity matrix; (b) the
insertion of from 1 to \verb+kblock+ (which is less than or equal to $n-1$)
consecutive objects in the permutation defining the row and column order of the data
matrix; (c) the rotation of from 2 to \verb+kblock+ (which is less than or equal to
$n-1$) consecutive objects in the permutation defining the row and column order of the
data matrix. The beginning input permutation (a permutation of the first $n$ integers)
is \verb+inperm+; \verb+proxtm+ is the two-mode $n_{a} \times n_{b}$ input proximity
matrix; \verb+targ+ is the $n \times n$ input target matrix. The final permutation of
\verb+squareprox+ is \verb+outperm+, having the cross-product index \verb+rawindex+
with respect to \verb+targ+; \verb+allperms+ is a cell array containing \verb+index+
entries corresponding to all the permutations identified in the optimization from
\verb+allperms{1} = inperm+ to \verb+allperms{index} = outperm+.

\smallskip

In the example to follow, \verb+ordertm.m+, is used on the \verb+supreme_agree5x4+
dissimilarity matrix.  The square equally-spaced target matrix is obtained from the
LUS utility, \verb+targlin.m+.  The (reordered) matrix, \verb+squareprox+ (using the
permutation, \verb+outperm+), shows clearly the unidimensional pattern for a two-mode
data matrix that will be explicitly fitted in the next section of this chapter.  The
order of the justices is as expected in the new coding scheme, except for the minor
inversion of Th:5 and Sc:9
---  St:1 $\succ$  Br:6 $\succ$  Gi:2 $\succ$  So:7 $\succ$  Oc:3 $\succ$  Ke:8
$\succ$ Re:4 $\succ$  Th:5  $\succ$ Sc:9

\normalsize
\begin{verbatim}
>> load supreme_agree5x4.dat
>> supreme_agree5x4

supreme_agree5x4 =

    0.3000    0.3700    0.6400    0.8600
    0.2800    0.2200    0.5100    0.7200
    0.4500    0.4500    0.3300    0.4600
    0.5700    0.5600    0.2300    0.3400
    0.7600    0.7100    0.4100    0.2100

>> [outperm,rawindex,allperms,index,squareprox] = ordertm(supreme_agree5x4,targlin(9),randperm(9),3)

outperm =

     1     6     2     7     3     8     4     5     9


rawindex =

   14.1420



index =

    17

>> squareprox(outperm,outperm)

ans =

         0   -0.1690         0   -0.0990         0    0.1710         0         0    0.3910
   -0.1690         0   -0.1890         0   -0.0190         0    0.1010    0.2910         0
         0   -0.1890         0   -0.2490         0    0.0410         0         0    0.2510
   -0.0990         0   -0.2490         0   -0.0190         0    0.0910    0.2410         0
         0   -0.0190         0   -0.0190         0   -0.1390         0         0   -0.0090
    0.1710         0    0.0410         0   -0.1390         0   -0.2390   -0.0590         0
         0    0.1010         0    0.0910         0   -0.2390         0         0   -0.1290
         0    0.2910         0    0.2410         0   -0.0590         0         0   -0.2590
    0.3910         0    0.2510         0   -0.0090         0   -0.1290   -0.2590         0
\end{verbatim}


\large

\subsection{Fitting a Two-Mode Unidimensional Scale}

 It is possible to fit unidimensional scales to two-mode proximity data based on a given permutation of the
combined row and column object set. Specifically, if $\rho(\cdot)$ denotes some given
permutation of the first $n$ integers (where the first $n_{a}$ integers denote row
objects labeled $1,2, \ldots, n_{a}$, and the remaining $n_{b}$ integers denote column
objects, labeled $n_{a} + 1, n_{a} + 2, \ldots, n_{a} + n_{b} \  (= n))$, we seek a
set of coordinates, $x_{1} \leq x_{2} \leq \cdots \leq x_{n}$, such that using the
reordered square proximity matrix, $\mathbf{P}^{(tm)}_{\rho_{0}} =
\{p^{(tm)}_{\rho_{0}(i) \rho_{0}(j)}\}$, the least-squares criterion
\[ \sum_{i,j = 1}^{n} w_{\rho_{0}(i) \rho_{0}(j)}(p^{(tm)}_{\rho_{0}(i) \rho_{0}(j)} - |x_{j} - x_{i}|)^{2} , \]
is minimized, where  $w_{\rho_{0}(i) \rho_{0}(j)} = 0$ if $\rho_{0}(i)$ and
$\rho_{0}(j)$ are both row or both column objects, and $= 1$ otherwise.  The entries
in the matrix fitted to $\mathbf{P}^{(tm)}_{\rho_{0}}$ are based on the absolute
coordinate differences (and which correspond to nonzero values of the weight function
$w_{\rho_{0}(i) \rho_{0}(j)}$), and thus satisfy certain linear inequality constraints
generated from how the row and column objects are intermixed by the given permutation
$\rho_{0}(\cdot)$.  To give a schematic  representation of how these constraints are
generated, suppose $r_{1}$ and $r_{2}$ ($c_{1}$ and $c_{2}$) denote two arbitrary row
(column) objects, and suppose the following $2 \times 2$ matrix represents what is to
be fitted to the four proximity values present between $r_{1}, r_{2}$ and $c_{1},
c_{2}$:

\bigskip

\begin{tabular}{l|l|l|}

  & $c_{1}$ & $c_{2}$ \\ \hline
$r_{1}$ & $a$ & $b$ \\  \hline $r_{2}$ & $c$ & $d$ \\   \hline

\end{tabular}

\bigskip

\noindent Depending on how these four objects are ordered (and intermixed) by the
permutation $\rho_{0}(\cdot)$, certain constraints must be satisfied by the entries
$a, b, c$, and $d$.  The representative constraints are given schematically below
according to the types of intermixing that might be present:

\smallskip

(a) $r_{1} \prec r_{2} \prec c_{1} \prec c_{2}$ implies $ a + d = b + c$;

(b) $r_{1} \prec c_{1} \prec r_{2} \prec c_{2}$ implies $ a + c + d = b$;

(c) $r_{1} \prec c_{1} \prec c_{2} \prec r_{2}$ implies $ a + c = b + d$;

(d) $r_{1} \prec r_{2} \prec c_{1}$ implies $ c \leq a$;

(e) $r_{1} \prec c_{1} \prec c_{2}$ implies $ a \leq b$.

\smallskip

The confirmatory unidimensional scaling of a two-mode proximity matrix (based on
iterative projection using a given permutation of the row and column objects) is
carried out with the M-file, \verb+linfittm+, with usage
\begin{verbatim}
[fit,diff,rowperm,colperm,coord] = linfittm(proxtm,inperm)
\end{verbatim}
\noindent Here, \verb+proxtm+ is the two-mode proximity matrix, and \verb+inperm+ is
the given ordering of the row and column objects pooled together; \verb+fit+ is an
$n_{a} \times n_{b}$ matrix of absolute coordinate differences fitted to
\verb+proxtm(rowperm,colperm)+, with \verb+diff+ being the (least-squares criterion)
sum of squared discrepancies between \verb+fit+    and \verb+proxtm(rowperm,colperm)+;
\verb+rowperm+ and \verb+colperm+ are the row and column object orderings derived from
\verb+inperm+. The $(n_{a} + n_{b}) = n$ coordinates (ordered with the smallest such
coordinate value set at zero) are given in \verb+coord+.  The example given below uses
the permutation obtained from \verb+ordertm.m+ on the data matrix
\verb+supreme_agree5x4+.

\normalsize

\begin{verbatim}
>> inperm = [1 6 2 7 3 8 4 5 9]

inperm =

     1     6     2     7     3     8     4     5     9

>> [fit,diff,rowperm,colperm,coord] = linfittm(supreme_agree5x4,inperm)

fit =

    0.1635    0.2895    0.6835    1.0335
    0.0865    0.0395    0.4335    0.7835
    0.4065    0.2805    0.1135    0.4635
    0.6340    0.5080    0.1140    0.2360
    0.7965    0.6705    0.2765    0.0735


diff =

    0.2849


rowperm =

     1
     2
     3
     4
     5


colperm =

     1
     2
     3
     4


coord =

         0
    0.1635
    0.2500
    0.2895
    0.5700
    0.6835
    0.7975
    0.9600
    1.0335
\end{verbatim}


\large

 In complete analogy
with the LUS discussion (where the M-file, \verb+linfitac.m+, generalizes
\verb+linfit.m+ by fitting an additive constant along with the absolute coordinate
differences), the more general unidimensional scaling model can be fitted with an
additive constant using the M-file, \verb+linfittmac.m+.  Specifically, we now seek a
set of coordinates, $x_{1} \leq x_{2} \leq \cdots \leq x_{n}$, and an additive
constant, $c$, such that using the reordered square proximity matrix,
$\mathbf{P}^{(tm)}_{\rho_{0}} = \{p^{(tm)}_{\rho_{0}(i) \rho_{0}(j)}\}$, the
least-squares criterion
\[ \sum_{i,j = 1}^{n} w_{\rho_{0}(i) \rho_{0}(j)}(p^{(tm)}_{\rho_{0}(i) \rho_{0}(j)} + c - |x_{j} - x_{i}|)^{2} , \]
is minimized, where again  $w_{\rho_{0}(i) \rho_{0}(j)} = 0$ if $\rho_{0}(i)$ and
$\rho_{0}(j)$ are both row or both column objects, and $= 1$ otherwise.  The M-file
usage is
\begin{verbatim}
[fit,vaf,rowperm,colperm,addcon,coord] =  ...
      linfittmac(proxtm,inperm)
\end{verbatim}
\noindent and does a confirmatory two-mode fitting of a given unidimensional ordering
of the row and column objects of a two-mode proximity matrix, \verb+proxtm+, using the
Dykstra-Kaczmarz iterative projection least-squares method.  In comparison, the M-file
\verb+linfittmac.m+ differs from \verb+linfittm.m+  by including the estimation of an
additive constant, and thus allowing \verb+vaf+ to be legitimately given as the
goodness-of-fit index (as opposed to just \verb+diff+, as we did in \verb+linfittm.m+).
Again, \verb+inperm+ is the given ordering of the row and column objects together;
\verb+fit+ is an $n_{a}$ (number of rows) by $n_{b}$ (number of columns) matrix of
absolute coordinate differences fitted to \verb+proxtm(rowperm,colperm)+;
\verb+rowperm+ and \verb+colperm+ are the row and column object orderings derived from
\verb+inperm+. The estimated additive constant, \verb+addcon+, can be interpreted as
being added to \verb+proxtm+ (or alternatively, subtracted from the fitted matrix,
\verb+fit+).

\smallskip


The same exemplar permutation is used below (as for \verb+linfittm.m+); following the
MATLAB  output that now includes the additive constant of $-.2132$  and the \verb+vaf+
of .9911, the two  unidimensional scalings (in their coordinate forms) are provided in
tabular form with an explicit indication of what is a row object (R) and what is a
column object (C).

\normalsize
\begin{verbatim}
>> [fit,vaf,rowperm,colperm,addcon,coord] = linfittmac(supreme_agree5x4,[1 6 2 7 3 8 4 5 9])

fit =

    0.0974    0.1405    0.4469    0.6325
    0.0431         0    0.3064    0.4920
    0.2594    0.2163    0.0901    0.2757
    0.3803    0.3372    0.0309    0.1548
    0.5351    0.4920    0.1856         0


vaf =

    0.9911


rowperm =

     1
     2
     3
     4
     5


colperm =

     1
     2
     3
     4


addcon =

   -0.2132


coord =

         0
    0.0974
    0.1405
    0.1405
    0.3568
    0.4469
    0.4777
    0.6325
    0.6325
\end{verbatim}

\large

\begin{table}

\caption{The Two Unidimensional Scalings of the supreme\_agree5x4 Data Matrix.}

\bigskip

\begin{center}

\begin{tabular}{ccccc}

justice & number & R or C & no constant & with constant \\ \hline

St & 1  & R & .0000 & .0000 \\
Br & 6 & C & .1635 & .0974 \\
Gi  & 2 & R & .2500 & .1405 \\
So   & 7 & C & .2895 & .1405 \\
Oc    & 3 & R & .5700 & .3568 \\
Ke     & 8 & C & .6835 & .4469 \\
Re      & 4 & R & .7975 & .4777 \\
Th       & 5 & R & .9600 & .6325 \\
Sc        & 9 & C & 1.0335 & .6325 \\ \hline
\end{tabular}

\end{center}

\end{table}




\subsection{Increasing the Computational Speed of the M-file, linfittmac.m}

Just as a computationally better (i.e., one that is faster) M-file was developed for \verb+linfitac.m+ in the form of \verb+linfitac_altcomp+, a computational alternative to \verb+linfittmac.m+ is available as \verb+linfittmac_altcomp.m+.  Also, a complete two-mode unidimensional scaling routine incorporating both \verb+linfitmac_altcomp.m+ and \verb+ordertm.m+, is given in \verb+uniscaltmac_altcomp.m+, with syntax:
\begin{verbatim}
[find,vaf,outperm,rowperm,colperm,addcon,coord] = ...
    uniscaltmac_altcomp(proxtm,inperm,kblock)
\end{verbatim}
As the following output from using the \verb+supreme_agree5x4+ data matrix shows (and in contrast to what was obtained for \verb+linfittmac.m+), the additive constant is now given with the opposite sign, the coordinates are deviated from the mean (so, they sum to 0.0), and the additive constant is included with the identified fitted matrix. For larger data sets, the use of \verb+linfittmac_altcomp.m+ and \verb+uniscaltmac_altcomp.m+ are almost mandatory.  The original routines can be very slow, and with some added numerical instability and convergence difficulties when the matrices are big.

\bigskip

\normalsize
\begin{verbatim}
>> load supreme_agree5x4.dat
>> [find,vaf,outperm,rowperm,colperm,addcon,coord] = uniscaltmac_altcomp(supreme_agree5x4,randperm(9),3)

find =

    0.3106    0.3537    0.6600    0.8457
    0.2563    0.2132    0.5196    0.7052
    0.4726    0.4295    0.3033    0.4889
    0.5935    0.5504    0.2441    0.3680
    0.7483    0.7052    0.3988    0.2132


vaf =

    0.9911


outperm =

     9     5     4     8     3     7     2     6     1


rowperm =

     5
     4
     3
     2
     1


colperm =

     4
     3
     2
     1


addcon =

    0.2132


coord =

   -0.3075
   -0.3075
   -0.1527
   -0.1219
   -0.0318
    0.1845
    0.1845
    0.2275
    0.3249
\end{verbatim}

\large

\section{The Analysis of Skew-Symmetric Proximity Matrices}

Suppose the original proximity information given between the pairs of objects in $S = \{O_{1},\ldots,O_{n}\}$ is nonsymmetric and in the form of an $n \times n$ nonnegative matrix, say $\mathbf{D} = \{d_{ij}\}$.  This latter matrix will be decomposed into the sum of its symmetric and skew-symmetric components as \[ \mathbf{D} = [(\mathbf{D} + \mathbf{D}')/2] + [(\mathbf{D} - \mathbf{D}')/2] \ , \]
\noindent and each of these components will always be addressed separately.  The matrix $(\mathbf{D} + \mathbf{D}')/2$ is a nonnegative symmetric matrix (in our notation, $\mathbf{P}$), and all the methods appropriate for such a proximity measure can be applied.  The second component, $(\mathbf{D} - \mathbf{D}')/2$, is an $n \times n$ matrix denoted by $\mathbf{P}^{ss} = \{p_{ij}^{ss}\}$, where $p_{ij}^{ss} = (d_{ij} - d_{ji})/2$ for $1 \le i,j \le n$, and the superscript `ss' signifies `skew-symmetric', i.e., $p_{ij}^{ss} = -p_{ji}^{ss}$ for all $1 \le i,j \le n$.  Thus, there is an explicit directionality to the (dominance) relationship specified between any two objects depending on the order of the subscripts, i.e., $p_{ij}^{ss}$ and  $p_{ji}^{ss}$ are equal in absolute magnitude but differ in sign.  It may also be worth noting here that any skew-symmetric matrix $\{p_{ij}^{ss}\}$ can itself be interpreted as containing two separate sources of information: one is the directionality of the dominance relationship given by $\{\mathrm{sign}(p_{ij}^{ss})\}$, where $\mathrm{sign}(y) = 1$ if $y > 0$; $=0$ if $y = 0$; and $= -1$ if $y < 0$; the second is in the absolute magnitude of dominance given by $\{\mid p_{ij}^{ss} \mid\}$.  This latter matrix is symmetric and can be viewed as a dissimilarity matrix and analyzed as such.

\smallskip


\large

\bigskip

Measures of matrix patterning for a skew-symmetric matrix, $\mathbf{P}^{ss}$, that might be derivable indirectly from the generation of some type of coordinate representation, have an interestingly different status than they do for a symmetric matrix $\mathbf{P}$.  In the skew-symmetric framework, closed-form least-squares solutions are possible, thus eliminating the need for some auxiliary optimization strategy.  For example, suppose we wish to find a set of $n$ coordinate values, $x_{1},\ldots,x_{n}$, such that the least-squares criterion,
 \[ \sum_{i < j} (p_{ij}^{ss} - (x_{j} - x_{i}))^{2} \ , \]
 \noindent is minimized.  An optimal set of coordinates can be obtained analytically from the average proximity within column $j$, i.e., $x_{j} = (1/n)\sum_{i} p_{ij}^{ss}$, with a minimum loss value of
 \[ \sum_{i < j} (p_{ij}^{ss})^{2} - (1/n) \sum_{j} (\sum_{i} p_{ij}^{ss})^{2} \ . \]
 \noindent Also, because the sum of the entries in $\mathbf{P}^{ss}$ is zero, the variance-accounted-for (vaf) can be given simply as:
 \[ \mathrm{vaf} = \frac{(1/n) \sum_{j} (\sum_{i} p_{ij}^{ss})^{2}}{ \sum_{i < j} (p_{ij}^{ss})^{2}} \ . \]
 \noindent Thus, an optimal row/column reordering of $\mathbf{P}^{ss}$ can be obtained just by using the order of the optimal coordinates from smallest (most negative) to largest (most positive).  Similarly, if we consider an equally-spaced coordinate representation obtained by minimizing the least-squares loss function:
  \[ \sum_{i < j} (p_{ij}^{ss} - \alpha (x_{j} - x_{i}))^{2} \ , \]
  \noindent where $x_{1},\ldots,x_{n}$ are the integers $1,\ldots,n$ in some order, and $\alpha$ is some multiplicative constant to be estimated, the optimal row/column reordering of $\mathbf{P}^{ss}$ induced by the integer coordinates would again be generated by the ordering of $(1/n) \sum_{i} p_{ij}^{ss}$ for $1 \le j \le n$.

  \smallskip

  The M-file we have written to carry-out these closed-form scaling procedures on a skew-symmetric proximity matrix is \verb+skew_symmetric_scaling.m+, with syntax:
  \begin{verbatim}
  [coord,sort_coord,permut,prox_permut,vaf,...
    alpha_multiplier,alpha_vaf,alpha_coord] = ...
    skew_symmetric_scaling(prox)
\end{verbatim}
\noindent Here,  \verb+COORD+ contains the least-squares coordinates which are sorted from
  smallest to largest in \verb+SORT_COORD+; \verb+VAF+ is the variance they account for;
  \verb+PERMUT+ is the object permutation
  corresponding to \verb+SORT_COORD+ with \verb+PROX_PERMUT+ the reordered skew-symmetric
  proximity matrix.  For equally-spaced coordinates, \verb+ALPHA_MULTIPLIER+
  defines the multiplicative constant on the integer-valued coordinates; a
  collection of equally-spaced coordinates is given by \verb+ALPHA_COORD+ with
  \verb+ALPHA_VAF+ the variance they account for.

  \smallskip

  The two Thurstone skew-symmetric matrices are used in the MATLAB recording below.  One can see the `gambler' offense moving from a fifth to a seventh position in the `before' and `after' analyses.  It does appears that the movie has had an effect.

  \tiny
  \begin{verbatim}
  >> load thurstone_skew_symmetric_before.dat
>> load thurstone_skew_symmetric_after.dat

>> [coord,sort_coord,permut,prox_permut,vaf,alpha_multiplier,alpha_vaf,...
alpha_coord] = skew_symmetric_scaling(thurstone_skew_symmetric_before)

coord =

    0.5708   -0.2292   -0.0215   -0.2569    0.2692    0.3185   -0.7785    0.5854   -0.8162   -0.3246   -0.1754    0.5677    0.2908


sort_coord =

   -0.8162   -0.7785   -0.3246   -0.2569   -0.2292   -0.1754   -0.0215    0.2692    0.2908    0.3185    0.5677    0.5708    0.5854


permut =

     9
     7
    10
     4
     2
    11
     3
     5
    13
     6
    12
     1
     8


prox_permut =

         0    0.1600    0.8200    0.9400    0.9000    0.9400    0.9600    0.9600    1.0000    0.9800    0.9800    1.0000    0.9700
   -0.1600         0    0.7200    0.9800    0.8600    0.9200    0.9600    0.9600    0.9800    1.0000    1.0000    0.9800    0.9200
   -0.8200   -0.7200         0    0.2600    0.1800    0.1600    0.2200    0.7600    0.8400    0.8200    0.8000    0.8800    0.8400
   -0.9400   -0.9800   -0.2600         0   -0.0400    0.2400    0.5000    0.6200    0.7400    0.9000    0.8200    0.9000    0.8400
   -0.9000   -0.8600   -0.1800    0.0400         0   -0.0200    0.4200    0.5200    0.6200    0.8400    0.8000    0.8600    0.8400
   -0.9400   -0.9200   -0.1600   -0.2400    0.0200         0    0.1600    0.5600    0.5600    0.4800    0.9600    0.9600    0.8400
   -0.9600   -0.9600   -0.2200   -0.5000   -0.4200   -0.1600         0    0.3400    0.3600    0.5000    0.7400    0.8400    0.7200
   -0.9600   -0.9600   -0.7600   -0.6200   -0.5200   -0.5600   -0.3400         0    0.1000   -0.0200    0.2800    0.4600    0.4000
   -1.0000   -0.9800   -0.8400   -0.7400   -0.6200   -0.5600   -0.3600   -0.1000         0         0    0.4600    0.5800    0.3800
   -0.9800   -1.0000   -0.8200   -0.9000   -0.8400   -0.4800   -0.5000    0.0200         0         0    0.3600    0.4200    0.5800
   -0.9800   -1.0000   -0.8000   -0.8200   -0.8000   -0.9600   -0.7400   -0.2800   -0.4600   -0.3600         0   -0.4600    0.2800
   -1.0000   -0.9800   -0.8800   -0.9000   -0.8600   -0.9600   -0.8400   -0.4600   -0.5800   -0.4200    0.4600         0         0
   -0.9700   -0.9200   -0.8400   -0.8400   -0.8400   -0.8400   -0.7200   -0.4000   -0.3800   -0.5800   -0.2800         0         0


vaf =

    0.9126


alpha_multiplier =

    0.1205


alpha_vaf =

    0.8690


alpha_coord =

   -0.7231
   -0.6026
   -0.4821
   -0.3616
   -0.2410
   -0.1205
         0
    0.1205
    0.2410
    0.3616
    0.4821
    0.6026
    0.7231

>> [coord,sort_coord,permut,prox_permut,vaf,alpha_multiplier,alpha_vaf,...
alpha_coord] = skew_symmetric_scaling(thurstone_skew_symmetric_after)

coord =

    0.5446    0.0200   -0.0492   -0.2569    0.2815    0.2677   -0.7446    0.5508   -0.8138   -0.3908   -0.2092    0.5138    0.2862


sort_coord =

   -0.8138   -0.7446   -0.3908   -0.2569   -0.2092   -0.0492    0.0200    0.2677    0.2815    0.2862    0.5138    0.5446    0.5508


permut =

     9
     7
    10
     4
    11
     3
     2
     6
     5
    13
    12
     1
     8


prox_permut =

         0    0.2800    0.7400    0.9200    0.9000    0.9600    0.9200    0.9600    0.9800    0.9600    0.9800    1.0000    0.9800
   -0.2800         0    0.5800    0.8800    0.8800    0.9400    0.9000    0.9600    0.9600    0.9600    0.9600    0.9600    0.9800
   -0.7400   -0.5800         0    0.3400    0.2800    0.3600    0.4600    0.8000    0.7800    0.7800    0.8400    0.8800    0.8800
   -0.9200   -0.8800   -0.3400         0    0.0600    0.4000    0.4000    0.7400    0.6800    0.6800    0.8400    0.9000    0.7800
   -0.9000   -0.8800   -0.2800   -0.0600         0    0.2400    0.2800    0.5200    0.6200    0.5200    0.9400    0.9400    0.7800
   -0.9600   -0.9400   -0.3600   -0.4000   -0.2400         0    0.0200    0.4000    0.4400    0.4000    0.6800    0.8600    0.7400
   -0.9200   -0.9000   -0.4600   -0.4000   -0.2800   -0.0200         0    0.3800    0.2800    0.3800    0.4600    0.5800    0.6400
   -0.9600   -0.9600   -0.8000   -0.7400   -0.5200   -0.4000   -0.3800         0         0    0.0200    0.4000    0.4000    0.4600
   -0.9800   -0.9600   -0.7800   -0.6800   -0.6200   -0.4400   -0.2800         0         0    0.0800    0.3000    0.3400    0.3600
   -0.9600   -0.9600   -0.7800   -0.6800   -0.5200   -0.4000   -0.3800   -0.0200   -0.0800         0    0.2800    0.4600    0.3200
   -0.9800   -0.9600   -0.8400   -0.8400   -0.9400   -0.6800   -0.4600   -0.4000   -0.3000   -0.2800         0   -0.2400    0.2400
   -1.0000   -0.9600   -0.8800   -0.9000   -0.9400   -0.8600   -0.5800   -0.4000   -0.3400   -0.4600    0.2400         0         0
   -0.9800   -0.9800   -0.8800   -0.7800   -0.7800   -0.7400   -0.6400   -0.4600   -0.3600   -0.3200   -0.2400         0         0


vaf =

    0.9340


alpha_multiplier =

    0.1164


alpha_vaf =

    0.8927


alpha_coord =

   -0.6982
   -0.5819
   -0.4655
   -0.3491
   -0.2327
   -0.1164
         0
    0.1164
    0.2327
    0.3491
    0.4655
    0.5819
    0.6982
  \end{verbatim}

  \large

  \smallskip

  Given a skew-symmetric matrix $\{p_{ij}^{ss}\}$ (or possibly, just $\{\mathrm{sign}(p_{ij}^{ss}\}$), an obvious class of measures for matrix pattern based on matrix reordering would be the sum of the above-diagonal entries:
  \[ \sum_{i < j} p_{ij}^{ss}  (\mathrm{or} \sum_{i < j} \mathrm{sign}(p_{ij}^{ss})) \ . \]
  \noindent In fact, because $p_{ij}^{ss} = \mathrm{sign}|p_{ij}^{ss}|$, the index $\sum_{i < j} p_{ij}^{ss}$ can be interpreted merely as a weighted version of the one based just on $\mathrm{sign}(p_{ij}^{ss})$.  We will assume in our discussion below that  $\sum_{i < j} p_{ij}^{ss}$ is being considered, but the obvious replacement of $p_{ij}^{ss}$ by $\mathrm{sign}(p_{ij}^{ss})$ could incorporate the use of $\sum_{i < j} \mathrm{sign}(p_{ij}^{ss})$ directly.

  \smallskip

  A dynamic programming solution to the optimization task of reordering the rows/columns of a matrix to maximize the sum of above-diagonal entries, was first sketched by Lawler (1964) in identifying minimum feedback arc sets in a directed graph.  The M-file that we use below on the Thurstone skew-symmetric matrices,  \verb+skew_symmetric_lawler_dp.m+, implements the dynamic programming recursion.
    The optimization task itself, however, has several other distinct substantive incarnations, e.g., in maximum likelihood paired comparison ranking (Flueck and Korsh, 1974), or to triangulating an input-output matrix (Korte and Oberhofer, 1971).  For an extensive review of the variety of possible applications up through the middle 1970's, the reader is referred to Hubert (1976).

    \smallskip

    The syntax of \verb+skew_symmetric_lawler_dp.m+ is as follows:
    \begin{verbatim}
    [permut,prox_permut,cumobfun] = skew_symmetric_lawler_dp(prox)
    \end{verbatim}
    \noindent Here, \verb+PROX+ is the input skew-symmetric proximity matrix (with a zero main
   diagonal);
   \verb+PERMUT+ is the order of the objects in the optimal permutation;
   \verb+PROX_PERMUT+ is the reordered proximity matrix using \verb+PERMUT+;
   \verb+CUMOBFUN+ gives the cumulative values of the objective function for
   the successive placements of the objects in the optimal permutation.  The verbatim output below is an implementation of \verb+skew_symmetric_lawler_dp.m+ on the two Thurstone `before' and `after' skew-symmetric proximity matrices.  The offense of `gambler' (number 2) moves appropriately after the movie has been shown.

   \tiny

   \begin{verbatim}
   >> [permut,prox_permut,cumobfun] = skew_symmetric_lawler_dp(thurstone_skew_symmetric_before)
Elapsed time is 0.258336 seconds.

permut =

     9
     7
    10
     2
     4
    11
     3
     6
     5
    13
     1
    12
     8


prox_permut =

         0    0.1600    0.8200    0.9000    0.9400    0.9400    0.9600    0.9800    0.9600    1.0000    1.0000    0.9800    0.9700
   -0.1600         0    0.7200    0.8600    0.9800    0.9200    0.9600    1.0000    0.9600    0.9800    0.9800    1.0000    0.9200
   -0.8200   -0.7200         0    0.1800    0.2600    0.1600    0.2200    0.8200    0.7600    0.8400    0.8800    0.8000    0.8400
   -0.9000   -0.8600   -0.1800         0    0.0400   -0.0200    0.4200    0.8400    0.5200    0.6200    0.8600    0.8000    0.8400
   -0.9400   -0.9800   -0.2600   -0.0400         0    0.2400    0.5000    0.9000    0.6200    0.7400    0.9000    0.8200    0.8400
   -0.9400   -0.9200   -0.1600    0.0200   -0.2400         0    0.1600    0.4800    0.5600    0.5600    0.9600    0.9600    0.8400
   -0.9600   -0.9600   -0.2200   -0.4200   -0.5000   -0.1600         0    0.5000    0.3400    0.3600    0.8400    0.7400    0.7200
   -0.9800   -1.0000   -0.8200   -0.8400   -0.9000   -0.4800   -0.5000         0    0.0200         0    0.4200    0.3600    0.5800
   -0.9600   -0.9600   -0.7600   -0.5200   -0.6200   -0.5600   -0.3400   -0.0200         0    0.1000    0.4600    0.2800    0.4000
   -1.0000   -0.9800   -0.8400   -0.6200   -0.7400   -0.5600   -0.3600         0   -0.1000         0    0.5800    0.4600    0.3800
   -1.0000   -0.9800   -0.8800   -0.8600   -0.9000   -0.9600   -0.8400   -0.4200   -0.4600   -0.5800         0    0.4600         0
   -0.9800   -1.0000   -0.8000   -0.8000   -0.8200   -0.9600   -0.7400   -0.3600   -0.2800   -0.4600   -0.4600         0    0.2800
   -0.9700   -0.9200   -0.8400   -0.8400   -0.8400   -0.8400   -0.7200   -0.5800   -0.4000   -0.3800         0   -0.2800         0


cumobfun =

         0
    0.1600
    1.7000
    3.6400
    5.8600
    8.1000
   11.3200
   16.8400
   21.5800
   26.7800
   34.6600
   42.3200
   49.9300

>> [permut,prox_permut,cumobfun] = skew_symmetric_lawler_dp(thurstone_skew_symmetric_after)
Elapsed time is 0.234843 seconds.

permut =

     9
     7
    10
     4
    11
     3
     2
     5
     6
    13
     1
    12
     8


prox_permut =

         0    0.2800    0.7400    0.9200    0.9000    0.9600    0.9200    0.9800    0.9600    0.9600    1.0000    0.9800    0.9800
   -0.2800         0    0.5800    0.8800    0.8800    0.9400    0.9000    0.9600    0.9600    0.9600    0.9600    0.9600    0.9800
   -0.7400   -0.5800         0    0.3400    0.2800    0.3600    0.4600    0.7800    0.8000    0.7800    0.8800    0.8400    0.8800
   -0.9200   -0.8800   -0.3400         0    0.0600    0.4000    0.4000    0.6800    0.7400    0.6800    0.9000    0.8400    0.7800
   -0.9000   -0.8800   -0.2800   -0.0600         0    0.2400    0.2800    0.6200    0.5200    0.5200    0.9400    0.9400    0.7800
   -0.9600   -0.9400   -0.3600   -0.4000   -0.2400         0    0.0200    0.4400    0.4000    0.4000    0.8600    0.6800    0.7400
   -0.9200   -0.9000   -0.4600   -0.4000   -0.2800   -0.0200         0    0.2800    0.3800    0.3800    0.5800    0.4600    0.6400
   -0.9800   -0.9600   -0.7800   -0.6800   -0.6200   -0.4400   -0.2800         0         0    0.0800    0.3400    0.3000    0.3600
   -0.9600   -0.9600   -0.8000   -0.7400   -0.5200   -0.4000   -0.3800         0         0    0.0200    0.4000    0.4000    0.4600
   -0.9600   -0.9600   -0.7800   -0.6800   -0.5200   -0.4000   -0.3800   -0.0800   -0.0200         0    0.4600    0.2800    0.3200
   -1.0000   -0.9600   -0.8800   -0.9000   -0.9400   -0.8600   -0.5800   -0.3400   -0.4000   -0.4600         0    0.2400         0
   -0.9800   -0.9600   -0.8400   -0.8400   -0.9400   -0.6800   -0.4600   -0.3000   -0.4000   -0.2800   -0.2400         0    0.2400
   -0.9800   -0.9800   -0.8800   -0.7800   -0.7800   -0.7400   -0.6400   -0.3600   -0.4600   -0.3200         0   -0.2400         0


cumobfun =

         0
    0.2800
    1.6000
    3.7400
    5.8600
    8.7600
   11.7400
   16.4800
   21.2400
   26.0200
   33.3400
   40.2600
   47.4200
   \end{verbatim}

   \large



\section{Order-Constrained Partition Construction}

The classification task considered in the present section is one of constructing an
(optimal) ordered partition for a set of $n$ objects, $S = \{O_{1}, \ldots, O_{n}\}$,
defined by a collection of $M$ mutually exclusive and exhaustive subsets of $S$,
denoted $S_{1}, S_{2}, \ldots, S_{M}$, for which an order is imposed on the placement
of the classes, $S_{1} \prec S_{2} \prec \cdots \prec S_{M}$, and also a prior order
is present for the objects within classes.  Again, the data available to guide this
search are assumed to be in the form of an $n \times n$ symmetric proximity matrix
$\mathbf{P} = \{p_{ij}\}$. In general, the identification of an optimal ordered
partition for $S$ will be carried out by the maximization of an index of merit
intended to measure how well a given ordered partition reflects the data in
$\mathbf{P}$.  The initial constraining object order will be constructed with the
(heuristic) unidimensional scaling routine, \verb+uniscalqa.m+, discussed in Section
2.2.

\smallskip

A merit measure can be developed directly based on a coordinate representation for
each of the $M$ ordered classes, $S_{1} \prec S_{2} \prec \cdots \prec S_{M}$, that
generalizes the use of the single term $\sum_{i}(t_{i}^{(\rho)})^{2}$ for a
unidimensional scaling discussed in Section 2.  Here, $M$ coordinates, $x_{1} \leq
\cdots \leq x_{M}$, are to be identified so that the residual sum-of-squares
\[ \sum_{k \leq k' \ } \sum_{i_{k} \in S_{k}, \  j_{k'} \in
S_{k'}} (p_{i_{k}j_{k'}} - \mid x_{k'} - x_{k} \mid )^{2} , \] is minimized (the
notation $p_{i_{k}j_{k'}}$ indicates those proximities in $\mathbf{P}$ defined between
objects with subscripts $i_{k} \in S_{k}$ and $j_{k'}  \in S_{k'}$). Define each of
the sets, $\Omega_{1}, \ldots, \Omega_{M}$, by the $n$ subsets of $S$ that contain the
first $i$ objects, $\{O_{1}, \ldots, O_{i}\}$, for $1 \le i \le n$; a transformation
of an entity in $\Omega_{k-1}$ (say, $A_{k-1}$) to one in $\Omega_{k}$ (say, $A_{k}$)
is possible if $A_{k-1} \subset A_{k}$.

\smallskip

 A direct extension of the argument that led to
optimal coordinate representation for single objects would require the maximization of
\begin{equation}
\sum_{k=1}^{M} (\frac{1}{n_{k}})(G(A_{k} - A_{k-1}))^{2} ,
\end{equation}

\noindent where $G(A_{k} - A_{k-1}) = $
\[ \sum_{k' \in A_{k} - A_{k-1}} \sum_{i' \in A_{k-1}}
p_{k' i'} \   - \sum_{k' \in A_{k} - A_{k-1}} \sum_{i' \in S - A_{k}} p_{k' i'} , \]
and $n_{k}$ denotes the number of objects in $A_{k} - A_{k-1}$.  If an optimal ordered
partition that maximizes (10) is denoted by $S_{1}^{*} \prec \cdots \prec S_{M}^{*}$,
the optimal coordinates for each of the $M$ classes can be given as
\begin{equation}
     x_{k}^{*} = (\frac{1}{nn_{k}})G(S_{k}^{*}) ,
\end{equation}
\noindent where $x_{1}^{*} \leq \cdots \leq x_{M}^{*}$, and $\sum_{k} n_{k}x_{k}^{*} =
0$.  The residual sum-of-squares has the form
\begin{equation}
 \sum_{i  < j} p_{ij}^{2} - (\frac{1}{n}) \sum_{k}
(\frac{1}{n_{k}})(G(S_{k}^{*}))^{2} .
\end{equation}


\subsection{The Dynamic Programming Implementation}

Given the proximity matrix, $\mathbf{P}$, suppose we have a constraining object order,
assumed without loss of generality, for now, to be the identity order, and used to
label the rows and columns of $\mathbf{P}$.  An order constrained clustering consists
of finding a set of $M$ classes, $S_{1}, \ldots, S_{k}, \ldots, S_{M}$, having $n_{k}$
objects in $S_{k}$ and where the objects in $S_{k}$ are consecutive:
 \[\{O_{n_{1} + \cdots + n_{k-1} + 1}, O_{n_{1} + \cdots + n_{k-1} + 2}, \ldots, O_{n_{1} + \cdots + n_{k-1} + n_{k}} \} . \]
\noindent A recursive dynamic programming strategy can be used to solve this task that
we implement in the M-file, \verb+orderpartitionfnd.m+.  In the session recorded
below, we give the help information for this M-file (as well as in the Appendix) and run it on the
\verb+supreme_agree+ data with a constraining identity permutation on the objects
obtained from the previous unidimensional scaling.  Generally, the class membership
into from 1 to $n$ ordered classes is given by the two $n \times n$ matrices of
\verb+membership+ and \verb+permmember+ with rows corresponding to the number of
ordered classes constructed and columns to the objects.  The identity permutation also
labels the columns of \verb+membership+; the constraining object order labels the
columns of \verb+permmember+ (in this example, these two permutations happen to be the
same). The two vectors of \verb+objectives+ and \verb+residsumsq+ contain,
respectively, the values maximized in (10) and the corresponding residual
sums-of-squares from (12). We will continue with the interpretation after the verbatim
output from the session is provided.

\normalsize
\begin{verbatim}
>> load supreme_agree.dat
>> help orderpartitionfnd.m

  ORDERPARTITIONFND uses dynamic programming to
  construct a linearly constrained cluster analysis that
  consists of a collection of partitions with from 1 to
  n ordered classes.

  syntax: [membership,objectives,permmember,clusmeasure,...
     cluscoord,residsumsq] = orderpartitionfnd(prox,lincon)

  PROX is the input proximity matrix (with a zero main diagonal
  and a dissimilarity interpretation); LINCON is the given
  constraining linear order (a permutation of the integers from
  1 to n).
  MEMBERSHIP is the n x n matrix indicating cluster membership,
  where rows correspond to the number of ordered clusters,
  and the columns are in the identity permutation input order
  used for PROX. PERMMEMBER uses LINCON to reorder the columns
  of MEMBERSHIP.
  OBJECTIVES is the vector of merit values maximized in the
  construction of the ordered partitions; RESIDSUMSQ is the
  vector of residual sum of squares obtained for the ordered
  partition construction.  CLUSMEASURE is the n x n matrix
  (upper-triangular) containing the cluster measures for contiguous
  object sets; the appropriate values in CLUSMEASURE are added
  to obtain the values optimized in OBJECTIVES; CLUSCOORD is also
  an n x n (upper-triangular) matrix but now containing the coordinates
  that would be would be used for all the (ordered)
  objects within a class.



>> [membership,objectives,permmember,clusmeasure,...
     cluscoord,residsumsq] = orderpartitionfnd(supreme_agree,[1 2 3 4 5 6 7 8 9])

membership =

     1     1     1     1     1     1     1     1     1
     2     2     2     2     1     1     1     1     1
     3     3     3     3     2     2     2     1     1
     4     3     3     3     2     2     2     1     1
     5     4     4     4     3     2     2     1     1
     6     5     5     4     3     2     2     1     1
     7     6     6     5     4     3     2     1     1
     8     7     6     5     4     3     2     1     1
     9     8     7     6     5     4     3     2     1


objectives =

         0
   73.8432
   83.2849
   86.9479
   88.1095
   88.6861
   89.0559
   89.2241
   89.3166


permmember =

     1     1     1     1     1     1     1     1     1
     2     2     2     2     1     1     1     1     1
     3     3     3     3     2     2     2     1     1
     4     3     3     3     2     2     2     1     1
     5     4     4     4     3     2     2     1     1
     6     5     5     4     3     2     2     1     1
     7     6     6     5     4     3     2     1     1
     8     7     6     5     4     3     2     1     1
     9     8     7     6     5     4     3     2     1


clusmeasure =

   23.6196   32.8860   38.7361   41.0240   30.0125   19.4400   10.2972    2.4865         0
         0   10.5625   17.5232   21.0675   13.6530    7.0567    2.1961    0.0229    2.9524
         0         0    7.1289   11.0450    5.7132    1.8090    0.0289    2.2204    9.3960
         0         0         0    4.1209    1.0804    0.0001    1.3110    7.9885   19.3681
         0         0         0         0    0.3136    2.0201    6.2208   17.4306   32.8192
         0         0         0         0         0    2.1025    7.0688   20.2280   37.5156
         0         0         0         0         0         0    5.3361   20.0978   38.8800
         0         0         0         0         0         0         0   16.2409   36.0401
         0         0         0         0         0         0         0         0   19.8916


cluscoord =

   -0.5400   -0.4506   -0.3993   -0.3558   -0.2722   -0.2000   -0.1348   -0.0619         0
         0   -0.3611   -0.3289   -0.2944   -0.2053   -0.1320   -0.0672    0.0063    0.0675
         0         0   -0.2967   -0.2611   -0.1533   -0.0747   -0.0084    0.0676    0.1287
         0         0         0   -0.2256   -0.0817   -0.0007    0.0636    0.1404    0.1996
         0         0         0         0    0.0622    0.1117    0.1600    0.2319    0.2847
         0         0         0         0         0    0.1611    0.2089    0.2885    0.3403
         0         0         0         0         0         0    0.2567    0.3522    0.4000
         0         0         0         0         0         0         0    0.4478    0.4717
         0         0         0         0         0         0         0         0    0.4956


residsumsq =

   10.3932
    2.1884
    1.1393
    0.7323
    0.6033
    0.5392
    0.4981
    0.4794
    0.4691
\end{verbatim}

\large

To interpret this example further, it appears that five ordered classes may be a good
`stopping point' for the clustering process --- moving to four gives a noticeable drop
in the achievable objective function value.  The fifth row of \verb+membership+ is the
vector \verb+5 4 4 4 3 2 2 1 1+, and thus the justice partitioning of \{\{St\},\{Br,
Gi, So\},\{Oc\},\{Ke,Re\},\{Sc,Th\}\}, clearly placing O'Connor in a separate `swing'
class.  The \verb+objectives+ value for this partition is 88.1095, and can be
reconstructed from the values in \verb+clusmeasure+ that delineate the extent of the
various classes, i.e., the values in this matrix at positions (1,1), (2,4), (5,5),
(6,7), (8,9): 23.6196 + 21.0675 + .3136 + 7.0688 + 36.0401 = 88.1096 ($\approx$
88.1095 to rounding).  The coordinates for the classes are given in these same
positions in the matrix \verb+cluscoord+: $-$.5400; $-$.2944; .0622; .2089; .4717.
Weighting these by the class sizes of 1, 3, 1, 2, 2, respectively, and then summing,
gives the value (to rounding) of 0.0 (i.e., the constraint
 $\sum_{k}n_{k}x_{k}^{*} = 0$ is satisfied). Finally, the residual sum-of-squares of
 .6033 is reconstructible from (12) as
$10.3932 - (1/9)88.1096$, where 10.3932 is $\sum_{i  < j} p_{ij}^{2}$, and is always
given as the first entry in \verb+residsumsq+  corresponding to only one class that
must be placed at a coordinate value of 0.0 (because of the constraint
$\sum_{k}n_{k}x_{k}^{*} = 0$).

\subsection{Two Utility Functions For Coordinate Estimation}

When constructing ordered partitions through optimizing the measure in (10), the
coordinates were generated as a byproduct through the closed-form expression in (11).
For some extensions we contemplate, and particularly to multiple dimensions and the
imposition of ordered partitions on each, it would be useful to have a fitting
mechanism that would not depend on the presence of nonnegative proximities.  To this
end we provide two utility M-files, \verb+linfit_tied.m+ and \verb+linfitac_tied.m+,
that for a given ordered partition and underlying constraining object order, will fit
the $M$ coordinates, $x_{1} \le \cdots \le x_{M}$ (and an additional additive constant
$c$ in the case of \verb+linfitac_tied.m+) by minimizing
\[ \sum_{k \leq k' \ } \sum_{i_{k} \in S_{k}, \  j_{k'} \in
S_{k'}} (p_{i_{k}j_{k'}} - (\mid x_{k'} - x_{k} \mid - \ c \ ) )^{2} . \]



\smallskip

The MATLAB session below includes the help comments for each M-file and fits the
five-class ordered partition found earlier.  For both M-files, the
\verb+supreme_agree+ proximity matrix is used, along with a constraining order in
\verb+inperm+ (here, the identity), and the pattern of tied coordinates imposed in
order along the continuum (given as the fifth row of \verb+permmember+,
 \verb+[5 4 4 4 2 2 1 1]+).

\normalsize
\begin{verbatim}
>> load supreme_agree.dat

>> help linfit_tied.m

   LINFIT_TIED does a confirmatory fitting of a given
   unidimensional order using Dykstra's
   (Kaczmarz's) iterative projection least-squares method. This
   includes the possible imposition of tied coordinates.

   syntax: [fit, diff, coord] = linfit_tied(prox,inperm,tiedcoord)

   INPERM is the given order;
   FIT is an $n \times n$ matrix that is fitted to
   PROX(INPERM,INPERM) with least-squares value DIFF;
   COORD gives the ordered coordinates whose absolute
   differences could be used to reconstruct FIT; TIEDCOORD
   is the tied pattern of coordinates imposed (in order)
   along the continuum (using the integers from 1 up to n
   to indicate the tied positions).



>> [fit,diff,coord] = linfit_tied(supreme_agree,[1 2 3 4 5 6 7 8 9],[5 4 4 4 3 2 2 1 1])

fit =

         0    0.2456    0.2456    0.2456    0.6022    0.7489    0.7489    1.0117    1.0117
    0.2456         0         0         0    0.3567    0.5033    0.5033    0.7661    0.7661
    0.2456         0         0         0    0.3567    0.5033    0.5033    0.7661    0.7661
    0.2456         0         0         0    0.3567    0.5033    0.5033    0.7661    0.7661
    0.6022    0.3567    0.3567    0.3567         0    0.1467    0.1467    0.4094    0.4094
    0.7489    0.5033    0.5033    0.5033    0.1467         0         0    0.2628    0.2628
    0.7489    0.5033    0.5033    0.5033    0.1467         0         0    0.2628    0.2628
    1.0117    0.7661    0.7661    0.7661    0.4094    0.2628    0.2628         0         0
    1.0117    0.7661    0.7661    0.7661    0.4094    0.2628    0.2628         0         0


diff =

    0.6032


coord =

   -0.5400
   -0.2944
   -0.2944
   -0.2944
    0.0622
    0.2089
    0.2089
    0.4717
    0.4717

>> help linfitac_tied.m

   LINFITAC_TIED does a confirmatory fitting of a given unidimensional order
   using the Dykstra--Kaczmarz iterative projection
   least-squares method, but differing from linfit_tied.m in
   including the estimation of an additive constant.  This also allows
   the possible imposition of tied coordinates.

   syntax: [fit, vaf, coord, addcon] = linfitac_tied(prox,inperm,tiedcoord)

   INPERM is the given order;
   FIT is an $n \times n$ matrix that is fitted to
   PROX(INPERM,INPERM) with variance-accounted-for VAF;
   COORD gives the ordered coordinates whose absolute differences
   could be used to reconstruct FIT; ADDCON is the estimated
   additive constant that can be interpreted as being added to PROX.
   TIEDCOORD is the tied pattern of coordinates imposed (in order)
   along the continuum (using the integers from 1 up to n
   to indicate the tied positions).



>> [fit,vaf,coord,addcon] = linfitac_tied(supreme_agree,[1 2 3 4 5 6 7 8 9],[5 4 4 4 3 2 2 1 1])

fit =

         0    0.1435    0.1435    0.1435    0.3981    0.4682    0.4682    0.6289    0.6289
    0.1435         0         0         0    0.2546    0.3247    0.3247    0.4854    0.4854
    0.1435         0         0         0    0.2546    0.3247    0.3247    0.4854    0.4854
    0.1435         0         0         0    0.2546    0.3247    0.3247    0.4854    0.4854
    0.3981    0.2546    0.2546    0.2546         0    0.0701    0.0701    0.2308    0.2308
    0.4682    0.3247    0.3247    0.3247    0.0701         0         0    0.1607    0.1607
    0.4682    0.3247    0.3247    0.3247    0.0701         0         0    0.1607    0.1607
    0.6289    0.4854    0.4854    0.4854    0.2308    0.1607    0.1607         0         0
    0.6289    0.4854    0.4854    0.4854    0.2308    0.1607    0.1607         0         0


vaf =

    0.9671


coord =

   -0.3359
   -0.1924
   -0.1924
   -0.1924
    0.0622
    0.1323
    0.1323
    0.2930
    0.2930


addcon =

   -0.2297
\end{verbatim}


\large


As can be seen in the preceding output, the coordinates given earlier for the
five-class ordered partition can be retrieved using \verb+linfit_tied.m+ along with
the least-squares loss value, \verb+diff+, of 0.6032 (this is within a .0001 rounding
error of the previously given five-class residual sum-of-squares of 0.6033).  In
incorporating the estimation of an additive constant, $c$, as part of the model that
is fitted with \verb+linfitac_tied+, a legitimate variance-accounted-for ($VAF$)
measure can be given and used in place of the unnormalized least-squares loss value
(usually denoted as \verb+vaf+).  Here, we would define the $VAF$ measure as
\begin{equation}
     VAF =  1 - \frac{
\sum_{k \leq k' \ } \sum_{i_{k} \in S_{k}, \  j_{k'} \in S_{k'}} (p_{i_{k}j_{k'}} -
(\mid x_{k'} - x_{k} \mid - \ c \ ) )^{2} }{ \sum_{i < j}(p_{ij} - \bar{p})^{2}},
\end{equation}
\noindent where $\bar{p}$ is the mean of the off-diagonal proximities in $\mathbf{P}$.
The argument for the legitimacy of a $VAF$ measure follows the same logic as being
able to use a $VAF$ measure only in a multiple regression that includes an additive constant
(and therefore, the least-squares structure is not forced to go through the origin).

\smallskip

The normalized $VAF$ measure may help in deciding when an unacceptable drop is present
when going from one ordered partition to another.  Based on running the MATLAB script
given below, we can generate the following table:


\begin{center}
\begin{tabular}{cc}

Number of Ordered Classes & Variance-Accounted-For \\ \hline

9 & .9796 \\

8 & .9796 \\

7 & .9786 \\

6 & .9708 \\

5 & .9671 \\

4 & .9446 \\

3 & .8513 \\

2 & .6759 \\

1 & .0000 \\
\end{tabular}
\end{center}

\noindent As can be seen, the five-class partition has a very high $VAF$ of .9671, and
there is a somewhat precipitous drop of over 2\% in going to one fewer; also, in going
the complete way from nine classes to five, we have a drop of only slightly larger
than 1\%.  So, based on this reasoning, the five-class ordered partition might be
considered the `stopping place' of choice.

\normalsize
\begin{verbatim}
>> load supreme_agree.dat

>> identityperm = [1 2 3 4 5 6 7 8 9];

>> [membership,objectives,permmember,clusmeasure,...
cluscoord,residsumsq] = orderpartitionfnd(supreme_agree,identityperm);

>> for i = 1:9

tiedcoord = permmember(10-i,:);

 [fit,vaf,coord,addcon] = linfitac_tied(supreme_agree,identityperm,tiedcoord);

 fits{i} = fit;

 vafs{i} = vaf;


coords{i} = coord; addcons{i} = addcon;

 end

>> for i = 1:9

 vaf = vafs{i}

end

vaf =

    0.9796

... (output deleted)

vaf =

    0.6759


vaf =

     0
\end{verbatim}


\large

\subsection{Extensions to Generalized Ultrametrics}

As we construct a collection of $T$ ordered partitions of $S$ into anywhere from 1 to
$n$ classes, and where each class within a partition defines a consecutive set of
objects with respect to some fixed ordering of the $n$ objects, denote the $T$
partitions as $\mathcal{P}_{1}, \mathcal{P}_{2}, \dots, \mathcal{P}_{T}$.  Here,
$\mathcal{P}_{1}$ is a partition containing $n$ classes, $\mathcal{P}_{T}$ includes
only a single class, and $\mathcal{P}_{t-1}$ has more classes than $\mathcal{P}_{t}$
for $t \ge 2$.  Based on $\mathcal{P}_{1}, \mathcal{P}_{2}, \dots, \mathcal{P}_{T-1}$,
if a corresponding collection of $n \times n$ 0/1 dissimilarity matrices
$\mathbf{P}_{1}, \ldots, \mathbf{P}_{T-1}$ is constructed, where a 0 in
$\mathbf{P}_{t}$ indicates an object pair defined within a class in $\mathcal{P}_{t}$,
and 1 otherwise, then for any collection of nonnegative weights, $\alpha_{1}, \ldots,
\alpha_{T-1}$, the dissimilarity matrix, say, $\mathbf{P}_{\alpha} =
\{p_{ij}^{(\alpha})\} \equiv \sum_{t=1}^{T-1} \alpha_{t} \mathbf{P}_{t}$, defines a
metric on the objects (based on the observation that sums of metrics are metric [but
with the possible extension that allows some dissimilarities to be zero for
nonidentical objects]).  (We don't consider the partition, $\mathcal{P}_{T}$, defined by
one class because the corresponding $\mathbf{P}_{T}$ would be identically zero and thus
provides no contribution to the defining sum of weights.)  Depending on the
constraints placed on
 $\mathcal{P}_{1}, \mathcal{P}_{2}, \dots, \mathcal{P}_{T-1}$, more restrictive forms for the metric defined by
$\mathbf{P}_{\alpha}$ ensue; and specific to the restrictions made, it may be possible
to retrieve $\mathcal{P}_{1}, \mathcal{P}_{2}, \dots, \mathcal{P}_{T-1}$ and
$\alpha_{1}, \ldots, \alpha_{T-1}$ given only $\mathbf{P}_{\alpha}$, provide
convenient graphical representations for the collection $\mathcal{P}_{1},
\mathcal{P}_{2}, \dots, \mathcal{P}_{T-1}$, or somehow to approach the task of
constructing $\mathcal{P}_{1}, \mathcal{P}_{2}, \dots, \mathcal{P}_{T-1}$ and
$\alpha_{1}, \ldots, \alpha_{T-1}$ from some given proximity matrix $\mathbf{P}$ so
that $\mathbf{P}_{\alpha}$ approximates $\mathbf{P}$ in some explicitly defined sense.

\smallskip

The obvious prime exemplar for this type of structure just discussed would be when
$\mathcal{P}_{t}$ is formed from $\mathcal{P}_{t-1}$ by uniting two or more classes in
the latter.  The entries in $\mathbf{P}_{\alpha}$ then satisfy the ultrametric
inequality ($p_{ij}^{(\alpha)} \le \max \{p_{ik}^{(\alpha)}, p_{jk}^{(\alpha)}\}$ for
all $O_{i}, O_{j}, O_{k} \in S$), the partition hierarchy and the weights are
retrievable given only $\mathbf{P}_{\alpha}$, and a representation of the hierarchical
clustering can be given in the form of what is usually called a dendrogram.  In a more
general context where $\mathcal{P}_{1}, \mathcal{P}_{2}, \dots, \mathcal{P}_{T-1}$ are
merely restricted to be ordered partitions, each defined by classes contiguous with
respect to some given ordering for the objects in $S$, the entries in the matrix
$\mathbf{P}_{\alpha}$ satisfy (at the least) the anti-Robinson condition (i.e., if
$O_{i} \prec O_{j} \prec O_{k}$, then $p_{ik}^{(\alpha)} \ge \max \{p_{ij}^{(\alpha)},
p_{jk}^{(\alpha)}\}$, and can be constructed by sums of subsets of a collection of
nonnegative weights $\alpha_{1}, \ldots, \alpha_{T-1}$, just as in the more
restrictive ultrametric context.  Thus, although the same number of weights may be
needed to construct $\mathbf{P}_{\alpha}$ as for an ultrametric, the structures
definable through ordered partitions restricted only by the class contiguity
constraint are broader than those possible through the concept of an ultrametric.

\smallskip

To illustrate the fitting process for a collection of ordered partitions, we use the
membership matrix obtained from \verb+orderpartitionfnd.m+ as an input argument to
\verb+orderpartitionfit.m+, where the latter provides a least-squares approximation to
a proximity matrix based on a given collection of partitions with ordered classes.
Note that we must remove the first row of \verb+membership+ that is output from
\verb+orderpartitionfnd.m+ before it is used as an input argument for
\verb+orderpartitionfit.m+.  This removes the one-class ordered partition that adds
nothing to the fitting but actually causes difficulty in our nonnegative least-squares
routine.  The latter M-file is based on the Wollan and Dykstra (1987) Fortran
subroutine code that we have rewritten and included as an M-file called
\verb+dykstra.m+ (this is called by \verb+orderpartitionfit.m+).

\smallskip

The MATLAB session recorded below includes the help information for
\verb+orderpartitonfit.m+ and should be relatively self-explanatory.  Because the
ordered partitions here happen to be hierarchically nested, the resulting fitted
matrix given is an ultrametric (with \verb+vaf+ of .7339), and built up from the
partition weights given in \verb+weights+.

\normalsize
\begin{verbatim}
>> load supreme_agree.dat
>> [membership,objectives,permmember,clusmeasure,...
cluscoord,residsumsq] = orderpartitionfnd(supreme_agree,[1 2 3 4 5 6 7 8 9]);
>> membership = membership(2:9,:);
>> membership

membership =

     2     2     2     2     1     1     1     1     1
     3     3     3     3     2     2     2     1     1
     4     3     3     3     2     2     2     1     1
     5     4     4     4     3     2     2     1     1
     6     5     5     4     3     2     2     1     1
     7     6     6     5     4     3     2     1     1
     8     7     6     5     4     3     2     1     1
     9     8     7     6     5     4     3     2     1

>> help orderpartitionfit.m

  ORDERPARTITIONFIT provides a least-squares approximation to a proximity
  matrix based on a given collection of partitions with ordered classes.

  syntax: [fit,weights,vaf] = orderpartitionfit(prox,lincon,membership)

  PROX is the n x n input proximity matrix (with a zero main diagonal
  and a dissimilarity interpretation); LINCON is the given constraining
  linear order (a permutation of the integers from 1 to n).
  MEMBERSHIP is the m x n matrix indicating cluster membership, where
  each row corresponds to a specific ordered partition (there are
  m partitions in general);
  the columns are in the identity permutation input order used for PROX.
  FIT is an n x n matrix fitted to PROX (through least-squares) constructed
  from the nonnegative weights given in the m x 1 WEIGHTS vectors
  corresponding to each of the ordered partitions.  VAF is the variance-
  accounted-for in the proximity matrix PROX by the fitted matrix FIT.



>> [fit,weights,vaf] = orderpartitionfit(supreme_agree,[1 2 3 4 5 6 7 8 9],membership)

fit =

         0    0.3633    0.3633    0.3633    0.6405    0.6405    0.6405    0.6405    0.6405
    0.3633         0    0.2550    0.2550    0.6405    0.6405    0.6405    0.6405    0.6405
    0.3633    0.2550         0    0.2550    0.6405    0.6405    0.6405    0.6405    0.6405
    0.3633    0.2550    0.2550         0    0.6405    0.6405    0.6405    0.6405    0.6405
    0.6405    0.6405    0.6405    0.6405         0    0.3100    0.3100    0.4017    0.4017
    0.6405    0.6405    0.6405    0.6405    0.3100         0    0.2550    0.4017    0.4017
    0.6405    0.6405    0.6405    0.6405    0.3100    0.2550         0    0.4017    0.4017
    0.6405    0.6405    0.6405    0.6405    0.4017    0.4017    0.4017         0    0.2100
    0.6405    0.6405    0.6405    0.6405    0.4017    0.4017    0.4017    0.2100         0


weights =

    0.2388
    0.0383
    0.0533
    0.0550
         0
         0
    0.0450
    0.2100


vaf =

    0.7339
\end{verbatim}


\large

\section{Some Possible LUS and CUS Generalizations}

\subsection{Additive Representation Through Multiple Structures}

The use of multiple structures to represent additively a given proximity matrix,
whether they come from a LUS or CUS model, proceeds directly through successive
residualization and iteration. We restrict ourselves to the fitting of two such
structures but the same process would apply for any such number. Initially, a first
matrix is fitted to a given proximity matrix and a first residual matrix obtained; a
second structure is then fitted to these first residuals, producing a second residual
matrix. Iterating, the second fitted matrix is now subtracted from the original
proximity matrix and a first (re)fitted matrix obtained; this first (re)fitted matrix
in turn is subtracted from the original proximity matrix and a new second matrix
(re)fitted. This process continues until the \verb+vaf+ for the sum of both fitted
matrices no longer changes substantially.

\smallskip

 The M-files,
\verb+biscalqa.m+ and \verb+biscaltmac.m+  fit (additively) two LUS structures in the
least-squares sense for, respectively, one and two-mode proximity matrices;
\verb+bicirac.m+ fits two CUS models. The explicit usages are

\normalsize

\begin{verbatim}
[outpermone,outpermtwo,coordone,coordtwo,fitone,fittwo,addconone,addcontwo,vaf] = ...
    biscalqa(prox,targone,targtwo,inpermone,inpermtwo,kblock,nopt)

[find,vaf,targone,targtwo,outpermone,outpermtwo,rowpermone,colpermone,rowpermtwo, ...
colpermtwo,addconone,addcontwo,coordone,coordtwo,axes] = ...
    biscaltmac(proxtm,inpermone,inpermtwo,kblock,nopt)

[find,vaf,targone,targtwo,outpermone,outpermtwo,addconone,addcontwo] = ...
    bicirac(prox,inperm,kblock)
\end{verbatim}


\large

 \noindent where (in \verb+biscalqa.m+) \verb+prox+ is the input proximity
matrix (with a zero main diagonal and a dissimilarity interpretation); \verb+targone+
is the input target matrix for the first dimension  (usually with a zero main diagonal
and a dissimilarity  interpretation representing equally-spaced locations along  a
continuum); \verb+targtwo+ is the input target matrix for the second dimension;
\verb+inpermone+ is the input beginning permutation for the first dimension (a
permutation of the first $n$ integers); \verb+inpermtwo+ is the input beginning
permutation for the second dimension; the insertion and rotation routines use from 1
to \verb+kblock+  (which is less than or equal to $n-1$) consecutive objects in  the
permutation defining the row and column orders of the data matrix. The switch
variable, \verb+nopt+, controls the confirmatory or exploratory fitting of the
unidimensional scales; a value of \verb+nopt = 0+ will fit in a  confirmatory manner
the two scales indicated by \verb+inpermone+ and \verb+inpermtwo+;  a value of
\verb+nopt = 1+ uses iterative QA to locate the better permutations to fit;
\verb+outpermone+ is the final object permutation for the  first dimension;
\verb+outpermtwo+ is the final object permutation  for the second dimension;
\verb+coordone+ is the set of first dimension coordinates  in ascending order;
\verb+coordtwo+ is the set of second dimension coordinates in ascending order;
\verb+addconone+ is the additive constant for the first dimension model;
\verb+addcontwo+ is the additive constant for the second dimension model; \verb+vaf+
is the variance-accounted-for in \verb+prox+ by the bidimensional scaling.

\smallskip

In \verb+biscaltmac.m+, \verb+proxtm+ is the input two-mode proximity matrix with a
dissimilarity interpretation; \verb+find+ is the least-squares optimal matrix (with
variance-accounted-for of \verb+vaf+) to \verb+proxtm+ and is the sum of the two
matrices, \verb+targone+ and \verb+targtwo+, based on the two row and column object
orderings given by the ending permutations, \verb+outpermone+ and \verb+outpermtwo+,
and in turn, \verb+rowpermone+ and \verb+rowpermtwo+, and \verb+colpermone+ and
\verb+colpermtwo+.  The $n \times 2$ matrix \verb+axes+ gives the plotting coordinates
for the combined row and column object set. For \verb+bicirac.m+, \verb+inperm+ is the
single starting permutation for both circular structures.  For both \verb+biscaltmac.m+ and \verb+bicirac.m+, computationally more efficient routines are available in \verb+biscaltmac_revision+, which uses \verb+uniscaltmac_altcomp.m+ and \verb+linfittmac_altcomp.m+, and in \verb+ms_bicirac.m+, which incorporates the Fortran callable routines,

\verb+ms_cirgitac_ftarg.mexw32+; \verb+ms_order.mexw32+; \verb+ms_cirfitac.mex32+.







\smallskip

Because of a later Toolbox now being constructed, we will not give an explicit
illustration here of using two fitted structures to represent a proximity matrix.
Also, the primary data set we have been using, \verb+supreme_agree+, is not a
particularly good example for multiple structures because only one such device is
really needed to explain everything present in the data.  More suitable proximity
matrices would probably themselves be obtained by a mixture or aggregation of other
proximity matrices, reflecting somewhat different underlying structures; hopefully,
these could be `teased apart' in an analysis using multiple additive structures.

\subsection{Individual Differences}

 One aspect of the given M-files introduced in
 earlier sections but not emphasized, is their possible use in the confirmatory
context of fitting individual differences. Explicitly, we begin with a collection of,
say, $N$ proximity matrices, $\mathbf{P}_{1}, \ldots, \mathbf{P}_{N}$, obtained from
$N$ separate sources, and through some weighting and averaging process, construct a
single aggregate proximity matrix, $\mathbf{P}_{A}$. On the basis of $\mathbf{P}_{A}$,
suppose a LUS or CUS structure is constructed; we label the latter the `common space'
consistent with what is usually done in the (weighted) Euclidean model in
multidimensional scaling. Each of the $N$ proximity matrices can then be used in a
confirmatory fitting of a LUS (with, say, \verb+linfitac.m+) or a CUS (with, say,
\verb+cirfitac.m+). A very general `subject/private space' is generated for each
source, and where the coordinates are unique to that source, subject only to the order
constraints of the group space.  In effect, we would be carrying out an individual
differences analysis by using a `deviation from the mean' philosophy. A group
structure is first identified in an exploratory manner from an aggregate proximity
matrix; the separate matrices that went into the aggregate are then fit in a
confirmatory way, one-by-one.  There does not seem to be any particular a priori
advantage in trying to carry out this process `all at once'; to the contrary, the
simplicity of the deviation approach and its immediate generalizability to a variety
of possible structural representations, holds out the hope of greater substantive
interpretability.


\subsection{Incorporating Transformations of the Proximities}


In the use of either a one- or two-mode proximity matrix, the data were assumed `as
is', and without any preliminary transformation. It was noted that some analyses
leading to negative values might be more pleasingly interpretable if an additive
constant could be fitted along with the LUS or CUS structures. In other words, the
structures fit to proximity matrices then have an invariance with respect to linear
transformations of the proximities. A more general transformation will be discussed
briefly in a later section where a centroid (metric), fit as part of the whole
representational structure, has the effect of double-centering (i.e., making the rows
and columns sum to zero). Considering the input proximity matrix deviated from the
centroid, zero sums are present within rows or columns.  The analysis methods could
iterate between fitting a LUS or CUS structure and a centroid, attempting to squeeze
out every last bit of VAF. Maybe a more direct strategy (and one that would most
likely not affect substantive interpretations materially) would be to initially
double-center (either a one- or two-mode matrix), and then treat the later to the
analyses we wish to carry out, without again revisiting the double-centering operation
during the iterative process.

\smallskip

A more serious consideration of proximity transformation would involve monotonic
functions of the type familiar in nonmetric multidimensional scaling.  We provide two
utilities, \verb+proxmon.m+ and \verb+proxmontm.m+, that will allow the user a chance
to experiment with these more general transformations for both one- and two-mode
proximity matrices (as we did briefly in Section 3.2).  The usage is similar for both
M-files in providing a monotonically transformed proximity matrix that is closest in a
least-squares sense to a given (usually the structurally fitted) matrix:
\begin{verbatim}
[monproxpermut,vaf,diff] = proxmon(proxpermut,fitted)

[monproxpermuttm,vaf,diff] = proxmontm(proxpermuttm,fittedtm)
\end{verbatim}
\noindent Here, \verb+proxpermut+ (\verb+proxpermuttm+) is the input proximity matrix
(which may have been subjected to an initial row/column permutation, hence the suffix
\verb+permut+), and \verb+fitted+ (\verb+fittedtm+) is a given target matrix
(typically the representational matrix such as the identified ultrametric); the output
matrix, \verb+monproxpermut+ (\verb+monproxpermuttm+), is closest to \verb+fitted+
(\verb+fittedtm+) in a least-squares sense and obeys the order constraints obtained
from each pair of entries in (the upper-triangular portion of) \verb+proxpermut+ or
\verb+proxpermuttm+.  As usual, \verb+vaf+ denotes `variance-accounted-for' but here
indicates how much variance in \verb+monproxpermut+ (\verb+monproxpermuttm+) can be
accounted for by \verb+fitted+ (\verb+fittedtm+); finally, \verb+diff+ is the value of
the least-squares loss function and is one-half the squared differences between the
entries in \verb+fitted+ (\verb+fittedtm+) and \verb+monproxpermut+
(\verb+monproxpermuttm+).


\subsection{Finding and Fitting Best LUS Structures in the Presence of Missing Proximities}


The various M-files discussed thus far have required proximity matrices to be complete
in the sense of having all entries present. This was true even for the two-mode case
where the between-set proximities are assumed available although all within-set
proximities were not.  Two different M-files are mentioned here (analogues of
\verb+order.m+ and \verb+linfitac.m+) allowing some of the proximities in a symmetric
matrix to be absent.  The missing proximities are identified in an input matrix,
\verb+proxmiss+, having the same size as the input proximity matrix, \verb+prox+, but
otherwise the syntaxes are the same as earlier:
\begin{verbatim}
[outperm,rawindex,allperms,index] = ...
order_missing(prox,targ,inperm,kblock,proxmiss)

[fit,vaf,addcon] = linfitac_missing(prox,inperm,proxmiss)
\end{verbatim}
\noindent The \verb+proxmiss+ matrix guides the search and fitting process so the
missing data are ignored whenever they should be considered in some kind of
comparison.  Typically, there will be enough other data available that this really
doesn't pose any difficulty.

\smallskip



\begin{table}

\begin{center}

\begin{tabular}{r|cccccccccc}

 & St & So & Br & Gi & Oc & Ke & Ro & Sc & Al & Th \\ \hline

1 St & .00 & .28 & .32 & .31 & .43 & .62 & .74 & .70 & .87 &  .76  \\

2 So & .28 & .00 & .17 & .36 & .14 & .50 & .61 & .64 & .64  &  .75  \\

3 Br & .32 & .17 & .00 & .36 & .29 & .57 & .56 & .59 & .65  &  .70  \\

4 Gi & .31 & .36 & .36 & .00 & .43 & .47 & .52 & .61 & .59  &  .72  \\

5 Oc & .43 & .14 & .29 & .43 & .00 & .43 & .33 & .29 & * &  .43  \\

6 Ke & .62 & .50 & .57 & .47 & .43 & .00 & .29 & .35 & .13 & .41   \\

7 Ro & .74 & .61 & .56 & .52 & .33 & .29 & .00 & .12 & .09 &  .18   \\

8 Sc & .70 & .64 & .59 & .61 & .29 & .35 & .12 & .00 & .22 & .16   \\

9 Al & .87 & .64 & .65 & .59 & * & .13 & .09 & .22 & .00  & .17   \\

10 Th & .76 & .75 & .70 & .72 & .43 & .41 & .18 & .16 & .17 &  .00   \\

\end{tabular}

\end{center}

\caption{Dissimilarities Among Ten Supreme Court Justices for the 2005/6 Term.  The
Missing Entry Between O'Connor and Alito is Represented With an Asterisk.}


\end{table}

As an illustration of the M-files just introduced, Table 4 provides data on the ten
supreme court justices present at some point during the 2005/6 term, and the
percentage of times justices disagreed in non-unanimous decisions during the year.
(These data were in the \emph{New York Times} on July 2, 2006, as part of a
`first-page, above-the-fold' article bylined by Linda Greenhouse entitled `Roberts Is
at Court's Helm, But He Isn't Yet in Control'.) There is a single missing value in the
table between O'Connor (Oc) and Alito (Al) because they shared a common seat for the
term until Alito's confirmation by Congress. Roberts (Ro) served the full year as
Chief Justice so no missing data entries involve him. As can be seen in the verbatim
output to follow, an empirically obtained ordering (presumably from `left' to `right')
using \verb+order_missing.m+ is

\smallskip

1:St $\succ$  4:Gi  $\succ$  3:Br  $\succ$ 2:So  $\succ$ 5:Oc $\succ$ 6:Ke $\succ$
7:Ro  $\succ$ 8:Sc  $\succ$ 9:Al  $\succ$ 10:Th

\smallskip

\noindent suggesting rather strongly that Kennedy will most likely now occupy the
middle position (although possibly shifted somewhat to the right) once O'Connor is
removed from the court's deliberations.  The best-fitting LUS structure obtained with
\verb+linfitac_missing.m+ has VAF of 86.78\%, and is given in Table 5 plotted with
\verb+linearplot+.  Notice that because of the missing values in \verb+fit+, the
coordinates were entered `by hand' in the vector \verb+coord+ before plotted with
\verb+linearplot+.


\normalsize
\begin{verbatim}
>> load supreme_agree_2005_6.dat
>> load supreme_agree_2005_6_missing.dat
>> supreme_agree_2005_6

supreme_agree_2005_6 =

         0    0.2800    0.3200    0.3100    0.4300    0.6200    0.7400    0.7000    0.8700    0.7600
    0.2800         0    0.1700    0.3600    0.1400    0.5000    0.6100    0.6400    0.6400    0.7500
    0.3200    0.1700         0    0.3600    0.2900    0.5700    0.5600    0.5900    0.6500    0.7000
    0.3100    0.3600    0.3600         0    0.4300    0.4700    0.5200    0.6100    0.5900    0.7200
    0.4300    0.1400    0.2900    0.4300         0    0.4300    0.3300    0.2900         0    0.4300
    0.6200    0.5000    0.5700    0.4700    0.4300         0    0.2900    0.3500    0.1300    0.4100
    0.7400    0.6100    0.5600    0.5200    0.3300    0.2900         0    0.1200    0.0900    0.1800
    0.7000    0.6400    0.5900    0.6100    0.2900    0.3500    0.1200         0    0.2200    0.1600
    0.8700    0.6400    0.6500    0.5900         0    0.1300    0.0900    0.2200         0    0.1700
    0.7600    0.7500    0.7000    0.7200    0.4300    0.4100    0.1800    0.1600    0.1700         0

>> supreme_agree_2005_6_missing

supreme_agree_2005_6_missing =

     0     1     1     1     1     1     1     1     1     1
     1     0     1     1     1     1     1     1     1     1
     1     1     0     1     1     1     1     1     1     1
     1     1     1     0     1     1     1     1     1     1
     1     1     1     1     0     1     1     1     0     1
     1     1     1     1     1     0     1     1     1     1
     1     1     1     1     1     1     0     1     1     1
     1     1     1     1     1     1     1     0     1     1
     1     1     1     1     0     1     1     1     0     1
     1     1     1     1     1     1     1     1     1     0

>> [outperm,rawindex,allperms,index] = ...
order_missing(supreme_agree_2005_6,targlin(10),randperm(10),3,supreme_agree_2005_6_missing);
>> outperm

outperm =

     1     4     3     2     5     6     7     8     9    10

>> [fit, vaf, addcon] = linfitac_missing(supreme_agree_2005_6,outperm,supreme_agree_2005_6_missing)

fit =

         0    0.0967    0.1553    0.1620    0.3146    0.4873    0.5783    0.5783    0.5983    0.6490
    0.0967         0    0.0587    0.0653    0.2179    0.3906    0.4816    0.4816    0.5017    0.5523
    0.1553    0.0587         0    0.0067    0.1593    0.3320    0.4230    0.4230    0.4430    0.4936
    0.1620    0.0653    0.0067         0    0.1526    0.3253    0.4163    0.4163    0.4363    0.4870
    0.3146    0.2179    0.1593    0.1526         0    0.1727    0.2637    0.2637   -0.1567    0.3343
    0.4873    0.3906    0.3320    0.3253    0.1727         0    0.0910    0.0910    0.1110    0.1616
    0.5783    0.4816    0.4230    0.4163    0.2637    0.0910         0         0    0.0200    0.0707
    0.5783    0.4816    0.4230    0.4163    0.2637    0.0910         0         0    0.0200    0.0707
    0.5983    0.5017    0.4430    0.4363   -0.1567    0.1110    0.0200    0.0200         0    0.0506
    0.6490    0.5523    0.4936    0.4870    0.3343    0.1616    0.0707    0.0707    0.0506         0


vaf =

    0.8678

addcon =

   -0.1567

>> coord = [.0000,.0967,.1553,.1620,.3146,.4873,.5783,.5783,.5983,.6490]

coord =

         0    0.0967    0.1553    0.1620    0.3146    0.4873    0.5783    0.5783    0.5983    0.6490

>> inperm = [1 4 3 2 5 6 7 8 9 10]

inperm =

     1     4     3     2     5     6     7     8     9    10

>> [linearlength] = linearplot(coord,inperm)

linearlength =

    0.6490
\end{verbatim}

\large

\begin{flushleft}
\begin{figure}[!h]

\hfil\scalebox{.75}{\includegraphics{sc_linear_plot_missing.eps}}\hfil

\caption{The LUS Representation for the supreme\_agree\_2005\_6 Proximities Using
linearplot.m with the Coordinates Constructed from linfitac\_missing.m.}

\end{figure}
\end{flushleft}




\subsection{Obtaining Good Object Orders Through a Dynamic Programming
Strategy}

We have relied on the QA optimization formulation (as in \verb+uniscalqa.m+) to obtain
a basic LUS representation (or when necessary, a constraining order). Usually, this
usage is sufficient to generate a very good object ordering, especially when the
routine is initiated a number of times randomly and the best local optimum chosen. In
those instances in which one may wish to explore further the adequacy of a particular
ordering in terms of the best achievable (possibly when the proximity matrix is rather
large), the M-file, \verb+class_scaledp.m+, is made available.  Here, it is possible
to form given classes of the object set $S$ to be sequenced (or possibly, to delete
some of the objects from consideration altogether),   and use a dynamic programming
(DP) strategy guaranteeing global optimality for the constructed ordering of the
classes. The optimization criterion is the same as in Section 2 (i.e., $\sum_{i}
(t_{i}^{\rho})^{2}$), but now the index is taken over the number of object classes
formed.  Given the limitations on storage demanded by the implemented DP recursion,
the method is limited to, say, twenty or fewer object classes.

\smallskip

The syntax for this optimization strategy is
\begin{verbatim}
[permut,cumobfun] = class_scaledp(prox,numbclass,membclass)
\end{verbatim}

\noindent Here, \verb+prox+ (as usual) is the $n \times n$ input proximity matrix with
a dissimilarity interpretation; \verb+numbclass+ is the number of object classes to be
sequenced; \verb+membclass+ is an $n \times 1$ vector containing the input class
membership and includes all the integers from 1 to \verb+numbclass+, with zeros when
objects are to be deleted from consideration.  The output vectors are \verb+permut+
(the order of the classes in the optimal permutation), and \verb+cumobfun+ (the
cumulative values of the objective function for the successive placements of the
objects in the optimal permutation).

\smallskip

In the example below on \verb+supreme_agree+, the number of classes is chosen to be
nine, the same as the number of objects; the classes are numbered 1 to 9 just like the
original objects, so the \verb+membclass+ vector is merely \verb+[1 2 3 4 5 6 7 8 9]+.
What can be inferred from the identity permutation being found for \verb+permut+ is
that we have been using the globally optimum result throughout.


\normalsize
\begin{verbatim}
>> load supreme_agree.dat
>> [permut,cumobfun] = class_scaledp(supreme_agree,9,[1 2 3 4 5 6 7 8 9])

permut =

     1
     2
     3
     4
     5
     6
     7
     8
     9


cumobfun =

   23.6196
   34.1821
   41.3110
   45.4319
   45.7455
   47.8480
   53.1841
   69.4250
   89.3166
\end{verbatim}

\large

\subsection{Extending LUS and CUS Representations Through Additively Imposed Centroid
Matrices}

In the companion Toolbox on Cluster Analysis mentioned earlier, the notion of a matrix
representing an additive tree was introduced and characterized by a certain four-point
condition that its entries must satisfy.
 Alternatively, it was noted that any such matrix
 could be represented (in many ways) as a sum of two matrices,
 say $\mathbf{U} = \{u_{ij}\}$ and $\mathbf{C} = \{c_{ij}\}$,
 where $\mathbf{U}$ is an ultrametric matrix (and whose entries satisfy
 a certain three-point condition), and $c_{ij} = g_{i} + g_{j}$ for $1 \le i \ne j \le n$,
 and $c_{ii} = 0$ for $1 \le i \le n$, based on some set of values, $g_{1}, \ldots, g_{n}$.
   We will call $\mathbf{C}$ a centroid metric, for convenience (and will continue to do so even though some entries
   in $\mathbf{C}$ may be negative because of possible negative values for $g_{1}, \ldots, g_{n}$).

 \smallskip

 Computationally, one can construct a best-fitting additive tree matrix by using
 the sum of an ultrametric and centroid metric, and (through residualization) carry out an iterative fitting strategy using
the two structures.  As noted earlier, this would try to
  squeeze out every last bit of VAF we could.  The same type of approach could be implemented
  with a replacement of the ultrametric structure by one based on LUS (or CUS).
   Whether all of this iterative fitting is really worth it from a substantive interpretation perspective,
   is questionable.  A simpler alternative would be to merely fit best centroid
   metrics to either the given one- or two-mode proximity matrix; residualize the
    matrix from the centroid structure; and then treat the residual matrix to whatever
     representation device one would wish.  The syntax for the two centroid fitting M-files
     is as follows (both implement closed-form expressions for the least-squares solutions):
 \begin{verbatim}
[fit,vaf,lengths] = centfit(prox)

[fit,vaf,lengths] = centfittm(proxtm)
 \end{verbatim}
\noindent In both cases, \verb+fit+ is the least-squares approximation matrix with VAF given by \verb+vaf+.
 For \verb+centfit.m+, the $n$ values defining the centroid metric are given in \verb+lengths+;
 in \verb+centfittm.m+, the row values are followed by the column values for the defining centroid metric.

\smallskip

As examples in the output below on \verb+supreme_agree+ and \verb+supreme_agree5x4+,
the residual matrix from the best-fitting centroid is subjected to a LUS.
 One can still see in the results most of the previously given interpretations.
  We might note that in the process of residualization, the matrices so
 produced sum to zero within each row or column, so we have effectively
 double-centered the matrices by the residualization process.

\normalsize
\begin{verbatim}
>> load supreme_agree.dat
>> load supreme_agree5x4.dat
>> [fit,vaf,lengths] = centfit(supreme_agree)

fit =

         0    0.6186    0.6043    0.5871    0.5657    0.5557    0.5643    0.6814    0.6829
    0.6186         0    0.4829    0.4657    0.4443    0.4343    0.4429    0.5600    0.5614
    0.6043    0.4829         0    0.4514    0.4300    0.4200    0.4286    0.5457    0.5471
    0.5871    0.4657    0.4514         0    0.4129    0.4029    0.4114    0.5286    0.5300
    0.5657    0.4443    0.4300    0.4129         0    0.3814    0.3900    0.5071    0.5086
    0.5557    0.4343    0.4200    0.4029    0.3814         0    0.3800    0.4971    0.4986
    0.5643    0.4429    0.4286    0.4114    0.3900    0.3800         0    0.5057    0.5071
    0.6814    0.5600    0.5457    0.5286    0.5071    0.4971    0.5057         0    0.6243
    0.6829    0.5614    0.5471    0.5300    0.5086    0.4986    0.5071    0.6243         0


vaf =

    0.1908


lengths =

    0.3700    0.2486    0.2343    0.2171    0.1957    0.1857    0.1943    0.3114    0.3129

>> residual_supreme_agree = supreme_agree - fit

residual_supreme_agree =

         0   -0.2386   -0.2643   -0.2171    0.1043    0.0843    0.1857    0.1786    0.1671
   -0.2386         0   -0.2029   -0.1757    0.0057    0.0957    0.1271    0.1900    0.1986
   -0.2643   -0.2029         0   -0.2314    0.1000    0.0900    0.1414    0.1743    0.1929
   -0.2171   -0.1757   -0.2314         0    0.0371    0.0971    0.1486    0.1614    0.1800
    0.1043    0.0057    0.1000    0.0371         0   -0.0514   -0.1000   -0.0471   -0.0486
    0.0843    0.0957    0.0900    0.0971   -0.0514         0   -0.1500   -0.0771   -0.0886
    0.1857    0.1271    0.1414    0.1486   -0.1000   -0.1500         0   -0.1657   -0.1871
    0.1786    0.1900    0.1743    0.1614   -0.0471   -0.0771   -0.1657         0   -0.4143
    0.1671    0.1986    0.1929    0.1800   -0.0486   -0.0886   -0.1871   -0.4143         0

>> [fit,vaf,lengths] = centfittm(supreme_agree5x4)

fit =

    0.5455    0.5355    0.4975    0.5915
    0.4355    0.4255    0.3875    0.4815
    0.4255    0.4155    0.3775    0.4715
    0.4280    0.4180    0.3800    0.4740
    0.5255    0.5155    0.4775    0.5715


vaf =

    0.1090


lengths =

    0.3080
    0.1980
    0.1880
    0.1905
    0.2880
    0.2375
    0.2275
    0.1895
    0.2835

>> residual_supreme_agree5x4 = supreme_agree5x4 - fit

residual_supreme_agree5x4 =

   -0.2455   -0.1655    0.1425    0.2685
   -0.1555   -0.2055    0.1225    0.2385
    0.0245    0.0345   -0.0475   -0.0115
    0.1420    0.1420   -0.1500   -0.1340
    0.2345    0.1945   -0.0675   -0.3615

>> [outperm,rawindex,allperms,index] = order(residual_supreme_agree,targlin(9),randperm(9),3);
>> outperm

outperm =

     9     8     7     6     5     2     4     3     1

>> [fit,vaf,coord,addcon] = linfitac(residual_supreme_agree,outperm)

fit =

         0         0    0.0420    0.0999    0.1647    0.4064    0.4185    0.4226    0.4226
         0         0    0.0420    0.0999    0.1647    0.4064    0.4185    0.4226    0.4226
    0.0420    0.0420         0    0.0579    0.1227    0.3643    0.3765    0.3806    0.3806
    0.0999    0.0999    0.0579         0    0.0648    0.3065    0.3186    0.3227    0.3227
    0.1647    0.1647    0.1227    0.0648         0    0.2417    0.2538    0.2579    0.2579
    0.4064    0.4064    0.3643    0.3065    0.2417         0    0.0121    0.0162    0.0162
    0.4185    0.4185    0.3765    0.3186    0.2538    0.0121         0    0.0041    0.0041
    0.4226    0.4226    0.3806    0.3227    0.2579    0.0162    0.0041         0         0
    0.4226    0.4226    0.3806    0.3227    0.2579    0.0162    0.0041         0         0


vaf =

    0.9288


coord =

   -0.2196
   -0.2196
   -0.1776
   -0.1198
   -0.0549
    0.1867
    0.1989
    0.2030
    0.2030


addcon =

    0.2232


>> [outperm,rawindex,allperms,index,squareprox] = ordertm(residual_supreme_agree5x4,targlin(9),randperm(9),3);
>> outperm
outperm =

     6     1     7     2     3     8     4     5     9

>> [fit,vaf,rowperm,colperm,addcon,coord] = linfittmac(residual_supreme_agree5x4,outperm)

fit =

         0    0.0000    0.3363    0.4452
    0.0000         0    0.3363    0.4452
    0.2249    0.2249    0.1114    0.2204
    0.3671    0.3671    0.0308    0.0782
    0.4452    0.4452    0.1089         0


vaf =

    0.9394


rowperm =

     1
     2
     3
     4
     5


colperm =

     1
     2
     3
     4


addcon =

    0.2094


coord =

         0
         0
    0.0000
    0.0000
    0.2249
    0.3363
    0.3671
    0.4452
    0.4452
\end{verbatim}

\large

The two M-files, \verb+cent_linearfit.m+ and \verb+cent_linearfnd.m+, illustrated
below are of the `squeezing as much VAF as possible' variety for the sum of a centroid
and a LUS model for a symmetric proximity matrix.
 The M-files differ in that \verb+cent_linearfnd.m+ finds a best order to use for the LUS component;
  \verb+cent_linearfit.m+ allows one to be imposed.  The syntax for the two files are:
\begin{verbatim}
[find,vaf,outperm,targone,targtwo,lengthsone,coordtwo, ...
  addcontwo] = cent_linearfnd(prox,inperm)

[find,vaf,outperm,targone,targtwo,lengthsone,coordtwo, ...
  addcontwo] = cent_linearfit(prox,inperm)
\end{verbatim}
\noindent Here, \verb+prox+ is obviously the input dissimilarity matrix; \verb+inperm+
is the given constraining order in \verb+cent_linearfit.m+, and the beginning input
order (possibly random) for \verb+cent_linearfnd.m+.  For output, \verb+find+ is the
found least-squares approximation of \verb+prox+ with VAF of \verb+vaf+; the found or
given constraining order is \verb+outperm+; \verb+targtwo+ is the linear
unidimensional scaling component of the decomposition defined by the  coordinates in
\verb+coordtwo+ with additive constant \verb+addcontwo+.



\normalsize
\begin{verbatim}

>> [find,vaf,outperm,targone,targtwo,lengthsone,coordtwo,addcontwo] = cent_linearfnd(supreme_agree,randperm(9))

find =

         0    0.2109    0.3292    0.4051    0.4736    0.7295    0.7064    0.8659    0.7302
    0.2109         0    0.3307    0.4065    0.4750    0.7309    0.7078    0.8673    0.7317
    0.3292    0.3307         0    0.2483    0.3168    0.5727    0.5496    0.7091    0.5734
    0.4051    0.4065    0.2483         0    0.2745    0.5303    0.5072    0.6668    0.5311
    0.4736    0.4750    0.3168    0.2745         0    0.4965    0.4734    0.6329    0.4972
    0.7295    0.7309    0.5727    0.5303    0.4965         0    0.2555    0.4150    0.2794
    0.7064    0.7078    0.5496    0.5072    0.4734    0.2555         0    0.3628    0.2271
    0.8659    0.8673    0.7091    0.6668    0.6329    0.4150    0.3628         0    0.3398
    0.7302    0.7317    0.5734    0.5311    0.4972    0.2794    0.2271    0.3398         0


vaf =

    0.9856


outperm =

     8     9     7     6     5     2     4     1     3


targone =

         0    0.4720    0.4520    0.4688    0.4861    0.5051    0.4674    0.6035    0.4619
    0.4720         0    0.4535    0.4702    0.4875    0.5066    0.4689    0.6050    0.4633
    0.4520    0.4535         0    0.4503    0.4676    0.4866    0.4489    0.5850    0.4434
    0.4688    0.4702    0.4503         0    0.4844    0.5034    0.4657    0.6018    0.4601
    0.4861    0.4875    0.4676    0.4844         0    0.5207    0.4830    0.6191    0.4775
    0.5051    0.5066    0.4866    0.5034    0.5207         0    0.5020    0.6381    0.4965
    0.4674    0.4689    0.4489    0.4657    0.4830    0.5020         0    0.6004    0.4588
    0.6035    0.6050    0.5850    0.6018    0.6191    0.6381    0.6004         0    0.5949
    0.4619    0.4633    0.4434    0.4601    0.4775    0.4965    0.4588    0.5949         0


targtwo =

         0         0    0.1383    0.1974    0.2486    0.4855    0.5000    0.5235    0.5295
         0         0    0.1383    0.1974    0.2486    0.4855    0.5000    0.5235    0.5295
    0.1383    0.1383         0    0.0591    0.1103    0.3472    0.3617    0.3852    0.3912
    0.1974    0.1974    0.0591         0    0.0512    0.2881    0.3026    0.3261    0.3321
    0.2486    0.2486    0.1103    0.0512         0    0.2369    0.2514    0.2749    0.2809
    0.4855    0.4855    0.3472    0.2881    0.2369         0    0.0146    0.0380    0.0440
    0.5000    0.5000    0.3617    0.3026    0.2514    0.0146         0    0.0234    0.0294
    0.5235    0.5235    0.3852    0.3261    0.2749    0.0380    0.0234         0    0.0060
    0.5295    0.5295    0.3912    0.3321    0.2809    0.0440    0.0294    0.0060         0


lengthsone =

    0.2353    0.2367    0.2168    0.2335    0.2508    0.2699    0.2322    0.3683    0.2266


coordtwo =

   -0.2914
   -0.2914
   -0.1531
   -0.0940
   -0.0428
    0.1940
    0.2086
    0.2321
    0.2380


addcontwo =

    0.2611
\end{verbatim}


\large


\normalsize

\begin{verbatim}
>> [find,vaf,outperm,targone,targtwo,lengthsone,coordtwo,addcontwo] = ...
   cent_linearfit(supreme_agree,[1 2 3 4 5 6 7 8 9])

find =

         0    0.3798    0.3707    0.3793    0.6305    0.6644    0.7067    0.8635    0.8650
    0.3798         0    0.2492    0.2578    0.5090    0.5429    0.5852    0.7420    0.7435
    0.3707    0.2492         0    0.2427    0.4939    0.5278    0.5701    0.7269    0.7284
    0.3793    0.2578    0.2427         0    0.4665    0.5003    0.5427    0.6995    0.7009
    0.6305    0.5090    0.4939    0.4665         0    0.2745    0.3168    0.4736    0.4750
    0.6644    0.5429    0.5278    0.5003    0.2745         0    0.2483    0.4051    0.4065
    0.7067    0.5852    0.5701    0.5427    0.3168    0.2483         0    0.3292    0.3307
    0.8635    0.7420    0.7269    0.6995    0.4736    0.4051    0.3292         0    0.2109
    0.8650    0.7435    0.7284    0.7009    0.4750    0.4065    0.3307    0.2109         0


vaf =

    0.9841


outperm =

     1     2     3     4     5     6     7     8     9


targone =

         0    0.6241    0.6120    0.6026    0.6153    0.5980    0.5812    0.5997    0.6012
    0.6241         0    0.5035    0.4941    0.5068    0.4895    0.4727    0.4913    0.4927
    0.6120    0.5035         0    0.4821    0.4947    0.4774    0.4606    0.4792    0.4806
    0.6026    0.4941    0.4821         0    0.4853    0.4680    0.4512    0.4698    0.4712
    0.6153    0.5068    0.4947    0.4853         0    0.4806    0.4639    0.4824    0.4838
    0.5980    0.4895    0.4774    0.4680    0.4806         0    0.4466    0.4651    0.4665
    0.5812    0.4727    0.4606    0.4512    0.4639    0.4466         0    0.4483    0.4498
    0.5997    0.4913    0.4792    0.4698    0.4824    0.4651    0.4483         0    0.4683
    0.6012    0.4927    0.4806    0.4712    0.4838    0.4665    0.4498    0.4683         0


targtwo =

         0    0.0130    0.0160    0.0341    0.2726    0.3238    0.3829    0.5212    0.5212
    0.0130         0    0.0030    0.0211    0.2596    0.3108    0.3699    0.5082    0.5082
    0.0160    0.0030         0    0.0180    0.2566    0.3078    0.3669    0.5051    0.5051
    0.0341    0.0211    0.0180         0    0.2385    0.2897    0.3488    0.4871    0.4871
    0.2726    0.2596    0.2566    0.2385         0    0.0512    0.1103    0.2486    0.2486
    0.3238    0.3108    0.3078    0.2897    0.0512         0    0.0591    0.1974    0.1974
    0.3829    0.3699    0.3669    0.3488    0.1103    0.0591         0    0.1383    0.1383
    0.5212    0.5082    0.5051    0.4871    0.2486    0.1974    0.1383         0         0
    0.5212    0.5082    0.5051    0.4871    0.2486    0.1974    0.1383         0         0


lengthsone =

    0.3663    0.2578    0.2457    0.2363    0.2490    0.2317    0.2149    0.2334    0.2349


coordtwo =

   -0.2316
   -0.2186
   -0.2156
   -0.1976
    0.0410
    0.0922
    0.1513
    0.2895
    0.2895


addcontwo =

    0.2574
\end{verbatim}


\large

\subsection{Fitting the LUS Model Through Partitions Consistent With a Given Object
Order}

To show there may be several ways to approach a particular (least-squares) fitting
task, a general M-file is available, \verb+partitionfit.m+, that provides a
least-squares approximation to a proximity matrix based on a given collection of
partitions.  In the syntax
\begin{verbatim}
[fitted,vaf,weights,end_condition] = partitionfit(prox,member)
\end{verbatim}
\noindent the input dissimilarity matrix is \verb+prox+; \verb+member+ is the $m
\times n$ matrix indicating cluster membership, where each row corresponds to a
specific partition (there are $m$ partitions in general); the columns of \verb+member+
are in the same input order used for \verb+prox+.  For output, \verb+fitted+ is an $n
\times n$ matrix approximating \verb+prox+ (through least-squares) constructed from
the nonnegative \verb+weights+ vector corresponding to the partitions.  The VAF value,
\verb+vaf+, is for the proximity matrix, \verb+prox+, compared to \verb+fitted+.  The
\verb+end_condition+ flag should be zero for a normal termination.

\smallskip

As an example below, the least-squares fitting of the identity permutation on
\verb+supreme_agree+ with \verb+linfitac.m+ is replicated with \verb+partitionfit.m+.
The central matrix is \verb+member+, where the first eight rows correspond to the
eight separations between the justices along the line (in the jargon of graph theory,
we have eight `cuts' of a graph, each defined by two disjoint [and exhaustive]
subsets, and characterized by a 0/1 dissimilarity matrix with 1's indicating objects
present across the two separate subsets).  The last row of \verb+member+ is the
disjoint partition representing an additive constant, and producing a single 0/1
dissimilarity matrix with all 1's in the off-diagonal positions.  Thus, to move from
one object to another along the continuum, the various `gaps' must be traversed
separating the two objects.  To construct the approximation, the weights attached to
the gaps are summed to produce the complete path; an additional additive constant is
then imposed. Because we are using nonnegative least-squares to obtain that weights
and the additive constant, an obtained zero value for the additive constant (i.e., we
have an estimation at the boundary) suggests the need to augment the original
proximities by a positive value before \verb+partitionfit.m+ is used.



\normalsize
\begin{verbatim}

>> load supreme_agree.dat
>> [fit,vaf,coord,addcon] = linfitac(supreme_agree,1:9)

fit =

         0    0.1304    0.1464    0.1691    0.4085    0.4589    0.5060    0.6483    0.6483
    0.1304         0    0.0160    0.0387    0.2780    0.3285    0.3756    0.5179    0.5179
    0.1464    0.0160         0    0.0227    0.2620    0.3124    0.3596    0.5019    0.5019
    0.1691    0.0387    0.0227         0    0.2393    0.2898    0.3369    0.4792    0.4792
    0.4085    0.2780    0.2620    0.2393         0    0.0504    0.0976    0.2399    0.2399
    0.4589    0.3285    0.3124    0.2898    0.0504         0    0.0471    0.1894    0.1894
    0.5060    0.3756    0.3596    0.3369    0.0976    0.0471         0    0.1423    0.1423
    0.6483    0.5179    0.5019    0.4792    0.2399    0.1894    0.1423         0         0
    0.6483    0.5179    0.5019    0.4792    0.2399    0.1894    0.1423         0         0


vaf =

    0.9796


coord =

   -0.3462
   -0.2158
   -0.1998
   -0.1771
    0.0622
    0.1127
    0.1598
    0.3021
    0.3021


addcon =

   -0.2180

>> member = [1 9 9 9 9 9 9 9 9;1 1 9 9 9 9 9 9 9;1 1 1 9 9 9 9 9 9;1 1 1 1 9 9 9 9 9;1 1 1 1 1 9 9 9 9;
1 1 1 1 1 1 9 9 9;1 1 1 1 1 1 1 9 9;1 1 1 1 1 1 1 1 9;1 2 3 4 5 6 7 8 9]

member =

     1     9     9     9     9     9     9     9     9
     1     1     9     9     9     9     9     9     9
     1     1     1     9     9     9     9     9     9
     1     1     1     1     9     9     9     9     9
     1     1     1     1     1     9     9     9     9
     1     1     1     1     1     1     9     9     9
     1     1     1     1     1     1     1     9     9
     1     1     1     1     1     1     1     1     9
     1     2     3     4     5     6     7     8     9

>> [fitted,vaf,weights,end_condition] = partitionfit(supreme_agree,member)

fitted =

         0    0.3485    0.3645    0.3871    0.6264    0.6769    0.7240    0.8663    0.8663
    0.3485         0    0.2340    0.2567    0.4960    0.5464    0.5936    0.7359    0.7359
    0.3645    0.2340         0    0.2407    0.4800    0.5305    0.5776    0.7199    0.7199
    0.3871    0.2567    0.2407         0    0.4574    0.5078    0.5549    0.6972    0.6972
    0.6264    0.4960    0.4800    0.4574         0    0.2685    0.3156    0.4579    0.4579
    0.6769    0.5464    0.5305    0.5078    0.2685         0    0.2651    0.4075    0.4075
    0.7240    0.5936    0.5776    0.5549    0.3156    0.2651         0    0.3603    0.3603
    0.8663    0.7359    0.7199    0.6972    0.4579    0.4075    0.3603         0    0.2180
    0.8663    0.7359    0.7199    0.6972    0.4579    0.4075    0.3603    0.2180         0


vaf =

    0.9796


weights =

    0.1304
    0.0160
    0.0227
    0.2393
    0.0504
    0.0471
    0.1423
         0
    0.2180


end_condition =

     0
\end{verbatim}


\large

In addition to \verb+partitionfit.m+, an M-file is available, \verb+partitionfit_addcon.m+, that fits an additive constrant without subjecting it to a nonnegativity constraint.  The syntax is similar to \verb+partitionfit.m+, but it has one additional output value, \verb+addcon+, representing the unrestricted additive constant:
\begin{verbatim}
[fitted,vaf,weights,addcon,end_condition] = ...
  partitionfit_addcon(prox,member)
\end{verbatim}
For two-mode matrices, there are the M-files, \verb+partitionfit_twomode.m+ and \verb+partitionfit_twomode_addcon.m+, with self-explanatory syntaxes:
\begin{verbatim}
[fitted,vaf,weights,end_condition] = ...
  partitionfit_twomode(proxtm,member)

[fitted,vaf,weights,addcon,end_condition] = ...
  partitionfit_twomode_addcon(proxtm,member)
\end{verbatim}

\subsection{Concave and Convex Monotonic (Isotonic) Regression}

This section gives four M-files that implement extensions to the monotonic regression task by imposing additional convexity and/or concavity restrictions on the regression function.  The basic optimization problem involves two $n \times 1$ vectors, say $\mathbf{x} = \{x_{i}\}$ (considered as an independent variable) and  $\mathbf{y} = \{y_{i}\}$ (considered as a dependent variable).  We wish to find an $n \times 1$ vector  $\hat{\mathbf{y}} = \{\hat{y}_{i}\}$, such that the least-squares criterion,
\[ \sum_{i=1}^{n} (y_{i} - \hat{y}_{i})^{2} \ , \]
\noindent is minimized, subject to $\hat{\mathbf{y}}$ satisfying some particular set of constraints.  For convenience, and without-loss-of-any-generality, assume the entries in $\mathbf{x}$ are indexed,  so: $x_{i} \le x_{i+1}$ for $i = 1,\ldots,n-1$.  (It is easier to specify the type of additional constraints we wish to impose if this initial ordering is assumed.  In the various M-files introduced below, the input arguments are $\mathbf{x}$ and $\mathbf{y}$, but no preliminary ordering of the values in $\mathbf{x}$ is needed (or assumed).)


\paragraph{Monotonic Regression}

(A) if $x_{i} < x_{i+1}$, for $i = 1,\ldots,n-1$, then $\hat{y}_{i} \le \hat{y}_{i+1}$;

\paragraph{Convex Monotonic Regression}

(B) in addition to Condition (A), if $x_{i-1} < x_{i} < x_{i+1}$, for $i = 2,\ldots,n-1$,

\[ \hat{y}_{i}  \le  ( \frac{x_{i+1} - x_{i}}{x_{i+1} - x_{i-1}}) \hat{y}_{i-1} + ( \frac{x_{i} - x_{i-1}}{x_{i+1} - x_{i-1}}) \hat{y}_{i+1} \ . \]

\noindent Condition (B) implies that the fitted value, $\hat{y}_{i}$, associated with $x_{i}$, lies at or below the line segment connecting $(x_{i-1},\hat{y}_{i-1})$  and $(x_{i+1},\hat{y}_{i+1})$.  Or, equivalently, the slope of the line segment connecting $(x_{i-1},\hat{y}_{i-1})$ and $(x_{i},\hat{y}_{i})$ is no greater than that connecting $(x_{i},\hat{y}_{i})$ and $(x_{i+1},\hat{y}_{i+1})$.

\paragraph{Concave Monotonic Regression}

(C) in addition to Condition (A), if $x_{i-1} < x_{i} < x_{i+1}$, for $i = 2,\ldots,n-1$,

\[ \hat{y}_{i}  \ge  ( \frac{x_{i+1} - x_{i}}{x_{i+1} - x_{i-1}}) \hat{y}_{i-1} + ( \frac{x_{i} - x_{i-1}}{x_{i+1} - x_{i-1}}) \hat{y}_{i+1} \ . \]

\noindent As can be seen, Condition (C) merely changes the sense of the inequality in (B), and implies that the fitted value, $\hat{y}_{i}$, associated with $x_{i}$, lies at or above the line segment connecting $(x_{i-1},\hat{y}_{i-1})$  and $(x_{i+1},\hat{y}_{i+1})$.  Or, equivalently, the slope of the line segment connecting $(x_{i-1},\hat{y}_{i-1})$ and $(x_{i},\hat{y}_{i})$ is no less than that connecting $(x_{i},\hat{y}_{i})$ and $(x_{i+1},\hat{y}_{i+1})$.

\paragraph{Convex-Concave Monotonic Regression}

To define Condition (D), a monotonic convex function is fit up to the median object (based on the assumed ordered objects in $\mathbf{x}$) and a concave monotonic function thereafter (so, an ``ogive-like'' shape is given).  Explicitly, an \verb+upper_limit+ is defined on the object triples considered in fitting convexity, and a \verb+lower_limit+ on the triples considered in fitting concavity.  For $n$ odd, \verb+upper_limit+ = $(n+3)/2$; \verb+lower_limit+ =  $(n-1)/2$; for $n$ even,  \verb+upper_limit+ = $(n/2) + 1$; \verb+lower_limit+ =  $n/2$.

\smallskip

The four M-files implementing these four fitting constraints have more or less the same syntax, and are named:

\bigskip

Condition (A): \verb+monotonic_regression_dykstra.m+

Condition (B): \verb+convex_monotonic_regression_dykstra.m+

Condition (C): \verb+concave_monotonic_regression_dykstra.m+

Condition (D): \verb+convex_concave_monotonic_regression_dykstra.m+

\bigskip

\noindent For example, syntax for \verb+convex_concave_monotonic_regression_dykstra.m+ is
\begin{verbatim}
[yhat,vaf_yhat] = convex_concave_monotonic_regression_dykstra(x,y)
\end{verbatim}
\noindent with the vector of values in \verb+YHAT+ weakly monotonic with respect to the values in the independent input vector \verb+X+ (which is \emph{not} necessarily ordered); defining a convex function up to the median observation in \verb+X+ and a concave function thereafter; and which minimizes the least-squares loss measure, $\sum_{i} (y_{i} - \hat{y}_{i})^{2}$.  The variance-accounted-for in \verb+Y+ from \verb+YHAT+ is given by \verb+VAF_YHAT+, and defined as
\[ 1 - \frac{\sum_{i=1}^{n} (y_{i} - \hat{y}_{i})^{2}}{\sum_{i=1}^{n} (y_{i} - \bar{y})^{2}} \ , \]
\noindent where $\bar{y}$ is the mean value in $\mathbf{y}$.

\smallskip

The least-squares optimization strategy implemented in the four M-files of this section are all based on an iterative projection strategy developed by Dykstra (1983).  The first routine dealing with monotonic regression per se, \verb+monotonic_regression_dykstra.m+, is a direct competitor to one that would implement a ``pool adjacent violators'' algorithm; the latter has been the standard strategy ever since implemented by Kruskal (1964a,b) in his approach to nonmetric multidimensional scaling.  For example, the MATLAB Statistical Toolbox has an M-file for nonmetric multidimensional scaling, \verb+mdscale.m+. that relies on a (private) function, \verb+lsqisotonic.m+, which is a least-squares isotonic regression strategy built on the ``pool adjacent violators'' method.  To see how one of the four M-files of this section would work in \verb+mdscale.m+, the call to \verb+lsqisotonic.m+ could be replaced by one of these.  In effect, we can easily implement a nonmetric multidimensional scaling routine that would allow constraints beyond monotonic to convex, concave, or a combination of convex and concave.  Generally, these further constraints seem to ``smooth'' out the monotonic regression function quite dramatically; this has been the goal of using monotonic splines in exactly this same context (e.g., see Ramsay, 1988).  In effect, we have solved with these mechanisms rather directly and without splines, one of the major problems identified by Shepard (1974) in the Psychometric Society Presidential Address:


\bigskip


\emph{The problem that remains, however, is to impose the desired condition of smoothness in some general and nonarbitrary way without having to specify a particular functional form --- such as the polynomial (which can become nonmonotonic) or the exponential (which is often too  restrictive).} (p.\ 398)

\subsection{The Dykstra-Kaczmarz Method for Solving Linear (In)equality Constrained Least-Squares Tasks}

The Dykstra-Kaczmarz (DK) method for solving (in)equality constrained least-squares tasks, can be characterized as a very general iterative projection strategy that considers each linear constraint successively (and repeatedly), until convergence.  It serves as \emph{the} method for all of our least-squares fitting necessities in this and the previous three Toolboxes in the series.  We first review very cryptically, in the next section below, the basic argument for the iterative strategy; this then serves as the template that must be specialized for a particular data analysis context and followed in detail.  For example, when fitting structures such as ultrametrics, additive trees, anti-Robinson forms, and the like, the fitting procedure reviewed is directly programmed into an M-file.  A second section discusses a general MATLAB M-file based on converting a Fortran subroutine from Wollan and Dykstra (1987).  This is a general optimization routine that can be used in the spirit of other such M-files from the Optimization Toolbox.  It is written very generally, and not for just one particular application (as we have done, for example, in fitting ultrametrics with the dedicated M-file, \verb+ultrafit.m+).  It accepts general arguments to define the constrained least-squares task, such as the characterizing constraint matrix, and produces a solution.  At times, a general implementation such as this may be problematic if, say, the constraint matrix is too enormous in size.  In these cases, there may be no other choice than to program the specific application without storing the constraint matrix.

\subsubsection{A Review of the DK Strategy}

The Kaczmarz (1937) method deals only with equality constraints; Dykstra's (1983) method  generalizes the  restrictions that can be handled by Kaczmarz's strategy to the use of inequality constraints.

\smallskip


Kaczmarz's method can be characterized as follows:

\smallskip

Given $\mathbf{A} = \{a_{ij}\}$ of order $m \times n$, $\mathbf{x}' = \{x_{1},\ldots,x_{n}\}$, $\mathbf{b}' = \{b_{1},\ldots,b_{m}\}$, and assuming the linear system $\mathbf{Ax} = \mathbf{b}$ is consistent, define the set $C_{i} = \{\mathbf{x}  \ | \ \sum_{j=1}^{n} a_{ij} x_{j} = b_{i}, 1 \leq j \leq n\}$, for $1 \leq i \leq m$.  The projection of any $n \times 1$ vector $\mathbf{y}$ onto $C_{i}$ is simply $\mathbf{y} - (\mathbf{a}_{i}' \mathbf{y} - b_{i}) \mathbf{a}_{i}(\mathbf{a}_{i}' \mathbf{a}_{i})^{-1}$, where $\mathbf{a}_{i}' = \{a_{i1},\ldots,a_{in}\}$.  Beginning with a vector $\mathbf{x}_{0}$, and successively projecting $\mathbf{x}_{0}$ onto $C_{1}$, and that result onto $C_{2}$, and so on, and cyclically and repeatedly reconsidering projections onto the sets $C_{1},\ldots,C_{m}$, leads at convergence to a vector $\mathbf{x}_{0}^{*}$ that is closest to $\mathbf{x}_{0}$ (in vector 2-norm, so that $\sum_{j=1}^{n} (x_{0j} - x_{0j}^{*})^{2}$ is minimized) and $\mathbf{Ax}_{0}^{*} = \mathbf{b}$.  In short, Kaczmarz's method iteratively solves least-squares tasks subject to equality restrictions.

\bigskip

Dykstra's method can be characterized as follows:

\smallskip

Given $\mathbf{A} = \{a_{ij}\}$ of order $m \times n$, $\mathbf{x}_{0}' = \{x_{01},\ldots,x_{0n}\}$, $\mathbf{b}' = \{b_{1},\ldots,b_{m}\}$, and $\mathbf{w}' = \{w_{1},\ldots,w_{n}\}$, where $w_{j} > 0$ for all $j$, find $\mathbf{x}_{0}^{*}$ such that $\mathbf{a}_{i}' \mathbf{x}_{0}^{*} \leq b_{i}$ for $1 \leq i \leq m$ and $\sum_{j=1}^{n} w_{j} (x_{0j} - x_{0j}^{*})^{2} $ is minimized.  Again, (re)define the (closed convex) sets $C_{i} = \{ \mathbf{x} \ | \ \sum_{j=1}^{n} a_{ij} x_{j} \leq b_{i}, 1 \leq j \leq n\}$ and when a vector $\mathbf{y} \notin C_{i}$, its projection onto $C_{i}$ (in the metric defined by the weight vector $\mathbf{w}$) is $\mathbf{y} - (\mathbf{a}_{i}' \mathbf{y} - b_{i})\mathbf{a}_{i}\mathbf{W}^{-1}(\mathbf{a}_{i}'\mathbf{W}^{-1}\mathbf{a}_{i})^{-1}$, where $\mathbf{W}^{-1} = \mathrm{diag} \{w_{1}^{-1},\ldots,w_{n}^{-1}\}$. We again initialize the process with the vector $\mathbf{x}_{0}$ and each set $C_{1},\ldots,C_{m}$ is considered in turn.  If the vector being carried forward to this point when $C_{i}$ is (re)considered does not satisfy the constraint defining $C_{i}$, a projection onto $C_{i}$ occurs.  The sets $C_{1},\ldots,C_{m}$ are cyclically and repeatedly considered but with one difference from the operation of Kaczmarz's method --- each time a constraint set $C_{i}$ is revisited, any changes from the previous time $C_{i}$ was reached are first ``added back''.  This last process ensures convergence to a (globally) optimal solution $\mathbf{x}_{0}^{*}$.


\subsubsection{A General M-file for Solving Linear Inequality Constrained Least-Squares Tasks}

The Fortran subroutine that we have rewritten into an M-file from Wollan and Dykstra (1987) is called \verb+least_squares_dykstra.m+, and is meant to find a solution to the following problem:

\bigskip

\noindent suppose $\mathbf{g}$ is a given $n \times 1$ vector (the ``dependent'' vector);  $\mathbf{S}$  a given $n \times n$ positive-definite matrix (thus, it has an inverse; it may, for example, be a variance-covariance matrix, in which case we are minimizing Mahalanobis distances in the formulation below); $\mathbf{A}$ is a known $m \times n$ matrix where each row of $\mathbf{A}$ defines one of $m$ constraints; $\mathbf{b}$ is a known $m \times 1$ vector giving the right-hand-sides of the inequality constraints.  The task: find an $n \times 1$ vector $\mathbf{x}$, subject to $\mathbf{A}\mathbf{x} \le \mathbf{b}$, to minimize
\begin{equation}
(\mathbf{g} - \mathbf{x})'\mathbf{S}^{-1}(\mathbf{g} - \mathbf{x}) \ .
\end{equation}
\noindent Commonly, $\mathbf{S}$ will be the identity, in which case we have unweighted least-squares; if $\mathbf{S}$ is diagonal, weighted least-squares is obtained.  We also note that in the actual application of the M-file, equality constraints can be enforced directly.

\smallskip

The syntax for the M-file, \verb+least_squares_dykstra.m+, is as follows:
\begin{verbatim}
 [solution,kuhn_tucker,iterations,end_condition] = ...
    least_squares_dykstra(data,covariance,constraint_array, ...
    constraint_constant,equality_flag)
\end{verbatim}
\noindent Here, the input arguments are an $n \times 1$ vector, \verb+DATA+; an $n \times n$  positive-definite matrix, \verb+COVARIANCE+; an $m \times n$ constraint matrix,  \verb+CONSTRAINT_ARRAY+; the $m \times 1$ right-hand-side constraint vector,  \verb+CONSTRAINT_CONSTANT+; and an $m \times 1$ \verb+EQUALITY_FLAG+ vector with  values of 0 when a corresponding constraint is an inequality, and 1 if  an equality.  The weighted least-squares criterion (with weights defined by the  inverse of \verb+COVARIANCE+) is minimized by a \verb+SOLUTION+ that satisfies
 \verb+CONSTRAINT_ARRAY * SOLUTION+ being in \verb+EQUALITY_FLAG+ relation to
 \verb+CONSTRAINT_CONSTANT+.  As additional output arguments, there is a $m
 \times 1$ \verb+KUHN_TUCKER+ vector (useful for some applications); the number
 of \verb+ITERATIONS+ taken (maximum default value is \verb+ITERMAX+ $= 1.0e+04$, set in  the program), and an \verb+END_CONDITION+ flag: 0: no error; 1: \verb+ITERMAX+
 exceeded; 2: invalid constant; 3: invalid constraint function.

 \subsubsection{A Few Applications of least\_squares\_dykstra.m}

 There are a few very useful application of \verb+least_squares_dykstra.m+ that we review briefly here:

 \smallskip

 (A) Consider the minimization of
 \begin{equation}
(\mathbf{g} - \mathbf{x})'\mathbf{S}^{-1}(\mathbf{g} - \mathbf{x}) \ ,
\end{equation}
\noindent subject to
\[ \mathbf{x} = \sum_{i=1}^{m} \alpha_{i} \mathbf{d}_{i}, \ \alpha_{i} \ge 0 \ \mathrm{for} \ 1 \le i \le m, \ \]
\noindent and the specified collection of $n \times 1$ vectors, $\mathbf{d}_{1},\ldots,\mathbf{d}_{k}$.  To use the general M-file for this task, define  the constraint array to be,
\[ \mathbf{A} = \left[ \begin{array}{c}
                        \mathbf{d}_{1}'\mathbf{S}^{-1} \\

                           \vdots  \\

                            \mathbf{d}_{m}'\mathbf{S}^{-1} \\ \end{array} \right] \ .\]
\noindent Letting $\mathbf{x}^{*}$ denote the solution of the original task in (17), the solution here is given by $\mathbf{g} -  \mathbf{x}^{*}$, with the $\alpha_{i}$'s being 1/2 the values in the Kuhn-Tucker vector.  We might note that these fitting ideas were implemented in the M-file, \verb+partitionfit.m+, used heavily in the Cluster Analysis Toolbox to generalize the notion of an ultrametric.

\smallskip

(B) Consider the usual linear model formulation: $\mathbf{y} = \mathbf{X}\mathbf{\mbox{\boldmath{$\beta$}}} + \mathbf{\epsilon}$, where $\mathbf{y}$ is the $n \times 1$ vector of observations, $\mathbf{X}$ an $n \times m$ full-rank design matrix, and $\mathbf{\epsilon}$ contains $n$ independent, $N(0,\sigma^{2})$, random variables.  If we wish to impose linear inequality constraints on the least-squares estimate of the $m \times 1$ vector $\mathbf{\mbox{\boldmath{$\beta$}}}$, say, $\mathbf{\hat{\mbox{\boldmath{$\beta$}}}}$: $\mathbf{A}\mathbf{\hat{\mbox{\boldmath{$\beta$}}}} \le \mathbf{b}$, in our original problem formulation in (18), we can let $\mathbf{S}^{-1} = \mathbf{X}'\mathbf{X}$, $\mathbf{g} = (\mathbf{X}'\mathbf{X})^{-1}\mathbf{X}'\mathbf{y}$, and use the given constraint array and vector, $\mathbf{A}$ and $\mathbf{b}$.

\smallskip

If we wish only nonnegativity of $\mathbf{\hat{\mbox{\boldmath{$\beta$}}}}$, then (18) can be used with $\mathbf{g} = \mathbf{y}$, $\mathbf{S} = \mathbf{I}$, and the $\mathbf{d}_{1}, \ldots, \mathbf{d}_{m}$ given by the $k$ columns of $\mathbf{X}$.  When halved, the minimizing $\alpha_{i}$'s provide the desired nonnegative estimate, $\mathbf{\hat{\mbox{\boldmath{$\beta$}}}} \ge \mathbf{0}$.

\subsection{The $L_{1}$ Fitting of Unidimensional Scales (with an Additive Constant)}

The linear unidimensional scaling task in the $L_{1}$ norm can be phrased as one of finding a set of coordinates, $x_{1}, \ldots, x_{n}$, such that the $L_{1}$ criterion,
\begin{equation}
 \sum_{i < j} |p_{ij} - (|x_{j} - x_{i}| - c)| \ ,
\end{equation}
is minimized, where we now immediately include the possibility of an additive constant in the model (in what follows, $c$ can just be set to 0 for the more elemental model without an additive constant).  As an alternative reformulation of the optimization task in (14) that will prove convenient as a point of departure in our development of computational routines (much as what we did within the $L_{2}$ norm), we subdivide (14) into the two separate problems of finding a set of $n$ numbers, $x_{1} \le \cdots \le x_{n}$, and a permutation on the first $n$ integers, $\rho(\cdot) \equiv \rho$, for which
\begin{equation}
 \sum_{i < j} |p_{\rho(i) \rho(j)} - ((x_{j} - x_{i}) - c)|
\end{equation}
is minimized.  Again, we can impose the additional constraint that $\sum_{i=1}^{n} x_{i} = 0$.

\smallskip

Assuming for now that the permutation $\rho$ is given, the task of finding $x_{1} \le \cdots \le x_{n}$ to minimize (15) is a linear programming problem.  Without loss of generality, we let $\rho$ be the identity permutation and first rewrite $ \sum_{i < j} |p_{ij} - (|x_{j} - x_{i}| - c)|$ as the loss criterion $\sum_{i < j} (z_{ij}^{+} + z_{ij}^{-})$, where
\[  z_{ij}^{+} = \frac{1}{2}\{|p_{ij} - (|x_{j} - x_{i}| - c)| - (p_{ij} - (|x_{j} - x_{i}| - c))\}; \]
\[  z_{ij}^{-} = \frac{1}{2}\{|p_{ij} - (|x_{j} - x_{i}| - c)| + (p_{ij} - (|x_{j} - x_{i}| - c))\}, \]
for $1 \le i < j \le n$.  The unknowns are $c$, $x_{1},\ldots,x_{n}$, and for $1 \le i < j \le n$, $z_{ij}^{+}$, $z_{ij}^{-}$, and $y_{ij}$ $( \equiv |x_{j} - x_{i}|)$.  The constraints of the linear program take the form:
\[ -z_{ij}^{+} + z_{ij}^{-} + y_{ij} - c = p_{ij}; \]
\[ -x_{j} + x_{i} + y_{ij} = 0; \]
\[ z_{ij}^{+} \ge 0, z_{ij}^{-} \ge 0, y_{ij} \ge 0, \]
for $1 \le i < j \le n$, and
\[ x_{1} + \cdots + x_{n} = 0. \]

\paragraph{The MATLAB Functions linfitl1.m and linfitl1ac.m}

Based on the linear programming reformulation just given for finding a set of ordered coordinates for a fixed object permutation, the M-functions, \verb+linfitl1.m+ and \verb+linfitl1ac.m+, where the latter includes an additive constant in the model and the former does not, serve to setup the relevant (constraint) matrices for the associated linear programming task; the actual linear programming optimization is carried out by invoking \verb+linprog.m+ from the MATLAB Optimization Toolbox.

\smallskip

The syntax for \verb+linfitl1.m+ is
\begin{verbatim}
[fit diff coord exitflag] = linfitl1(prox,inperm)
\end{verbatim}
where if we denote the given permutation as $\rho^{0}(\cdot)$ (\verb+INPERM+), we seek a set of coordinates $x_{1} \le \cdots \le x_{n}$ (\verb+COORD+) to minimize (at a value of \verb+DIFF+)
\[ \sum_{i < j} |p_{\rho^{0}(i) \rho^{0}(j)} - |x_{j} - x_{i}|| ;\]
\verb+FIT+ refers to the matrix $\{|x_{j} - x_{i}|\}$, and \verb+EXITFLAG+ describes the exit condition of the linear program optimization (greater than 0 for convergence; 0 denotes the maximum number of function evaluations or iterations was exceeded; less than 0 indicates a failure of convergence to a solution).  For using \verb+linfitl1ac.m+, the syntax is
\begin{verbatim}
 [fit dev coord addcon exitflag] = linfitl1ac(prox,inperm)
\end{verbatim}
Here, we minimize
\[ \sum_{i < j} |p_{\rho^{0}(i) \rho^{0}(j)} - (|x_{j} - x_{i}| - c)| \]
where $c$ is given by \verb+ADDCON+ and \verb+DEV+ refers to the deviance(-accounted-for) defined by the normalized $L_{1}$ loss value:
\[ \mbox{DEV} = 1 - \frac{\sum_{i < j} |p_{\rho^{0}(i) \rho^{0}(j)} - (|x_{j} - x_{i}| - c)|}{\sum_{i < j} |p_{ij} - p_{med}|}, \]
where $p_{med}$ is the median of the off-diagonal proximity values.

\smallskip

We illustrate the use of \verb+linfitl1.m+ and \verb+linfitl1ac.m+ on the \verb+number.dat+ proximity matrix using the identity permutation as the input object order.  To conserve space, the \verb+FIT+ matrices are not listed below.

\bigskip

\tiny

\begin{verbatim}
>> load number.dat
>> inperm = 1:10;
>> [fit diff coord exitflag] = linfitl1(number,inperm);
Optimization terminated successfully.
>> diff
diff =
    8.2120
>> coord'
ans =
  Columns 1 through 6
   -0.7260   -0.4780   -0.2205   -0.1320   -0.1046    0.0780
  Columns 7 through 10
    0.2005    0.4022    0.4022    0.5784
>> exitflag
exitflag =
     1
>> [fit dev coord addcon exitflag] = linfitl1ac(number,inperm);
Optimization terminated successfully.
>> dev
dev =
    0.4252
>> coord'
ans =
  Columns 1 through 6
   -0.3511   -0.1956   -0.1129   -0.0809   -0.0137    0.0466
  Columns 7 through 10
    0.0930    0.1643    0.2020    0.2482
>> addcon
addcon =
   -0.3458
>> exitflag
exitflag =
     1
\end{verbatim}

\large

\subsubsection{Iterative Linear Programming}

Given the availability of the two linear programming based M-functions (discussed in previously) for fitting given unidimensional scales defined by specific input object permutations, it is possible to embed these two routines in a search strategy for actually finding the (at least hopefully) best such permutations in the first place.  This embedding is analogous to adopting iterative quadratic  assignment in \verb+uniscalqa.m+ (as given in HAM2002) and attempting to locate good unidimensional scalings in the $L_{2}$ norm.  Here, we have an iterative use of linear programming in \verb+uniscallp.m+  and \verb+uniscallpac.m+ to identify the good unidimensional scales in the $L_{1}$ norm, without and with, respectively, an additive constant in the fitted model.  The usage syntax of both M-functions are as follows:
\begin{verbatim}
[outperm coord diff fit] = uniscallp(prox,inperm)
[outperm coord dev fit addcon] = uniscallpac(prox,inperm)
\end{verbatim}
Both M-functions begin with a given object ordering (\verb+INPERM+) and evaluate the effect of pairwise object interchanges on the current permutation carried forward to that point.  If an object interchange is identified that improves the $L_{1}$ loss value, that interchange is made and the changed permutation becomes the current one.  When no pairwise object interchange can reduce \verb+DIFF+ in \verb+uniscallp.m+, or increase \verb+DEV+ in \verb+uniscallpac.m+ over its current value, that ending permutation is provided as \verb+OUTPERM+ along with its coordinates (\verb+COORD+) and the matrix \verb+FIT+ (the absolute differences of the ordered coordinates).  In \verb+uniscallpac.m+, the additive constant (\verb+ADDCON+) is also given.

\smallskip

The numerical example that follows relies on \verb+number.dat+ to provide the proximity matrix, and initializes both the M-functions with the identity permutation (1:10).  From other random starts that we have tried in addition to this very rational starting permutation, the resulting scales we give below are (almost undoubtedly) $L_{1}$-norm optimal.  We might note that the (optimal) object orderings differ depending on whether or not an additive constant is included in the model.

\bigskip

\tiny

\begin{verbatim}
>> load number.dat
>> [outperm coord diff fit] = uniscallp(number,1:10);
>> outperm
outperm =
     1     2     3     5     4     9     7     6    10     8
>> coord'
ans =
  Columns 1 through 6
   -0.7129   -0.3762   -0.2451   -0.1861   -0.0302    0.1081
  Columns 7 through 10
    0.1838    0.2229    0.4798    0.5559
>> diff
diff =
    7.0430
>> [outperm coord dev fit addcon] = uniscallpac(number,1:10);
>> outperm
outperm =
     1     2     3     4     5     7     6     9    10     8
>> coord'
ans =
  Columns 1 through 6
   -0.3807   -0.1647   -0.1087   -0.0637    0.0143    0.0903
  Columns 7 through 10
    0.1113    0.1283    0.1573    0.2163
>> dev
dev =
    0.4479
>> addcon
addcon =
   -0.3120
\end{verbatim}

\bigskip

\large

Although the M-functions are provided to either fit or find the best unidimensional scalings in the $L_{1}$ norm, we do not suggest their routine use.  The finding of the best unidimensional scales in $L_{1}$ is extremely expensive computationally (given the use of the repetitive linear programming subtasks), and without any obvious advantage over $L_{2}$, it is not clear why the $L_{1}$ approach should be pursued.  This same set of conclusions exist as well for the $L_{1}$ finding and fitting of multidimensional unidimensional scales.  (We might also mention a possible issue with ill-conditioning for some uses of \verb+linfitl1.m+ and \verb+linfitl1ac.m+ if the simplex option is chosen [and not the default interior-point algorithm] for the optimization method implemented in \verb+linprog.m+ (from the Optimization Toolbox for MATLAB 6.5).  The end results appear generally to be fine, but the intermediate warnings in either the finding or fitting of these unidimensional scales within $L_{1}$ is disconcerting.  So the use of the default interior-point strategy is recommended whenever \verb+linprog.m+ is called.)



\subsubsection{The $L_{1}$ Finding and Fitting of Multiple Unidimensional Scales}

In analogy to the $L_{2}$ fitting of multiple unidimensional structures, the use of the $L_{1}$ norm can again be done by (repetitive) successive residualization, but now with a reliance on the M-function, \verb+linfitl1ac.m+, to fit each separate unidimensional structure with its additive constant.  The M-function, \verb+biscallp.m+, is a two-(or bi-)dimensional scaling strategy for the $L_{1}$ loss-function
\begin{equation}
\sum_{i < j} |p_{ij} - [|x_{j1} - x_{i1}| - c_{1}] - [|x_{j2} - x_{i2}| - c_{2}]| ,
\end{equation}
with syntax (and all variables) similar to \verb+biscalqa.m+, including a provision for the confirmatory fitting of two given input orders (by setting \verb+NOPT = 0+).

\smallskip

In the example given below, the two beginning permutations used were the ones identified with the $L_{2}$ norm.  Compared to the input permutations, there are no changes in the output permutations.  The final deviance-accounted-for (\verb+DEV+) of this solution is .6787.

\tiny

\bigskip

\begin{verbatim}
>>load number.dat
>>stannumber = proxstd(number,0.0);
>>nopt = 1;
>>inpermone = [1 2 3 4 5 6 7 9 8 10];
>>inpermtwo = [5 3 9 1 7 4 10 2 8 6];
>>[outpermone outpermtwo coordone coordtwo fitone fittwo ...
addconone addcontwo dev] = ...
biscallp(stannumber,inpermone,inpermtwo,nopt);
>> outpermone
outpermone =
     1     2     3     4     5     6     7     9     8    10
>> outpermtwo
outpermtwo =
     5     3     9     1     7     4    10     2     8     6
>> coordone'
ans =
  Columns 1 through 6
   -1.9927   -1.1377   -0.4443   -0.3343    0.0611    0.1170
  Columns 7 through 10
    0.4919    0.7986    1.1162    1.3243
>> coordtwo'
ans =
  Columns 1 through 6
   -0.9351   -0.9351   -0.8721   -0.1714   -0.0055    0.1462
  Columns 7 through 10
    0.1462    0.4965    0.8732    1.2571
>> addconone
addconone =
    1.2366
>> addcontwo
addcontwo =
    0.8781
>> dev
dev =
    0.6787
\end{verbatim}

\bigskip

\large

As noted earlier, in principle one can use the $L_{1}$ norm in city-block scaling, but given the increased computational expense of doing so with no apparent advantage over $L_{2}$, it is suggested that the use of $L_{1}$ generally be avoided in favor of $L_{2}$.

\subsection{The Confirmatory Fitting of Tied Coordinate Patterns in Bidimensional City-Block Scaling}



One of the options in the M-file, \verb+biscalqa.m+, allows the confirmatory fitting
of two given input permutations by setting the \verb+nopt+ switch to zero.  An
extension of this M-file to \verb+biscalqa_tied.m+ is presented here that further
allows the imposition of given patterns of tied coordinates along the two axes. Equal
integer values that are present in \verb+tiedcoordone+ and \verb+tiedcoordtwo+ impose
equal coordinate values in the optimization process.

\smallskip

We give two examples below of using \verb+biscalqa_tied.m+ on the Hampshire
proximities.  The first illustration does a confirmatory fitting of the two object
permutations that led to the best VAF identified earlier of .9499 and with no imposed
tied coordinates (so both \verb+tiedcoordone+ and \verb+tiedcoordtwo+ consist of the
integers from 1 to 27).  The exact same VAF is obtained in the confirmatory fit, but
interestingly, there are slight variations in the additive constants and the
coordinates at the level of the third or fourth decimal places.  So we have small
variations that apparently ``cancel'' and lead to the same best VAF as before.  The
second illustration imposes tied coordinates along both axes in groups of threes, so
\verb+tiedcoordone+ and \verb+tiedcoordtwo+ both have the pattern of
 \verb+[1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9]+.
 There is an expected drop in the VAF
to .8734 (but not too severe given the major reduction in model complexity).  The
resulting configuration of Hampshire towns with these tied coordinate structures
imposed is given in Figure 18.

\tiny

\begin{verbatim}
load hampshire_proximities.dat

inpermone = [2 6 12 19 22 1 11 4 5 23 21 18 3 27 20 24 17 10 25 9 26 13 8 16 7 15 14];
inpermtwo = [18 4 19 16 3 11 15 17 5 14 27 7 8 13 12 21 20 6 2 22 9 10 25 23 1 26 24];

[outpermone,outpermtwo,coordone,coordtwo,fitone,fittwo,addconone,addcontwo,vaf] = ...
    biscalqa_tied(hampshire_proximities,targlin(27),targlin(27),inpermone,inpermtwo,1:27,1:27,3,0)

tiedcoordone = [1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9];

 tiedcoordtwo = [1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8 9 9 9];

[outpermone,outpermtwo,coordone,coordtwo,fitone,fittwo,addconone,addcontwo,vaf] = ...
    biscalqa_tied(hampshire_proximities,targlin(27),targlin(27),inpermone,inpermtwo,...
    tiedcoordone,tiedcoordtwo,3,0)

    axes = zeros(27,2);

        for i = 1:27

            axes(outpermone(i),1) = coordone(i);
            axes(outpermtwo(i),2) = coordtwo(i);
        end

        plot(axes(1:27,1),axes(1:27,2),'ko')

        hold on

        for i = 1:27

            objectlabels{i,1} = int2str(i);

        end

        text(axes(1:27,1),axes(1:27,2),objectlabels,'fontsize',10,'verticalalignment','bottom')

\end{verbatim}

\begin{verbatim}
>> script_tied_coordinates_biscalqa

outpermone =

  Columns 1 through 26

     2     6    12    19    22     1    11     4     5    23    21    18     3    27    20    24    17    10    25     9    26    13     8    16     7    15

  Column 27

    14


outpermtwo =

  Columns 1 through 26

    18     4    19    16     3    11    15    17     5    14    27     7     8    13    12    21    20     6     2    22     9    10    25    23     1    26

  Column 27

    24


coordone =

  -18.7759
  -14.5533
  -13.3525
  -12.7337
  -10.7167
  -10.4930
   -9.1591
   -7.5284
   -6.3342
   -5.0568
   -4.5961
   -3.9200
   -0.5998
   -0.5998
    1.0959
    2.9431
    4.1361
    4.3892
    5.0837
    6.1704
    6.7689
    7.1508
   12.0935
   13.8611
   15.3806
   17.2922
   22.0538


coordtwo =

   -7.1706
   -5.9026
   -5.3941
   -4.9316
   -4.9034
   -4.3384
   -3.5486
   -3.5486
   -2.3517
   -2.1241
   -1.8610
   -0.8060
   -0.7654
   -0.6970
   -0.0768
    0.8199
    0.9487
    1.8872
    2.3601
    2.7219
    3.3431
    3.5634
    4.0580
    5.9584
    6.8936
    7.4461
    8.4196


fitone =

  Columns 1 through 15

         0    4.2226    5.4234    6.0422    8.0592    8.2830    9.6168   11.2475   12.4418   13.7191   14.1799   14.8559   18.1761   18.1761   19.8719
    4.2226         0    1.2008    1.8196    3.8366    4.0604    5.3942    7.0249    8.2192    9.4965    9.9573   10.6333   13.9535   13.9535   15.6493
    5.4234    1.2008         0    0.6188    2.6358    2.8595    4.1934    5.8241    7.0183    8.2957    8.7564    9.4325   12.7527   12.7527   14.4484
    6.0422    1.8196    0.6188         0    2.0170    2.2407    3.5746    5.2053    6.3995    7.6769    8.1376    8.8137   12.1339   12.1339   13.8296
    8.0592    3.8366    2.6358    2.0170         0    0.2237    1.5576    3.1883    4.3825    5.6599    6.1206    6.7967   10.1169   10.1169   11.8126
    8.2830    4.0604    2.8595    2.2407    0.2237         0    1.3339    2.9645    4.1588    5.4361    5.8969    6.5730    9.8932    9.8932   11.5889
    9.6168    5.3942    4.1934    3.5746    1.5576    1.3339         0    1.6307    2.8249    4.1023    4.5631    5.2391    8.5593    8.5593   10.2550
   11.2475    7.0249    5.8241    5.2053    3.1883    2.9645    1.6307         0    1.1943    2.4716    2.9324    3.6084    6.9286    6.9286    8.6243
   12.4418    8.2192    7.0183    6.3995    4.3825    4.1588    2.8249    1.1943         0    1.2773    1.7381    2.4142    5.7344    5.7344    7.4301
   13.7191    9.4965    8.2957    7.6769    5.6599    5.4361    4.1023    2.4716    1.2773         0    0.4608    1.1368    4.4570    4.4570    6.1527
   14.1799    9.9573    8.7564    8.1376    6.1206    5.8969    4.5631    2.9324    1.7381    0.4608         0    0.6761    3.9963    3.9963    5.6920
   14.8559   10.6333    9.4325    8.8137    6.7967    6.5730    5.2391    3.6084    2.4142    1.1368    0.6761         0    3.3202    3.3202    5.0159
   18.1761   13.9535   12.7527   12.1339   10.1169    9.8932    8.5593    6.9286    5.7344    4.4570    3.9963    3.3202         0         0    1.6957
   18.1761   13.9535   12.7527   12.1339   10.1169    9.8932    8.5593    6.9286    5.7344    4.4570    3.9963    3.3202         0         0    1.6957
   19.8719   15.6493   14.4484   13.8296   11.8126   11.5889   10.2550    8.6243    7.4301    6.1527    5.6920    5.0159    1.6957    1.6957         0
   21.7191   17.4965   16.2956   15.6768   13.6598   13.4361   12.1022   10.4715    9.2773    7.9999    7.5392    6.8631    3.5429    3.5429    1.8472
   22.9120   18.6894   17.4885   16.8697   14.8528   14.6290   13.2952   11.6645   10.4702    9.1929    8.7321    8.0560    4.7358    4.7358    3.0401
   23.1651   18.9425   17.7416   17.1228   15.1059   14.8821   13.5483   11.9176   10.7233    9.4460    8.9852    8.3091    4.9889    4.9889    3.2932
   23.8596   19.6370   18.4362   17.8173   15.8004   15.5766   14.2428   12.6121   11.4178   10.1405    9.6797    9.0036    5.6835    5.6835    3.9877
   24.9464   20.7238   19.5229   18.9041   16.8871   16.6634   15.3295   13.6989   12.5046   11.2273   10.7665   10.0904    6.7702    6.7702    5.0745
   25.5448   21.3222   20.1214   19.5026   17.4856   17.2618   15.9280   14.2973   13.1030   11.8257   11.3649   10.6889    7.3687    7.3687    5.6729
   25.9267   21.7041   20.5033   19.8845   17.8675   17.6438   16.3099   14.6792   13.4850   12.2076   11.7468   11.0708    7.7506    7.7506    6.0549
   30.8695   26.6469   25.4460   24.8272   22.8102   22.5865   21.2526   19.6219   18.4277   17.1503   16.6896   16.0135   12.6933   12.6933   10.9976
   32.6370   28.4144   27.2136   26.5948   24.5778   24.3540   23.0202   21.3895   20.1952   18.9179   18.4571   17.7811   14.4609   14.4609   12.7651
   34.1565   29.9339   28.7330   28.1142   26.0972   25.8735   24.5397   22.9090   21.7147   20.4374   19.9766   19.3005   15.9803   15.9803   14.2846
   36.0681   31.8455   30.6447   30.0258   28.0089   27.7851   26.4513   24.8206   23.6263   22.3490   21.8882   21.2121   17.8919   17.8919   16.1962
   40.8297   36.6071   35.4063   34.7875   32.7705   32.5468   31.2129   29.5822   28.3880   27.1106   26.6499   25.9738   22.6536   22.6536   20.9579

  Columns 16 through 27

   21.7191   22.9120   23.1651   23.8596   24.9464   25.5448   25.9267   30.8695   32.6370   34.1565   36.0681   40.8297
   17.4965   18.6894   18.9425   19.6370   20.7238   21.3222   21.7041   26.6469   28.4144   29.9339   31.8455   36.6071
   16.2956   17.4885   17.7416   18.4362   19.5229   20.1214   20.5033   25.4460   27.2136   28.7330   30.6447   35.4063
   15.6768   16.8697   17.1228   17.8173   18.9041   19.5026   19.8845   24.8272   26.5948   28.1142   30.0258   34.7875
   13.6598   14.8528   15.1059   15.8004   16.8871   17.4856   17.8675   22.8102   24.5778   26.0972   28.0089   32.7705
   13.4361   14.6290   14.8821   15.5766   16.6634   17.2618   17.6438   22.5865   24.3540   25.8735   27.7851   32.5468
   12.1022   13.2952   13.5483   14.2428   15.3295   15.9280   16.3099   21.2526   23.0202   24.5397   26.4513   31.2129
   10.4715   11.6645   11.9176   12.6121   13.6989   14.2973   14.6792   19.6219   21.3895   22.9090   24.8206   29.5822
    9.2773   10.4702   10.7233   11.4178   12.5046   13.1030   13.4850   18.4277   20.1952   21.7147   23.6263   28.3880
    7.9999    9.1929    9.4460   10.1405   11.2273   11.8257   12.2076   17.1503   18.9179   20.4374   22.3490   27.1106
    7.5392    8.7321    8.9852    9.6797   10.7665   11.3649   11.7468   16.6896   18.4571   19.9766   21.8882   26.6499
    6.8631    8.0560    8.3091    9.0036   10.0904   10.6889   11.0708   16.0135   17.7811   19.3005   21.2121   25.9738
    3.5429    4.7358    4.9889    5.6835    6.7702    7.3687    7.7506   12.6933   14.4609   15.9803   17.8919   22.6536
    3.5429    4.7358    4.9889    5.6835    6.7702    7.3687    7.7506   12.6933   14.4609   15.9803   17.8919   22.6536
    1.8472    3.0401    3.2932    3.9877    5.0745    5.6729    6.0549   10.9976   12.7651   14.2846   16.1962   20.9579
         0    1.1929    1.4460    2.1405    3.2273    3.8257    4.2077    9.1504   10.9179   12.4374   14.3490   19.1107
    1.1929         0    0.2531    0.9476    2.0344    2.6328    3.0147    7.9575    9.7250   11.2445   13.1561   17.9178
    1.4460    0.2531         0    0.6945    1.7813    2.3797    2.7616    7.7044    9.4719   10.9914   12.9030   17.6647
    2.1405    0.9476    0.6945         0    1.0868    1.6852    2.0671    7.0099    8.7774   10.2969   12.2085   16.9702
    3.2273    2.0344    1.7813    1.0868         0    0.5984    0.9804    5.9231    7.6906    9.2101   11.1217   15.8834
    3.8257    2.6328    2.3797    1.6852    0.5984         0    0.3819    5.3246    7.0922    8.6117   10.5233   15.2849
    4.2077    3.0147    2.7616    2.0671    0.9804    0.3819         0    4.9427    6.7103    8.2298   10.1414   14.9030
    9.1504    7.9575    7.7044    7.0099    5.9231    5.3246    4.9427         0    1.7676    3.2870    5.1986    9.9603
   10.9179    9.7250    9.4719    8.7774    7.6906    7.0922    6.7103    1.7676         0    1.5195    3.4311    8.1927
   12.4374   11.2445   10.9914   10.2969    9.2101    8.6117    8.2298    3.2870    1.5195         0    1.9116    6.6733
   14.3490   13.1561   12.9030   12.2085   11.1217   10.5233   10.1414    5.1986    3.4311    1.9116         0    4.7617
   19.1107   17.9178   17.6647   16.9702   15.8834   15.2849   14.9030    9.9603    8.1927    6.6733    4.7617         0


fittwo =

  Columns 1 through 15

         0    1.2681    1.7765    2.2390    2.2672    2.8322    3.6220    3.6220    4.8189    5.0465    5.3097    6.3646    6.4053    6.4736    7.0938
    1.2681         0    0.5084    0.9710    0.9992    1.5641    2.3540    2.3540    3.5509    3.7785    4.0416    5.0966    5.1372    5.2056    5.8258
    1.7765    0.5084         0    0.4625    0.4908    1.0557    1.8455    1.8455    3.0424    3.2700    3.5332    4.5881    4.6288    4.6971    5.3173
    2.2390    0.9710    0.4625         0    0.0282    0.5932    1.3830    1.3830    2.5799    2.8075    3.0706    4.1256    4.1663    4.2346    4.8548
    2.2672    0.9992    0.4908    0.0282         0    0.5649    1.3548    1.3548    2.5517    2.7793    3.0424    4.0974    4.1380    4.2064    4.8266
    2.8322    1.5641    1.0557    0.5932    0.5649         0    0.7898    0.7898    1.9867    2.2143    2.4775    3.5324    3.5731    3.6414    4.2616
    3.6220    2.3540    1.8455    1.3830    1.3548    0.7898         0         0    1.1969    1.4245    1.6876    2.7426    2.7832    2.8516    3.4718
    3.6220    2.3540    1.8455    1.3830    1.3548    0.7898         0         0    1.1969    1.4245    1.6876    2.7426    2.7832    2.8516    3.4718
    4.8189    3.5509    3.0424    2.5799    2.5517    1.9867    1.1969    1.1969         0    0.2276    0.4907    1.5457    1.5864    1.6547    2.2749
    5.0465    3.7785    3.2700    2.8075    2.7793    2.2143    1.4245    1.4245    0.2276         0    0.2631    1.3181    1.3587    1.4271    2.0473
    5.3097    4.0416    3.5332    3.0706    3.0424    2.4775    1.6876    1.6876    0.4907    0.2631         0    1.0550    1.0956    1.1640    1.7842
    6.3646    5.0966    4.5881    4.1256    4.0974    3.5324    2.7426    2.7426    1.5457    1.3181    1.0550         0    0.0407    0.1090    0.7292
    6.4053    5.1372    4.6288    4.1663    4.1380    3.5731    2.7832    2.7832    1.5864    1.3587    1.0956    0.0407         0    0.0684    0.6885
    6.4736    5.2056    4.6971    4.2346    4.2064    3.6414    2.8516    2.8516    1.6547    1.4271    1.1640    0.1090    0.0684         0    0.6202
    7.0938    5.8258    5.3173    4.8548    4.8266    4.2616    3.4718    3.4718    2.2749    2.0473    1.7842    0.7292    0.6885    0.6202         0
    7.9906    6.7225    6.2141    5.7516    5.7233    5.1584    4.3685    4.3685    3.1717    2.9440    2.6809    1.6259    1.5853    1.5169    0.8968
    8.1194    6.8513    6.3429    5.8803    5.8521    5.2872    4.4973    4.4973    3.3004    3.0728    2.8097    1.7547    1.7141    1.6457    1.0255
    9.0578    7.7898    7.2813    6.8188    6.7906    6.2257    5.4358    5.4358    4.2389    4.0113    3.7482    2.6932    2.6526    2.5842    1.9640
    9.5307    8.2626    7.7542    7.2917    7.2635    6.6985    5.9087    5.9087    4.7118    4.4842    4.2210    3.1661    3.1254    3.0571    2.4369
    9.8926    8.6245    8.1161    7.6535    7.6253    7.0604    6.2705    6.2705    5.0736    4.8460    4.5829    3.5279    3.4873    3.4189    2.7987
   10.5137    9.2456    8.7372    8.2747    8.2465    7.6815    6.8917    6.8917    5.6948    5.4672    5.2040    4.1491    4.1084    4.0401    3.4199
   10.7340    9.4660    8.9575    8.4950    8.4668    7.9018    7.1120    7.1120    5.9151    5.6875    5.4244    4.3694    4.3288    4.2604    3.6402
   11.2286    9.9606    9.4521    8.9896    8.9614    8.3964    7.6066    7.6066    6.4097    6.1821    5.9190    4.8640    4.8234    4.7550    4.1348
   13.1291   11.8610   11.3526   10.8900   10.8618   10.2969    9.5070    9.5070    8.3101    8.0825    7.8194    6.7644    6.7238    6.6554    6.0352
   14.0642   12.7961   12.2877   11.8252   11.7969   11.2320   10.4422   10.4422    9.2453    9.0177    8.7545    7.6996    7.6589    7.5906    6.9704
   14.6168   13.3487   12.8403   12.3777   12.3495   11.7846   10.9947   10.9947    9.7978    9.5702    9.3071    8.2521    8.2115    8.1431    7.5229
   15.5903   14.3222   13.8138   13.3513   13.3230   12.7581   11.9683   11.9683   10.7714   10.5438   10.2806    9.2257    9.1850    9.1166    8.4965

  Columns 16 through 27

    7.9906    8.1194    9.0578    9.5307    9.8926   10.5137   10.7340   11.2286   13.1291   14.0642   14.6168   15.5903
    6.7225    6.8513    7.7898    8.2626    8.6245    9.2456    9.4660    9.9606   11.8610   12.7961   13.3487   14.3222
    6.2141    6.3429    7.2813    7.7542    8.1161    8.7372    8.9575    9.4521   11.3526   12.2877   12.8403   13.8138
    5.7516    5.8803    6.8188    7.2917    7.6535    8.2747    8.4950    8.9896   10.8900   11.8252   12.3777   13.3513
    5.7233    5.8521    6.7906    7.2635    7.6253    8.2465    8.4668    8.9614   10.8618   11.7969   12.3495   13.3230
    5.1584    5.2872    6.2257    6.6985    7.0604    7.6815    7.9018    8.3964   10.2969   11.2320   11.7846   12.7581
    4.3685    4.4973    5.4358    5.9087    6.2705    6.8917    7.1120    7.6066    9.5070   10.4422   10.9947   11.9683
    4.3685    4.4973    5.4358    5.9087    6.2705    6.8917    7.1120    7.6066    9.5070   10.4422   10.9947   11.9683
    3.1717    3.3004    4.2389    4.7118    5.0736    5.6948    5.9151    6.4097    8.3101    9.2453    9.7978   10.7714
    2.9440    3.0728    4.0113    4.4842    4.8460    5.4672    5.6875    6.1821    8.0825    9.0177    9.5702   10.5438
    2.6809    2.8097    3.7482    4.2210    4.5829    5.2040    5.4244    5.9190    7.8194    8.7545    9.3071   10.2806
    1.6259    1.7547    2.6932    3.1661    3.5279    4.1491    4.3694    4.8640    6.7644    7.6996    8.2521    9.2257
    1.5853    1.7141    2.6526    3.1254    3.4873    4.1084    4.3288    4.8234    6.7238    7.6589    8.2115    9.1850
    1.5169    1.6457    2.5842    3.0571    3.4189    4.0401    4.2604    4.7550    6.6554    7.5906    8.1431    9.1166
    0.8968    1.0255    1.9640    2.4369    2.7987    3.4199    3.6402    4.1348    6.0352    6.9704    7.5229    8.4965
         0    0.1288    1.0673    1.5401    1.9020    2.5231    2.7435    3.2381    5.1385    6.0736    6.6262    7.5997
    0.1288         0    0.9385    1.4114    1.7732    2.3943    2.6147    3.1093    5.0097    5.9448    6.4974    7.4709
    1.0673    0.9385         0    0.4729    0.8347    1.4559    1.6762    2.1708    4.0712    5.0063    5.5589    6.5324
    1.5401    1.4114    0.4729         0    0.3619    0.9830    1.2033    1.6979    3.5984    4.5335    5.0860    6.0596
    1.9020    1.7732    0.8347    0.3619         0    0.6211    0.8415    1.3361    3.2365    4.1716    4.7242    5.6977
    2.5231    2.3943    1.4559    0.9830    0.6211         0    0.2203    0.7149    2.6154    3.5505    4.1030    5.0766
    2.7435    2.6147    1.6762    1.2033    0.8415    0.2203         0    0.4946    2.3950    3.3302    3.8827    4.8563
    3.2381    3.1093    2.1708    1.6979    1.3361    0.7149    0.4946         0    1.9004    2.8356    3.3881    4.3617
    5.1385    5.0097    4.0712    3.5984    3.2365    2.6154    2.3950    1.9004         0    0.9351    1.4877    2.4612
    6.0736    5.9448    5.0063    4.5335    4.1716    3.5505    3.3302    2.8356    0.9351         0    0.5526    1.5261
    6.6262    6.4974    5.5589    5.0860    4.7242    4.1030    3.8827    3.3881    1.4877    0.5526         0    0.9735
    7.5997    7.4709    6.5324    6.0596    5.6977    5.0766    4.8563    4.3617    2.4612    1.5261    0.9735         0


addconone =

   -6.4555


addcontwo =

    5.0634


vaf =

    0.9499


outpermone =

  Columns 1 through 26

     2     6    12    19    22     1    11     4     5    23    21    18     3    27    20    24    17    10    25     9    26    13     8    16     7    15

  Column 27

    14


outpermtwo =

  Columns 1 through 26

    18     4    19    16     3    11    15    17     5    14    27     7     8    13    12    21    20     6     2    22     9    10    25    23     1    26

  Column 27

    24


coordone =

  -14.9857
  -14.9857
  -14.9857
  -10.6768
  -10.6768
  -10.6768
   -7.2769
   -7.2769
   -7.2769
   -4.6149
   -4.6149
   -4.6149
   -0.0553
   -0.0553
   -0.0553
    3.6327
    3.6327
    3.6327
    5.6893
    5.6893
    5.6893
   10.6332
   10.6332
   10.6332
   17.6544
   17.6544
   17.6544


coordtwo =

   -6.1101
   -6.1101
   -6.1101
   -4.9751
   -4.9751
   -4.9751
   -2.6275
   -2.6275
   -2.6275
   -1.5461
   -1.5461
   -1.5461
   -0.2714
   -0.2714
   -0.2714
    0.9779
    0.9779
    0.9779
    3.0910
    3.0910
    3.0910
    4.2537
    4.2537
    4.2537
    7.2075
    7.2075
    7.2075


fitone =

  Columns 1 through 15

         0         0         0    4.3089    4.3089    4.3089    7.7088    7.7088    7.7088   10.3707   10.3707   10.3707   14.9304   14.9304   14.9304
         0         0         0    4.3089    4.3089    4.3089    7.7088    7.7088    7.7088   10.3707   10.3707   10.3707   14.9304   14.9304   14.9304
         0         0         0    4.3089    4.3089    4.3089    7.7088    7.7088    7.7088   10.3707   10.3707   10.3707   14.9304   14.9304   14.9304
    4.3089    4.3089    4.3089         0         0         0    3.3999    3.3999    3.3999    6.0619    6.0619    6.0619   10.6215   10.6215   10.6215
    4.3089    4.3089    4.3089         0         0         0    3.3999    3.3999    3.3999    6.0619    6.0619    6.0619   10.6215   10.6215   10.6215
    4.3089    4.3089    4.3089         0         0         0    3.3999    3.3999    3.3999    6.0619    6.0619    6.0619   10.6215   10.6215   10.6215
    7.7088    7.7088    7.7088    3.3999    3.3999    3.3999         0         0         0    2.6620    2.6620    2.6620    7.2216    7.2216    7.2216
    7.7088    7.7088    7.7088    3.3999    3.3999    3.3999         0         0         0    2.6620    2.6620    2.6620    7.2216    7.2216    7.2216
    7.7088    7.7088    7.7088    3.3999    3.3999    3.3999         0         0         0    2.6620    2.6620    2.6620    7.2216    7.2216    7.2216
   10.3707   10.3707   10.3707    6.0619    6.0619    6.0619    2.6620    2.6620    2.6620         0         0         0    4.5596    4.5596    4.5596
   10.3707   10.3707   10.3707    6.0619    6.0619    6.0619    2.6620    2.6620    2.6620         0         0         0    4.5596    4.5596    4.5596
   10.3707   10.3707   10.3707    6.0619    6.0619    6.0619    2.6620    2.6620    2.6620         0         0         0    4.5596    4.5596    4.5596
   14.9304   14.9304   14.9304   10.6215   10.6215   10.6215    7.2216    7.2216    7.2216    4.5596    4.5596    4.5596         0         0         0
   14.9304   14.9304   14.9304   10.6215   10.6215   10.6215    7.2216    7.2216    7.2216    4.5596    4.5596    4.5596         0         0         0
   14.9304   14.9304   14.9304   10.6215   10.6215   10.6215    7.2216    7.2216    7.2216    4.5596    4.5596    4.5596         0         0         0
   18.6184   18.6184   18.6184   14.3096   14.3096   14.3096   10.9097   10.9097   10.9097    8.2477    8.2477    8.2477    3.6881    3.6881    3.6881
   18.6184   18.6184   18.6184   14.3096   14.3096   14.3096   10.9097   10.9097   10.9097    8.2477    8.2477    8.2477    3.6881    3.6881    3.6881
   18.6184   18.6184   18.6184   14.3096   14.3096   14.3096   10.9097   10.9097   10.9097    8.2477    8.2477    8.2477    3.6881    3.6881    3.6881
   20.6750   20.6750   20.6750   16.3661   16.3661   16.3661   12.9663   12.9663   12.9663   10.3043   10.3043   10.3043    5.7447    5.7447    5.7447
   20.6750   20.6750   20.6750   16.3661   16.3661   16.3661   12.9663   12.9663   12.9663   10.3043   10.3043   10.3043    5.7447    5.7447    5.7447
   20.6750   20.6750   20.6750   16.3661   16.3661   16.3661   12.9663   12.9663   12.9663   10.3043   10.3043   10.3043    5.7447    5.7447    5.7447
   25.6189   25.6189   25.6189   21.3100   21.3100   21.3100   17.9101   17.9101   17.9101   15.2482   15.2482   15.2482   10.6885   10.6885   10.6885
   25.6189   25.6189   25.6189   21.3100   21.3100   21.3100   17.9101   17.9101   17.9101   15.2482   15.2482   15.2482   10.6885   10.6885   10.6885
   25.6189   25.6189   25.6189   21.3100   21.3100   21.3100   17.9101   17.9101   17.9101   15.2482   15.2482   15.2482   10.6885   10.6885   10.6885
   32.6400   32.6400   32.6400   28.3312   28.3312   28.3312   24.9313   24.9313   24.9313   22.2693   22.2693   22.2693   17.7097   17.7097   17.7097
   32.6400   32.6400   32.6400   28.3312   28.3312   28.3312   24.9313   24.9313   24.9313   22.2693   22.2693   22.2693   17.7097   17.7097   17.7097
   32.6400   32.6400   32.6400   28.3312   28.3312   28.3312   24.9313   24.9313   24.9313   22.2693   22.2693   22.2693   17.7097   17.7097   17.7097

  Columns 16 through 27

   18.6184   18.6184   18.6184   20.6750   20.6750   20.6750   25.6189   25.6189   25.6189   32.6400   32.6400   32.6400
   18.6184   18.6184   18.6184   20.6750   20.6750   20.6750   25.6189   25.6189   25.6189   32.6400   32.6400   32.6400
   18.6184   18.6184   18.6184   20.6750   20.6750   20.6750   25.6189   25.6189   25.6189   32.6400   32.6400   32.6400
   14.3096   14.3096   14.3096   16.3661   16.3661   16.3661   21.3100   21.3100   21.3100   28.3312   28.3312   28.3312
   14.3096   14.3096   14.3096   16.3661   16.3661   16.3661   21.3100   21.3100   21.3100   28.3312   28.3312   28.3312
   14.3096   14.3096   14.3096   16.3661   16.3661   16.3661   21.3100   21.3100   21.3100   28.3312   28.3312   28.3312
   10.9097   10.9097   10.9097   12.9663   12.9663   12.9663   17.9101   17.9101   17.9101   24.9313   24.9313   24.9313
   10.9097   10.9097   10.9097   12.9663   12.9663   12.9663   17.9101   17.9101   17.9101   24.9313   24.9313   24.9313
   10.9097   10.9097   10.9097   12.9663   12.9663   12.9663   17.9101   17.9101   17.9101   24.9313   24.9313   24.9313
    8.2477    8.2477    8.2477   10.3043   10.3043   10.3043   15.2482   15.2482   15.2482   22.2693   22.2693   22.2693
    8.2477    8.2477    8.2477   10.3043   10.3043   10.3043   15.2482   15.2482   15.2482   22.2693   22.2693   22.2693
    8.2477    8.2477    8.2477   10.3043   10.3043   10.3043   15.2482   15.2482   15.2482   22.2693   22.2693   22.2693
    3.6881    3.6881    3.6881    5.7447    5.7447    5.7447   10.6885   10.6885   10.6885   17.7097   17.7097   17.7097
    3.6881    3.6881    3.6881    5.7447    5.7447    5.7447   10.6885   10.6885   10.6885   17.7097   17.7097   17.7097
    3.6881    3.6881    3.6881    5.7447    5.7447    5.7447   10.6885   10.6885   10.6885   17.7097   17.7097   17.7097
         0         0         0    2.0566    2.0566    2.0566    7.0005    7.0005    7.0005   14.0216   14.0216   14.0216
         0         0         0    2.0566    2.0566    2.0566    7.0005    7.0005    7.0005   14.0216   14.0216   14.0216
         0         0         0    2.0566    2.0566    2.0566    7.0005    7.0005    7.0005   14.0216   14.0216   14.0216
    2.0566    2.0566    2.0566         0         0         0    4.9439    4.9439    4.9439   11.9650   11.9650   11.9650
    2.0566    2.0566    2.0566         0         0         0    4.9439    4.9439    4.9439   11.9650   11.9650   11.9650
    2.0566    2.0566    2.0566         0         0         0    4.9439    4.9439    4.9439   11.9650   11.9650   11.9650
    7.0005    7.0005    7.0005    4.9439    4.9439    4.9439         0         0         0    7.0211    7.0211    7.0211
    7.0005    7.0005    7.0005    4.9439    4.9439    4.9439         0         0         0    7.0211    7.0211    7.0211
    7.0005    7.0005    7.0005    4.9439    4.9439    4.9439         0         0         0    7.0211    7.0211    7.0211
   14.0216   14.0216   14.0216   11.9650   11.9650   11.9650    7.0211    7.0211    7.0211         0         0         0
   14.0216   14.0216   14.0216   11.9650   11.9650   11.9650    7.0211    7.0211    7.0211         0         0         0
   14.0216   14.0216   14.0216   11.9650   11.9650   11.9650    7.0211    7.0211    7.0211         0         0         0


fittwo =

  Columns 1 through 15

         0         0         0    1.1350    1.1350    1.1350    3.4826    3.4826    3.4826    4.5639    4.5639    4.5639    5.8387    5.8387    5.8387
         0         0         0    1.1350    1.1350    1.1350    3.4826    3.4826    3.4826    4.5639    4.5639    4.5639    5.8387    5.8387    5.8387
         0         0         0    1.1350    1.1350    1.1350    3.4826    3.4826    3.4826    4.5639    4.5639    4.5639    5.8387    5.8387    5.8387
    1.1350    1.1350    1.1350         0         0         0    2.3476    2.3476    2.3476    3.4290    3.4290    3.4290    4.7037    4.7037    4.7037
    1.1350    1.1350    1.1350         0         0         0    2.3476    2.3476    2.3476    3.4290    3.4290    3.4290    4.7037    4.7037    4.7037
    1.1350    1.1350    1.1350         0         0         0    2.3476    2.3476    2.3476    3.4290    3.4290    3.4290    4.7037    4.7037    4.7037
    3.4826    3.4826    3.4826    2.3476    2.3476    2.3476         0         0         0    1.0813    1.0813    1.0813    2.3561    2.3561    2.3561
    3.4826    3.4826    3.4826    2.3476    2.3476    2.3476         0         0         0    1.0813    1.0813    1.0813    2.3561    2.3561    2.3561
    3.4826    3.4826    3.4826    2.3476    2.3476    2.3476         0         0         0    1.0813    1.0813    1.0813    2.3561    2.3561    2.3561
    4.5639    4.5639    4.5639    3.4290    3.4290    3.4290    1.0813    1.0813    1.0813         0         0         0    1.2748    1.2748    1.2748
    4.5639    4.5639    4.5639    3.4290    3.4290    3.4290    1.0813    1.0813    1.0813         0         0         0    1.2748    1.2748    1.2748
    4.5639    4.5639    4.5639    3.4290    3.4290    3.4290    1.0813    1.0813    1.0813         0         0         0    1.2748    1.2748    1.2748
    5.8387    5.8387    5.8387    4.7037    4.7037    4.7037    2.3561    2.3561    2.3561    1.2748    1.2748    1.2748         0         0         0
    5.8387    5.8387    5.8387    4.7037    4.7037    4.7037    2.3561    2.3561    2.3561    1.2748    1.2748    1.2748         0         0         0
    5.8387    5.8387    5.8387    4.7037    4.7037    4.7037    2.3561    2.3561    2.3561    1.2748    1.2748    1.2748         0         0         0
    7.0880    7.0880    7.0880    5.9530    5.9530    5.9530    3.6054    3.6054    3.6054    2.5240    2.5240    2.5240    1.2493    1.2493    1.2493
    7.0880    7.0880    7.0880    5.9530    5.9530    5.9530    3.6054    3.6054    3.6054    2.5240    2.5240    2.5240    1.2493    1.2493    1.2493
    7.0880    7.0880    7.0880    5.9530    5.9530    5.9530    3.6054    3.6054    3.6054    2.5240    2.5240    2.5240    1.2493    1.2493    1.2493
    9.2010    9.2010    9.2010    8.0660    8.0660    8.0660    5.7184    5.7184    5.7184    4.6371    4.6371    4.6371    3.3623    3.3623    3.3623
    9.2010    9.2010    9.2010    8.0660    8.0660    8.0660    5.7184    5.7184    5.7184    4.6371    4.6371    4.6371    3.3623    3.3623    3.3623
    9.2010    9.2010    9.2010    8.0660    8.0660    8.0660    5.7184    5.7184    5.7184    4.6371    4.6371    4.6371    3.3623    3.3623    3.3623
   10.3638   10.3638   10.3638    9.2288    9.2288    9.2288    6.8812    6.8812    6.8812    5.7998    5.7998    5.7998    4.5251    4.5251    4.5251
   10.3638   10.3638   10.3638    9.2288    9.2288    9.2288    6.8812    6.8812    6.8812    5.7998    5.7998    5.7998    4.5251    4.5251    4.5251
   10.3638   10.3638   10.3638    9.2288    9.2288    9.2288    6.8812    6.8812    6.8812    5.7998    5.7998    5.7998    4.5251    4.5251    4.5251
   13.3176   13.3176   13.3176   12.1826   12.1826   12.1826    9.8350    9.8350    9.8350    8.7536    8.7536    8.7536    7.4789    7.4789    7.4789
   13.3176   13.3176   13.3176   12.1826   12.1826   12.1826    9.8350    9.8350    9.8350    8.7536    8.7536    8.7536    7.4789    7.4789    7.4789
   13.3176   13.3176   13.3176   12.1826   12.1826   12.1826    9.8350    9.8350    9.8350    8.7536    8.7536    8.7536    7.4789    7.4789    7.4789

  Columns 16 through 27

    7.0880    7.0880    7.0880    9.2010    9.2010    9.2010   10.3638   10.3638   10.3638   13.3176   13.3176   13.3176
    7.0880    7.0880    7.0880    9.2010    9.2010    9.2010   10.3638   10.3638   10.3638   13.3176   13.3176   13.3176
    7.0880    7.0880    7.0880    9.2010    9.2010    9.2010   10.3638   10.3638   10.3638   13.3176   13.3176   13.3176
    5.9530    5.9530    5.9530    8.0660    8.0660    8.0660    9.2288    9.2288    9.2288   12.1826   12.1826   12.1826
    5.9530    5.9530    5.9530    8.0660    8.0660    8.0660    9.2288    9.2288    9.2288   12.1826   12.1826   12.1826
    5.9530    5.9530    5.9530    8.0660    8.0660    8.0660    9.2288    9.2288    9.2288   12.1826   12.1826   12.1826
    3.6054    3.6054    3.6054    5.7184    5.7184    5.7184    6.8812    6.8812    6.8812    9.8350    9.8350    9.8350
    3.6054    3.6054    3.6054    5.7184    5.7184    5.7184    6.8812    6.8812    6.8812    9.8350    9.8350    9.8350
    3.6054    3.6054    3.6054    5.7184    5.7184    5.7184    6.8812    6.8812    6.8812    9.8350    9.8350    9.8350
    2.5240    2.5240    2.5240    4.6371    4.6371    4.6371    5.7998    5.7998    5.7998    8.7536    8.7536    8.7536
    2.5240    2.5240    2.5240    4.6371    4.6371    4.6371    5.7998    5.7998    5.7998    8.7536    8.7536    8.7536
    2.5240    2.5240    2.5240    4.6371    4.6371    4.6371    5.7998    5.7998    5.7998    8.7536    8.7536    8.7536
    1.2493    1.2493    1.2493    3.3623    3.3623    3.3623    4.5251    4.5251    4.5251    7.4789    7.4789    7.4789
    1.2493    1.2493    1.2493    3.3623    3.3623    3.3623    4.5251    4.5251    4.5251    7.4789    7.4789    7.4789
    1.2493    1.2493    1.2493    3.3623    3.3623    3.3623    4.5251    4.5251    4.5251    7.4789    7.4789    7.4789
         0         0         0    2.1130    2.1130    2.1130    3.2758    3.2758    3.2758    6.2296    6.2296    6.2296
         0         0         0    2.1130    2.1130    2.1130    3.2758    3.2758    3.2758    6.2296    6.2296    6.2296
         0         0         0    2.1130    2.1130    2.1130    3.2758    3.2758    3.2758    6.2296    6.2296    6.2296
    2.1130    2.1130    2.1130         0         0         0    1.1627    1.1627    1.1627    4.1166    4.1166    4.1166
    2.1130    2.1130    2.1130         0         0         0    1.1627    1.1627    1.1627    4.1166    4.1166    4.1166
    2.1130    2.1130    2.1130         0         0         0    1.1627    1.1627    1.1627    4.1166    4.1166    4.1166
    3.2758    3.2758    3.2758    1.1627    1.1627    1.1627         0         0         0    2.9538    2.9538    2.9538
    3.2758    3.2758    3.2758    1.1627    1.1627    1.1627         0         0         0    2.9538    2.9538    2.9538
    3.2758    3.2758    3.2758    1.1627    1.1627    1.1627         0         0         0    2.9538    2.9538    2.9538
    6.2296    6.2296    6.2296    4.1166    4.1166    4.1166    2.9538    2.9538    2.9538         0         0         0
    6.2296    6.2296    6.2296    4.1166    4.1166    4.1166    2.9538    2.9538    2.9538         0         0         0
    6.2296    6.2296    6.2296    4.1166    4.1166    4.1166    2.9538    2.9538    2.9538         0         0         0


addconone =

   -7.1024


addcontwo =

    4.8676


vaf =

    0.8734
\end{verbatim}

\large

\begin{figure}

\hfil \scalebox{1.00}{\includegraphics{hampshire_tiedcoordinates_scaling.eps}} \hfil

\caption{The City-Block Scaling of the Hampshire Towns Based on the Given Tied
Coordinate Patterns (in Groups of Three) Obtained with biscalqa\_tied.m.}

\end{figure}




\subsection{Matrix Color Coding and Presentation}

 A current method of data presentation is through the use of color, where a collection of varying numerical values is mapped into a corresponding collection of colors that can then be displayed.  A \verb+colormap+ is an $m \times 3$ matrix of real numbers between 0.0 and 1.0, with each row giving an RGB (Red/Green/Blue) vector defining a single color.  For example, if \verb+map+ is the name of the $m \times 3$ matrix, then the $k^{th}$ row, \verb+map(k,:) = [r(k) g(k) b(k)]+, provides the intensities of red, green, and blue components for the $k^{th}$ color.

\smallskip

A number of built-in colormaps are available in MATLAB (or, alternatively, custom colormaps can be constructed by a user, possibly through the MATLAB GUI, \verb+colormapeditor+); all of these ready-made colormaps accept a value of $m$ for the number of rows (number of colors) of the colormap.  For example, the command, \verb+colormap(bone(256))+, produces a (built-in) \verb+bone+ colormap with 256 colors; the latter is a grayscale with a higher value of the blue component, adding an ``electronic'' look to the grayscale images.  Asking for MATLAB help on ``colormap'' will produce the collection of supported colormaps (e.g., \verb+bone+, \verb+gray+, \verb+copper+, \verb+spring+, among many others).

\smallskip

The MATLAB function, \verb+pcolor+, is used to produce our checkerboard colorcoded plot of the entries in a given matrix.  The minimum and maximum matrix entries are assigned the first and last colors in the colormap, with the remaining entries determined by a linear mapping from the numerical values to the colormap elements.  The MATLAB command, \verb+colorbar+, reproduces a legend giving a visual correspondence between color and numerical value.  Also, the MATLAB command, \verb+axis ij+, puts the representation into ``matrix axes mode'', where the coordinate system origin is at the upper-left corner.  As is standard for a matrix, the $i$ axis is vertical and numbered from top to bottom; the $j$ axis is horizontal and numbered from left to right.

\smallskip

The M-file we have written, \verb+matrix_colorcode.m+, has syntax:
\begin{verbatim}
matrix_colorcode(datamatrix,rowperm,colperm,cmap)
\end{verbatim}
\noindent Here,  a color representation  is constructed for the values in an
$n \times m$ matrix, \verb+DATAMATRIX+.  The rows and columns of \verb+DATAMATRIX+ are
permuted by \verb+ROWPERM+ and \verb+COLPERM+, respectively, with  \verb+CMAP+ the input
colormap for the representation (e.g., \verb+bone(256)+).

\smallskip

There are several other uses of the \verb+pcolor+ command that are interesting from a data analytic perspective.  One is to produce a movie that traces the course of some optimization method.  For example, the various quadratic assignment routines of the earlier Unidimensional Scaling Toolbox (e.g., \verb+order.m+, \verb+pairwiseqa.m+, \verb+rotateqa.m+, \verb+insertqa.m+), all produce a cell array of permutations that transform a symmetric data matrix to be as close as possible to a given target matrix.  To show the effects of these permutations in a colorcoded manner, we have the M-file, \verb+matrix_movie.m+, with the syntax:
\begin{verbatim}
matrix_movie(datamatrix,perms,numperms,cmap)
\end{verbatim}
\noindent A color movie is constructed of the effects of a series
of permutations on an $n \times n$ symmetric   proximity matrix,
\verb+DATAMATRIX+; \verb+PERMS+ is
a cell array containing \verb+NUMPERMS+ permutations; \verb+CMAP+
is the input colormap used for the representation.  The actual movie is produced and played based on the MATLAB commands of \verb+getframe+ (for capturing the movie frames) and \verb+movie+ (for replaying the recorded frames).



\section{Comparing Categorical (Ultrametric) and Continuous (LUS) Representations for
a Proximity Matrix}

One of the basic tasks of data analysis for proximity matrices lies in the choice of
representation, and in particular, whether it should be `continuous', as reflected in
LUS, or `categorical', as in the construction of a best-fitting ultrametric.  These
latter discrete or categorical models are the main topic of a companion Cluster
Analysis Toolbox, and the reader is referred to this source for specifics. Here, we
demonstrate the use of imposing a constraining object order on the analysis performed
that is either given (in \verb+cat_vs_con_orderfit.m+), or is found (in
\verb+cat_vs_con_orderfnd.m+).  In either case, a best-fitting anti-Robinson (AR)
matrix is first identified based on the constraining order (either given or found),
recalling that an AR matrix is characterized by its entries never decreasing (and
usually increasing) as we move away from the main diagonal within a row or a column.
Treating this latter AR matrix as if it were the input proximity matrix, both a
best-fitting LUS and ultrametric structure is then identified, respecting the given or
found constraining order. We note, in particular, that the AR constraints imposed are
weaker than those for a LUS or ultrametric model, and the AR defining inequalities are
actually implicit in those for the stricter representations.  This implies that one
can proceed, without loss of any generality, to obtain a LUS or ultrametric structures
from the best-fitting AR matrix treated as the input proximity matrix.  The
`successive averaging' necessary for a least-squares AR matrix is also part of and is
needed to generate best LUS or ultrametric approximations.

\smallskip

Generally, LUS and ultrametric structures can themselves be put into AR forms.  So, in
this sense, both continuous and discrete representations are part of a broader
representational device that places an upper-bound on how well a given proximity
matrix can be represented by either a continuous or discrete structure.  For example,
in its use below on the \verb+supreme_agree+ data matrix, \verb+cat_vs_con_orderfnd.m+
finds the identity permutation as the constraining permutation and gives a VAF of
99.55\% for the best-fitting AR matrix.  The LUS model VAF of 97.96\% is trivially
less than that for the AR form; in contrast, the ultrametric VAF of 73.69\% is quite a
drop.  Given these comparisons, one might argue that a continuous representation does
much better than a categorical one, at least for this particular proximity matrix.

\smallskip

The syntax for the two M-files is very similar:
\begin{verbatim}
[findultra,vafultra,vafarob,arobprox,fitlinear,vaflinear,...
    coord,addcon] = cat_vs_con_orderfit(prox,inperm,conperm)

[findultra,vafultra,conperm,vafarob,arobprox,fitlinear,...
    vaflinear,coord,addcon] = cat_vs_con_orderfnd(prox,inperm)
\end{verbatim}
\noindent As usual, \verb+prox+ is the input dissimilarity matrix and \verb+inperm+ is
a starting permutation for how the ultrametric constraints are searched for; in
\verb+cat_vs_con_orderfnd.m+, \verb+inperm+ also initializes the search for a
constraining order. The permutation, \verb+conperm+, in \verb+cat_vs_con_orderfit.m+
is the given constraining order.  As output, \verb+findultra+ is the best ultrametric
found with VAF of \verb+vafultra+; \verb+arobprox+ is the best AR form identified with
a VAF of \verb+vafarob+; \verb+fitlinear+ is the best LUS model with VAF of
\verb+vaflinear+ with \verb+coord+ containing the coordinates and \verb+addcon+ the
additive constant. For \verb+cat_vs_con_orderfnd.m+, the identified constraining
order, \verb+conperm+, is also given as an output vector.

\normalsize
\begin{verbatim}
>> load supreme_agree.dat
>> [findultra,vafultra,conperm,vafarob,arobprox,fitlinear,vaflinear, ...
coord,addcon] = cat_vs_con_orderfnd(supreme_agree,randperm(9))

findultra =

         0    0.3633    0.3633    0.3633    0.6405    0.6405    0.6405    0.6405    0.6405
    0.3633         0    0.2850    0.2850    0.6405    0.6405    0.6405    0.6405    0.6405
    0.3633    0.2850         0    0.2200    0.6405    0.6405    0.6405    0.6405    0.6405
    0.3633    0.2850    0.2200         0    0.6405    0.6405    0.6405    0.6405    0.6405
    0.6405    0.6405    0.6405    0.6405         0    0.3100    0.3100    0.4017    0.4017
    0.6405    0.6405    0.6405    0.6405    0.3100         0    0.2300    0.4017    0.4017
    0.6405    0.6405    0.6405    0.6405    0.3100    0.2300         0    0.4017    0.4017
    0.6405    0.6405    0.6405    0.6405    0.4017    0.4017    0.4017         0    0.2100
    0.6405    0.6405    0.6405    0.6405    0.4017    0.4017    0.4017    0.2100         0


vafultra =

    0.7369


conperm =

     1     2     3     4     5     6     7     8     9


vafarob =

    0.9955


arobprox =

         0    0.3600    0.3600    0.3700    0.6550    0.6550    0.7500    0.8550    0.8550
    0.3600         0    0.2800    0.2900    0.4900    0.5300    0.5700    0.7500    0.7600
    0.3600    0.2800         0    0.2200    0.4900    0.5100    0.5700    0.7200    0.7400
    0.3700    0.2900    0.2200         0    0.4500    0.5000    0.5600    0.6900    0.7100
    0.6550    0.4900    0.4900    0.4500         0    0.3100    0.3100    0.4600    0.4600
    0.6550    0.5300    0.5100    0.5000    0.3100         0    0.2300    0.4150    0.4150
    0.7500    0.5700    0.5700    0.5600    0.3100    0.2300         0    0.3300    0.3300
    0.8550    0.7500    0.7200    0.6900    0.4600    0.4150    0.3300         0    0.2100
    0.8550    0.7600    0.7400    0.7100    0.4600    0.4150    0.3300    0.2100         0


fitlinear =

         0    0.1304    0.1464    0.1691    0.4085    0.4589    0.5060    0.6483    0.6483
    0.1304         0    0.0160    0.0387    0.2780    0.3285    0.3756    0.5179    0.5179
    0.1464    0.0160         0    0.0227    0.2620    0.3124    0.3596    0.5019    0.5019
    0.1691    0.0387    0.0227         0    0.2393    0.2898    0.3369    0.4792    0.4792
    0.4085    0.2780    0.2620    0.2393         0    0.0504    0.0976    0.2399    0.2399
    0.4589    0.3285    0.3124    0.2898    0.0504         0    0.0471    0.1894    0.1894
    0.5060    0.3756    0.3596    0.3369    0.0976    0.0471         0    0.1423    0.1423
    0.6483    0.5179    0.5019    0.4792    0.2399    0.1894    0.1423         0         0
    0.6483    0.5179    0.5019    0.4792    0.2399    0.1894    0.1423         0         0


vaflinear =

    0.9796


coord =

   -0.3462
   -0.2158
   -0.1998
   -0.1771
    0.0622
    0.1127
    0.1598
    0.3021
    0.3021


addcon =

   -0.2180
\end{verbatim}


\large

There is one somewhat unresolved issue as to whether the LUS and ultrametric
representations incorporate the same number of `weights', because otherwise, direct
comparison of VAF values may be considered problematic.  We argue that, indeed, the
number of weights are the same; there are $n-1$ distinct values in an ultrametric
matrix and $n-1$ separations along a line in a LUS model.  The one additional additive
constant for LUS that is needed to insure invariance to linear transformations of the
proximities, should not count against the representation.  The ultrametric model
automatically has such invariance, and  should not be given an inherent advantage just
because of this.

\subsection{Comparing Equally-Spaced Versus Unrestricted Representations for a
Proximity Matrix}

The fitting strategies offered by \verb+linfitac.m+ and \verb+cirfitac.m+ (as well as
\verb+ultrafit.m+ from the companion Cluster Analysis Toolbox), all allow unequal
spacings to generate the least-squares approximations.  This, in effect, requires
multiple weights to be constructed.  At times, it may be of interest to see how a much
simpler model might fair, based only on one `free weight'.  In LUS, we would have
equal spacings along a line; for CUS, there would be equal spacings around a circular
structure; and for an ultrametric, only multiples of the integer-valued levels
(typically, $n$ minus the number of classes in a partition) at which  new subsets are
formed. In the examples below of \verb+eqspace_linfitac.m+, \verb+eqspace_cirfitac.m+,
and \verb+eqspace_ultrafit.m+, the addition of the prefix `\verb+eq+' shows the
\verb+vaf+, \verb+fit+, or  \verb+addcon+ for the equally-spaced alternatives. (All of
the latter, we might add, are based on simple regression, rather than on any iterative
fitting strategy.)  The usual non-equally-spaced alternatives are also given for
comparison. We found the high VAF of 83.83\% interesting for the equally-spaced LUS
model; it is remarkable that only one weight is necessary to generate such a value.



\normalsize
\begin{verbatim}
>> load supreme_agree.dat
>> [fit, vaf, coord, addcon, eqfit, eqvaf, eqaddcon] = ...
           eqspace_linfitac(supreme_agree,1:9)

fit =

         0    0.1304    0.1464    0.1691    0.4085    0.4589    0.5060    0.6483    0.6483
    0.1304         0    0.0160    0.0387    0.2780    0.3285    0.3756    0.5179    0.5179
    0.1464    0.0160         0    0.0227    0.2620    0.3124    0.3596    0.5019    0.5019
    0.1691    0.0387    0.0227         0    0.2393    0.2898    0.3369    0.4792    0.4792
    0.4085    0.2780    0.2620    0.2393         0    0.0504    0.0976    0.2399    0.2399
    0.4589    0.3285    0.3124    0.2898    0.0504         0    0.0471    0.1894    0.1894
    0.5060    0.3756    0.3596    0.3369    0.0976    0.0471         0    0.1423    0.1423
    0.6483    0.5179    0.5019    0.4792    0.2399    0.1894    0.1423         0         0
    0.6483    0.5179    0.5019    0.4792    0.2399    0.1894    0.1423         0         0


vaf =

    0.9796


coord =

   -0.3462
   -0.2158
   -0.1998
   -0.1771
    0.0622
    0.1127
    0.1598
    0.3021
    0.3021


addcon =

   -0.2180


eqfit =

         0    0.0859    0.1718    0.2577    0.3436    0.4295    0.5154    0.6013    0.6872
    0.0859         0    0.0859    0.1718    0.2577    0.3436    0.4295    0.5154    0.6013
    0.1718    0.0859         0    0.0859    0.1718    0.2577    0.3436    0.4295    0.5154
    0.2577    0.1718    0.0859         0    0.0859    0.1718    0.2577    0.3436    0.4295
    0.3436    0.2577    0.1718    0.0859         0    0.0859    0.1718    0.2577    0.3436
    0.4295    0.3436    0.2577    0.1718    0.0859         0    0.0859    0.1718    0.2577
    0.5154    0.4295    0.3436    0.2577    0.1718    0.0859         0    0.0859    0.1718
    0.6013    0.5154    0.4295    0.3436    0.2577    0.1718    0.0859         0    0.0859
    0.6872    0.6013    0.5154    0.4295    0.3436    0.2577    0.1718    0.0859         0


eqvaf =

    0.8383


eqaddcon =

   -0.2181

>> load morse_digits.dat
>> [fit, vaf, addcon, eqfit, eqvaf, eqaddcon] = ...
            eqspace_cirfitac(morse_digits,[4 5 6 7 8 9 10 1 2 3])

fit =

         0    0.0247    0.3620    0.6413    0.9605    1.1581    1.1581    1.0358    0.7396    0.3883
    0.0247         0    0.3373    0.6165    0.9358    1.1334    1.1334    1.0606    0.7643    0.4131
    0.3620    0.3373         0    0.2793    0.5985    0.7961    0.7961    1.0148    1.1016    0.7503
    0.6413    0.6165    0.2793         0    0.3193    0.5169    0.5169    0.7355    1.0318    1.0296
    0.9605    0.9358    0.5985    0.3193         0    0.1976    0.1976    0.4163    0.7125    1.0638
    1.1581    1.1334    0.7961    0.5169    0.1976         0    0.0000    0.2187    0.5149    0.8662
    1.1581    1.1334    0.7961    0.5169    0.1976    0.0000         0    0.2187    0.5149    0.8662
    1.0358    1.0606    1.0148    0.7355    0.4163    0.2187    0.2187         0    0.2963    0.6475
    0.7396    0.7643    1.1016    1.0318    0.7125    0.5149    0.5149    0.2963         0    0.3513
    0.3883    0.4131    0.7503    1.0296    1.0638    0.8662    0.8662    0.6475    0.3513         0


vaf =

    0.7190


addcon =

   -0.7964


eqfit =

         0    0.2208    0.4416    0.6624    0.8833    1.1041    0.8833    0.6624    0.4416    0.2208
    0.2208         0    0.2208    0.4416    0.6624    0.8833    1.1041    0.8833    0.6624    0.4416
    0.4416    0.2208         0    0.2208    0.4416    0.6624    0.8833    1.1041    0.8833    0.6624
    0.6624    0.4416    0.2208         0    0.2208    0.4416    0.6624    0.8833    1.1041    0.8833
    0.8833    0.6624    0.4416    0.2208         0    0.2208    0.4416    0.6624    0.8833    1.1041
    1.1041    0.8833    0.6624    0.4416    0.2208         0    0.2208    0.4416    0.6624    0.8833
    0.8833    1.1041    0.8833    0.6624    0.4416    0.2208         0    0.2208    0.4416    0.6624
    0.6624    0.8833    1.1041    0.8833    0.6624    0.4416    0.2208         0    0.2208    0.4416
    0.4416    0.6624    0.8833    1.1041    0.8833    0.6624    0.4416    0.2208         0    0.2208
    0.2208    0.4416    0.6624    0.8833    1.1041    0.8833    0.6624    0.4416    0.2208         0


eqvaf =

    0.5518


eqaddcon =

   -0.8371
\end{verbatim}

\large

\normalsize
\begin{verbatim}
>> load sc_completelink_integertarget.dat
>> sc_completelink_integertarget

sc_completelink_integertarget =

     0     6     6     6     8     8     8     8     8
     6     0     4     4     8     8     8     8     8
     6     4     0     2     8     8     8     8     8
     6     4     2     0     8     8     8     8     8
     8     8     8     8     0     5     5     7     7
     8     8     8     8     5     0     3     7     7
     8     8     8     8     5     3     0     7     7
     8     8     8     8     7     7     7     0     1
     8     8     8     8     7     7     7     1     0

>> [fit,vaf,eqfit,eqvaf] = eqspace_ultrafit(supreme_agree,sc_completelink_integertarget)

fit =

         0    0.3633    0.3633    0.3633    0.6405    0.6405    0.6405    0.6405    0.6405
    0.3633         0    0.2850    0.2850    0.6405    0.6405    0.6405    0.6405    0.6405
    0.3633    0.2850         0    0.2200    0.6405    0.6405    0.6405    0.6405    0.6405
    0.3633    0.2850    0.2200         0    0.6405    0.6405    0.6405    0.6405    0.6405
    0.6405    0.6405    0.6405    0.6405         0    0.3100    0.3100    0.4017    0.4017
    0.6405    0.6405    0.6405    0.6405    0.3100         0    0.2300    0.4017    0.4017
    0.6405    0.6405    0.6405    0.6405    0.3100    0.2300         0    0.4017    0.4017
    0.6405    0.6405    0.6405    0.6405    0.4017    0.4017    0.4017         0    0.2100
    0.6405    0.6405    0.6405    0.6405    0.4017    0.4017    0.4017    0.2100         0


vaf =

    0.7369


eqfit =

         0    0.4601    0.4601    0.4601    0.6135    0.6135    0.6135    0.6135    0.6135
    0.4601         0    0.3067    0.3067    0.6135    0.6135    0.6135    0.6135    0.6135
    0.4601    0.3067         0    0.1534    0.6135    0.6135    0.6135    0.6135    0.6135
    0.4601    0.3067    0.1534         0    0.6135    0.6135    0.6135    0.6135    0.6135
    0.6135    0.6135    0.6135    0.6135         0    0.3834    0.3834    0.5368    0.5368
    0.6135    0.6135    0.6135    0.6135    0.3834         0    0.2300    0.5368    0.5368
    0.6135    0.6135    0.6135    0.6135    0.3834    0.2300         0    0.5368    0.5368
    0.6135    0.6135    0.6135    0.6135    0.5368    0.5368    0.5368         0    0.0767
    0.6135    0.6135    0.6135    0.6135    0.5368    0.5368    0.5368    0.0767         0


eqvaf =

    0.5927
\end{verbatim}


\large

\subsection{Representing an Order-Constrained LUS and an Ultrametric on the Same Graph}

Whenever the same constraining object order is used to generate both a LUS and
ultrametric structure, it is possible to represent them jointly within the same
graphical display.  The usual dendrogram showing when the new groups form in the
hierarchical clustering is given for the ultrametric, but the latter also has its
terminal nodes separated according to the coordinates constructed for the LUS.  An
example is given in Figure 6 using the \verb+supreme_agree+ data and the earlier
analyses given with \verb+cat_vs_con_orderfnd+.  We  believe this provides a very nice
combined representation for both the discrete and continuous models found for a
proximity matrix.

\begin{figure}

\begin{center}

\caption{A Joint Order-Constrained LUS and Ultrametric Representation for the
supreme\_agree Proximity Matrix}

\setlength{\unitlength}{.5pt}

\begin{picture}(700,1000)

\put(54,0){\makebox(0,0){St}}
 \put(184,0){\makebox(0,0){B}}
\put(200,0){\makebox(0,0){G}}
 \put(223,0){\makebox(0,0){So}}
\put(462,0){\makebox(0,0){Oc}}
 \put(513,0){\makebox(0,0){Ke}}
\put(560,0){\makebox(0,0){Re}}
 \put(702,0){\makebox(0,0){Sc/Th}}



\put(54,50){\circle{20}} \put(184,50){\circle{20}}
 \put(200,50){\circle{20}}
\put(223,50){\circle{20}}
 \put(462,50){\circle{20}}
  \put(513,50){\circle{20}}
\put(560,50){\circle{20}}
 \put(702,50){\circle{20}}



\put(125.875,410){\circle*{20}}
 \put(197.75,340){\circle*{20}}
\put(211.5,270){\circle*{20}}
 \put(499.25,360){\circle*{20}}
  \put(536.5,280){\circle*{20}}
\put(600.625,450){\circle*{20}}
 \put(702,260){\circle*{20}}

\put(363.25,690){\circle*{30}}


\put(363.25,690){\line(0,1){50}}

\put(0,50){\line(0,1){800}}


\put(54,60){\line(0,1){350}} \put(184,60){\line(0,1){280}}
\put(200,60){\line(0,1){210}} \put(223,60){\line(0,1){210}}
\put(462,60){\line(0,1){300}} \put(513,60){\line(0,1){220}}
\put(560,60){\line(0,1){220}} \put(702,60){\line(0,1){200}}


\put(125.875,410){\line(0,1){280}} \put(197.75,340){\line(0,1){70}}
\put(211.5,270){\line(0,1){70}} \put(499.25,360){\line(0,1){90}}
\put(536.5,280){\line(0,1){80}} \put(702,260){\line(0,1){190}}
\put(600.625,450){\line(0,1){240}}


\put(54,410){\line(1,0){143.75}} \put(184,340){\line(1,0){27.5}}
\put(200,270){\line(1,0){23.0}} \put(462,360){\line(1,0){74.5}}
\put(513,280){\line(1,0){47.0}} \put(702,260){\line(1,0){0}}
\put(499.25,450){\line(1,0){202.75}} \put(125.875,690){\line(1,0){474.75}}


\put(-50,260){\vector(1,0){50}} \put(-90,265){\makebox(0,0)[b]{.21}}
\put(-50,270){\vector(1,0){50}} \put(-60,275){\makebox(0,0)[b]{.22}}
\put(-50,280){\vector(1,0){50}} \put(-90,285){\makebox(0,0)[b]{.23}}
\put(-50,340){\vector(1,0){50}} \put(-50,345){\makebox(0,0)[b]{.29}}
\put(-50,360){\vector(1,0){50}} \put(-50,365){\makebox(0,0)[b]{.31}}
\put(-50,410){\vector(1,0){50}} \put(-50,415){\makebox(0,0)[b]{.36}}
\put(-50,450){\vector(1,0){50}} \put(-50,455){\makebox(0,0)[b]{.40}}
\put(-50,690){\vector(1,0){50}} \put(-50,695){\makebox(0,0)[b]{.64}}

\end{picture}

\end{center}

\end{figure}

\section{The Representation of Proximity Matrices by Structures Dependent on Order (Only)}



This section concentrates on an alternative approach to understanding what a given proximity matrix may be depicting about the objects on which it was constructed, and one that does not require a prior commitment to the sole use of either some form of dimensional model (as in nonmetric multidimensional scaling (NMDS)), or one that is strictly classificatory (as in the use of a partition hierarchy and the implicit fitting of an ultrametric that serves as the representational mechanism for the hierarchical clustering).  The method of  analysis is based on approximating a given proximity matrix additively by a sum of matrices, where each component in the sum is subject to specific patterning restrictions on its entries.  The restrictions imposed on each component of the decomposition (to be referred to as matrices with AR, SAR, CAR, or CSAR forms) are very general and encompass interpretations that might be dimensional, or classificatory, or  some combination of both (e.g., through object classes that are themselves placed dimensionally in some space). Thus, as one special case --- and particularly when an (optimal) transformation of the proximities is also permitted (as we will generally allow), proximity matrices that are well interpretable through NMDS should also be interpretable through an additive decomposition of the (transformed) proximity matrix.  Alternatively, when classificatory structures of various kinds might underlie a set of proximities (and the direct use of NMDS  could possibly lead to a degeneracy), additive decompositions may still provide an analysis strategy for elucidating the structure.

\subsection{Anti-Robinson (AR) Matrices for Symmetric Proximity Data}



Denoting an arbitrary symmetric $n \times n$ matrix by $\mathbf{A} = \{a_{ij}\}$, where the main diagonal entries are considered irrelevant and assumed to be zero (i.e., $a_{ii} = 0$ for $1 \leq i \leq n$), $\mathbf{A}$ is said to have an anti-Robinson (AR) form if after some reordering of the rows and columns of $\mathbf{A}$, the entries within each row and column have a distinctive pattern: moving away from the zero main diagonal entry within any row or any column, the entries never decrease.  Generally, matrices having AR forms can appear both in spatial representations for a set of proximities as functions of the absolute differences in coordinate values along some axis, or for classificatory structures that are characterized through an ultrametric.

\smallskip

To illustrate, we first let $\mathbf{P} = \{p_{ij}\}$ be a given $n \times n$ proximity (dissimilarity) matrix among the distinct pairs of $n$ objects in a set $S =  \{O_{1},O_{2},\ldots,O_{n}\}$ (where $p_{ii} = 0$ for $1 \leq i \leq n$).  Then, suppose, for example, a two-dimensional Euclidean representation is possible for $\mathbf{P}$ and its entries are very well representable by the distances in this space, so \[ p_{ij} \approx \sqrt{(x_{1i}    - x_{1j})^{2} + (x_{2i}  - x_{2j})^{2}} \  , \] where $x_{ki}$ and $x_{kj}$ are the coordinates on the $k^{th}$ axis (for $k = 1$ and $2$) for objects $O_{i}$ and $O_{j}$ (and the symbol $\approx$  is used to indicate approximation).  Here, a simple monotonic transformation (squaring) of the proximities should then be fitted well by the sum of two matrices both having AR forms, i.e., \[ \{p_{ij}^{2}\} \approx \{(x_{1i} - x_{1j})^{2}\} + \{(x_{2i} - x_{2j})^{2}\} . \]  In a classificatory framework, if $\{p_{ij}\}$ were well representable, say, as a sum of two matrices, $\mathbf{A}_{1} = \{a_{ij}^{(1)}\}$ and $\mathbf{A}_{2} = \{a_{ij}^{(2)}\}$, each satisfying the ultrametric inequality, i.e., $a_{ij}^{(k)} \leq \max \{a_{ih}^{(k)}, a_{hj}^{(k)}\}$ for $k = 1$ and $2$, then \[\{p_{ij}\} \approx \{a_{ij}^{(1)}\} + \{a_{ij}^{(2)}\} ,\] and each of the constituent matrices can be reordered to display an AR form.  As shown in the Cluster Analysis Toolbox, any matrix whose entries satisfy the ultrametric inequality can be represented by a sequence of partitions that are hierarchically related.

\smallskip

Given some proximity matrix $\mathbf{P}$, the task of approximating it as a sum of matrices each having an AR form is implemented through an iterative optimization strategy based on a least-squares loss criterion that is discussed in detail by Hubert and Arabie (1994). Given the manner in which the optimization process is carried out sequentially, \emph{each successive AR matrix} in any decomposition generally accounts for less and less of the patterning of the original proximity information (and very analogous to what is typically observed in a principal component decomposition of a covariance matrix).  In fact, it has been found empirically that for the many data sets we have analyzed, only a very small number of such AR matrices are ever necessary to represent almost all of the patterning in the given proximities.  As a succinct summary that we could give to this empirical experience: no more than three AR matrices are ever necessary;  two are usually sufficient; and sometimes one will suffice.

\smallskip


The substantive challenge that remains, once a well-fitting decomposition is found for a given proximity matrix, is to interpret substantively what each term in the decomposition might be depicting.  The strategy  that could be followed would approximate each separate AR matrix by ones having a more restrictive form, and  usually those representing some type of unidimensional scale  (a dimensional interpretation) or partition hierarchy (a classificatory interpretation).



\subsubsection{Interpreting the Structure of an AR matrix}

In representing a proximity matrix $\mathbf{P}$ as a sum, $\mathbf{A}_{1} + \cdots + \mathbf{A}_{K}$, the interpretive task remains to explain substantively what each term of the decomposition might be depicting.  We suggest four possible strategies below, with the first two attempting to understand the structure of an AR matrix directly and without much loss of detail; the last two require the imposition of strictly parameterized approximations in the form of either an ultrametric or a unidimensional scale.  In the discussion below, $\mathbf{A} = \{a_{ij}\}$ will be assumed to have an AR form that is displayed by the given row and column order.

\bigskip

(A) Complete representation and reconstruction through a collection of subsets and associated subset diameters:

\smallskip

The entries in any AR matrix $\mathbf{A}$ can be reconstructed exactly through a collection of $M$ subsets of the original object set $S = \{O_{1},\ldots,O_{n}\}$, denoted by $S_{1},\ldots,S_{M}$,  and where $M$ is determined by the particular pattern of tied entries, if any,  in $\mathbf{A}$.  These $M$ subsets have the following characteristics:

(i) each $S_{m}$, $1 \leq m \leq M$, consists of a sequence of (two or more) consecutive integers so that $M \leq n(n-1)/2$.  (This bound holds because the number of different subsets having consecutive integers for any given fixed ordering is $n(n-1)/2$, and will be achieved if all the entries in the AR matrix $\mathbf{A}$ are distinct).

(ii) each $S_{m}$, $1 \leq m \leq M$, has a diameter, denoted by $d(S_{m})$, so that for all object pairs within $S_{m}$, the corresponding entries in $\mathbf{A}$ are less than or equal to the diameter.  The subsets, $S_{1},\ldots,S_{M}$, can be assumed ordered as $d(S_{1}) \leq d(S_{2}) \leq \cdots \leq d(S_{M})$, and if $S_{m} \subseteq S_{m'}$, $d(S_{m}) \leq d(S_{m'})$.


(iii) each entry in $\mathbf{A}$ can be reconstructed from $d(S_{1}),\ldots,d(S_{M})$, i.e., for $1 \leq i,j \leq n$, \[ a_{ij} = \min_{1 \leq m \leq M} \{d(S_{m}) \mid O_{i}, O_{j} \in S_{m} \} ,\]
\noindent so that the minimum diameter for subsets containing an object pair $O_{i}, O_{j} \in S$ is equal to $a_{ij}$.    Given $\mathbf{A}$, the collection of subsets $S_{1},\ldots,S_{M}$ and their diameters can be identified by inspection through the use of an increasing threshold that starts from the smallest entry in $\mathbf{A}$, and observing which subsets containing contiguous objects emerge from this process.  The substantive interpretation of what $\mathbf{A}$ is depicting reduces to explaining why those subsets with the smallest diameters are so homogenous.  For convenience of reference, the subsets $S_{1},\ldots,S_{M}$ will be referred to as the set of \emph{AR reconstructive subsets}.

\bigskip

(B) Representation by a strongly anti-Robinson matrix:

\smallskip
 \index{B}{anti-Robinson forms}
If the matrix $\mathbf{A}$ has a somewhat more restrictive form than just being AR, and is also   \emph{strongly} anti-Robinson (SAR), a convenient graphical representation can be given to the collection of AR reconstructive subsets $S_{1},\ldots,S_{M}$ and their diameters, and how they can serve to retrieve $\mathbf{A}$.  Specifically, $\mathbf{A}$ is said to be strongly anti-Robinson (SAR) if (considering the above-diagonal entries of $\mathbf{A}$) whenever two entries in adjacent columns are equal ($a_{ij} = a_{i(j+1)}$), those in the same two adjacent columns in the previous row are also equal ($a_{(i-1)j} = a_{(i-1)(j+1)}$ for $1 \leq i-1 < j \leq n-1$); also, whenever two entries in adjacent rows are equal ($a_{ij} = a_{(i+1)j}$), those in the same two adjacent rows in the succeeding column are also equal ($a_{i(j+1)} = a_{(i+1)(j+1)}$ for $2 \leq i+1 < j \leq n-1$).

\smallskip

 When $\mathbf{A}$ is SAR, the collection of subsets, $S_{1},\ldots,S_{M}$, and their diameters, and how these serve to reconstruct $\mathbf{A}$ can be modeled graphically.  The internal nodes (represented by  solid circles) in each of these figures are at a height equal to the diameter of the respective subset; the consecutive objects forming that subset are identifiable by downward paths from the internal nodes to the terminal nodes corresponding to the objects in $S = \{O_{1},\ldots,O_{n}\}$ (represented by labeled open circles).  An entry $a_{ij}$ in $\mathbf{A}$ can be reconstructed as the minimum node height of a subset for which a path can be constructed from $O_{i}$ up to that internal node and then back down to $O_{j}$. (To prevent undue graphical ``clutter'', only the most homogenous subsets from $S_{1},\ldots,S_{M}$ having the smallest diameters should actually be included in the graphical representation of an SAR matrix; each figure would explicitly show only how the smallest entries in $\mathbf{A}$ can be reconstructed, although each could be easily extended to include all of $\mathbf{A}$.  The calibrated vertical axis in such figures could routinely include the heights at which the additional internal nodes would have to be placed to effect such a complete reconstruction.)

\smallskip

Given an arbitrary AR matrix $\mathbf{A}$, a least-squares SAR approximating matrix to $\mathbf{A}$ can be found using the heuristic optimization search strategy  developed in Hubert, Arabie, and Meulman (1998), and illustrated in a section to follow.  This latter source also discusses in detail (through counterexample) why strongly AR conditions need to be imposed to obtain a consistent graphical representation.

\bigskip

(C) Representation by a unidimensional scale:

\smallskip

To obtain greater graphical simplicity for an eventual substantive interpretation than offered by an SAR matrix, one possibility is to use approximating unidimensional scales.  To be explicit, one very simple form that an AR matrix $\mathbf{A}$ may assume is interpretable by a single dimension and through a unidimensional scale in which the entries have the parameterized form,
 $\mathbf{A} = \{a_{ij}\} = \{ \mid x_{j} - x_{i} \mid + \ c \}$, where the coordinates are ordered as $x_{1} \leq x_{2} \leq \cdots \leq x_{n}$ and $c$ is an estimated constant.  Given any proximity matrix, a least-squares approximating unidimensional scale can be obtained through the optimization strategies of the Unidimensional Scaling Toolbox,  and would be one (dimensional) method that could be followed in attempting to interpret what a particular AR component of a decomposition might be revealing.

\bigskip

(D)  Representation by an ultrametric:

\smallskip


A second simple form that an AR matrix $\mathbf{A}$ could have is strictly classificatory in which the entries in $\mathbf{A}$ satisfy the ultrametric condition: $a_{ij} \leq \max \{a_{ik}, a_{jk}\}$ for all $O_{i}, O_{j}, O_{k} \in S$.  As a threshold is increased from the smallest entry in $\mathbf{A}$, a sequence of partitions of $S$ is identified in which each partition is constructed from the previous one by uniting pairs of subsets from the latter.  A partition identified at a given threshold level has equal values in $\mathbf{A}$ between each given pair of subsets, and all the within subset values are not greater than the between subset values.  The reconstructive subsets $S_{1},\ldots,S_{M}$ that would represent the AR matrix $\mathbf{A}$ are now the new subsets that are formed in the sequence of partitions, and have the property that if $d(S_{m}) \leq d(S_{m'})$, then $S_{m} \subseteq S_{m'}$ or $S_{m} \cap S_{m'} = \oslash$.
Given any proximity matrix, a least-squares approximating ultrametric can be constructed by the heuristic optimization routines developed in the Cluster Analysis Toolbox, and would be another (classificatory) strategy for interpreting what a particular AR component of a decomposition might be depicting.  As might be noted, there are generally $n-1$ subsets (each of size greater than one) in the collection of reconstructive subsets for any ultrametric, and thus $n-1$  values need to be estimated in finding the least-squares approximation (which is the same number   needed for a least-squares approximating unidimensional scale, based on obtaining the $n-1$ non-negative separation values between $x_{i}$ and $x_{i+1}$ for $1 \leq i \leq n-1$).




\subsection{Fitting a Given AR Matrix in the $L_{2}$-Norm}

The function M-file, \verb+arobfit.m+, fits an anti-Robinson matrix using iterative projection to a symmetric proximity matrix in the $L_{2}$-norm.  The usage syntax is of the form
\begin{verbatim}
[fit,vaf] = arobfit(prox,inperm)
\end{verbatim}
\noindent where \verb+PROX+ is the input proximity matrix ($n \times n$ with a zero main diagonal
 and a dissimilarity interpretation); \verb+INPERM+ is a given permutation of the first $n$ integers; \verb+FIT+ is the least-squares optimal matrix (with variance-accounted-for
 of \verb+VAF+) to \verb+PROX+ having an anti-Robinson form for the row and column
 object ordering given by \verb+INPERM+.  A recording of a MATLAB  session using the \verb+number.dat+ data file and object ordering given by the identity permutation follows:

 \tiny

\begin{verbatim}
load number.dat
inperm = 1:10

inperm =

     1     2     3     4     5     6     7     8     9    10

[fit,vaf] = arobfit(number,inperm)

fit =

  Columns 1 through 6

         0    0.4210    0.5840    0.6965    0.6965    0.7960
    0.4210         0    0.2840    0.3460    0.6170    0.6170
    0.5840    0.2840         0    0.2753    0.2753    0.5460
    0.6965    0.3460    0.2753         0    0.2753    0.3844
    0.6965    0.6170    0.2753    0.2753         0    0.3844
    0.7960    0.6170    0.5460    0.3844    0.3844         0
    0.7960    0.6940    0.5460    0.3844    0.3844    0.3844
    0.8600    0.6940    0.5853    0.5853    0.5530    0.4000
    0.8600    0.7413    0.5853    0.5853    0.5530    0.5530
    0.8600    0.7413    0.7413    0.5853    0.5853    0.5853

  Columns 7 through 10

    0.7960    0.8600    0.8600    0.8600
    0.6940    0.6940    0.7413    0.7413
    0.5460    0.5853    0.5853    0.7413
    0.3844    0.5853    0.5853    0.5853
    0.3844    0.5530    0.5530    0.5853
    0.3844    0.4000    0.5530    0.5853
         0    0.3857    0.3857    0.3857
    0.3857         0    0.3857    0.3857
    0.3857    0.3857         0    0.3857
    0.3857    0.3857    0.3857         0


vaf =

    0.6979
\end{verbatim}

\large

\subsection{Finding an AR Matrix in the $L_{2}$-Norm}

The \emph{fitting} of a given AR matrix by the M-function, \verb+arobfit.m+, requires the presence of an initial permutation to direct the optimization process.  Thus, the \emph{finding} of a best-fitting AR matrix reduces to the identification of an appropriate object permutation to use \emph{ab initio}.  We suggest the adoption of \verb+order.m+, which carries out an iterative Quadratic Assignment (QA) maximization task using
 a given square, $n \times n$, proximity matrix \verb+PROX+ (with a zero main diagonal and
 a dissimilarity interpretation).  Three separate local operations are used to permute
 the rows and columns of the proximity matrix to maximize the cross-product
 index with respect to a given square target matrix \verb+TARG+: (a)
 pairwise interchanges of objects in the permutation defining the row and column
 order of the square proximity matrix; (b) the insertion of from 1 to \verb+KBLOCK+
 (which is less than or equal to $n-1$) consecutive objects in
 the permutation defining the row and column order of the data matrix; and (c) the
 rotation of from 2 to \verb+KBLOCK+ (which is less than or equal to $n-1$) consecutive objects in
 the permutation defining the row and column order of the data matrix.  The usage syntax has the form
\begin{verbatim}
[outperm,rawindex,allperms,index] =  ...
    order(prox,targ,inperm,kblock)
\end{verbatim}
\noindent where \verb+INPERM+ is the input beginning permutation (a permutation of the first $n$ integers);
 \verb+OUTPERM+ is the final permutation of \verb+PROX+ with the cross-product index \verb+RAWINDEX+
 with respect to \verb+TARG+. The cell array \verb+ALLPERMS+  contains \verb+INDEX+
 entries corresponding to all the
 permutations identified in the optimization from \verb+ALLPERMS{1}+ = \verb+INPERM+ to
 \verb+ALLPERMS{INDEX}+ = \verb+OUTPERM+.

 \smallskip

A recording of a MATLAB  session using \verb+order.m+ is listed below with the beginning \verb+INPERM+ given as the identity permutation, \verb+TARG+ by an equally-spaced object placement along a line, and \verb+KBLOCK+ = 3.  Using the generated \verb+OUTPERM+, \verb+arobfit.m+ is then invoked to fit an AR form having final \verb+VAF+ of .7782.


\tiny

\begin{verbatim}
load number.dat
targlinear = targlin(10);
[outperm,rawindex,allperms,index] = ...
    order(number,targlinear,1:10,3);

outperm

outperm =

     1     2     3     5     4     6     7     9    10     8

rawindex

rawindex =

  206.4920

index

index =

     4

[fit, vaf] = arobfit(number, outperm)

fit =

  Columns 1 through 6

         0    0.4210    0.5840    0.6840    0.7090    0.7960
    0.4210         0    0.2840    0.4960    0.4960    0.5880
    0.5840    0.2840         0    0.0590    0.3835    0.4928
    0.6840    0.4960    0.0590         0    0.3835    0.3985
    0.7090    0.4960    0.3835    0.3835         0    0.3750
    0.7960    0.5880    0.4928    0.3985    0.3750         0
    0.7960    0.7357    0.4928    0.3985    0.3750    0.3750
    0.8210    0.7357    0.4928    0.4928    0.4928    0.4928
    0.8500    0.7357    0.7357    0.6830    0.4928    0.4928
    0.9090    0.7357    0.7357    0.7357    0.5920    0.4928

  Columns 7 through 10

    0.7960    0.8210    0.8500    0.9090
    0.7357    0.7357    0.7357    0.7357
    0.4928    0.4928    0.7357    0.7357
    0.3985    0.4928    0.6830    0.7357
    0.3750    0.4928    0.4928    0.5920
    0.3750    0.4928    0.4928    0.4928
         0    0.3460    0.3460    0.4253
    0.3460         0    0.3460    0.4253
    0.3460    0.3460         0    0.4253
    0.4253    0.4253    0.4253         0


vaf =

    0.7782
\end{verbatim}

\large

The M-file, \verb+arobfnd.m+ is our preferred method for actually identifying a single AR form, and incorporates an initial equally-spaced target and uses the iterative QA routine of \verb+order.m+ to generate better permutations; the obtained AR forms are then used as new targets against which possibly even better permutations might be identified, until convergence (i.e., the identified permutations remain the same).  The syntax is as follows:
\begin{verbatim}
[find, vaf, outperm] = arobfnd(prox, inperm, kblock)
\end{verbatim}
\noindent where \verb+PROX+ is the input proximity matrix ($n \times n$ with a zero main diagonal
 and a dissimilarity interpretation);
 \verb+INPERM+ is a given starting permutation of the first $n$ integers;
 \verb+FIND+ is the least-squares optimal matrix (with variance-accounted-for
 of \verb+VAF+) to \verb+PROX+ having an anti-Robinson form for the row and column
 object ordering given by the ending permutation \verb+OUTPERM+; \verb+KBLOCK+
 defines the block size in the use the iterative quadratic assignment
 routine.

\smallskip


  As seen from the example below, and starting from a random initial permutation, the same AR form is found as with just one application of \verb+order.m+ reported above.

  \tiny

\begin{verbatim}
[find, vaf, outperm] = arobfnd(number, randperm(10), 1);

vaf =

    0.7782


outperm =

     8    10     9     7     6     4     5     3     2     1
\end{verbatim}

\large

\subsection{Fitting and Finding a Strongly Anti-Robinson (SAR) Matrix in the $L_{2}$-Norm}

The M-functions, \verb+sarobfit.m+ and \verb+sarobfnd.m+, are direct analogues of \verb+arobfit.m+ and \verb+arobfnd.m+, respectively, but are concerned with fitting and finding \emph{strongly} anti-Robinson forms.  The syntax for \verb+sarobfit.m+, which fits a strongly anti-Robinson matrix using iterative projection to
 a symmetric proximity matrix in the $L_{2}$-norm, is
\begin{verbatim}
[fit, vaf] = sarobfit(prox, inperm)
\end{verbatim}
\noindent where, again, \verb+PROX+ is the input proximity matrix ($n \times n$ with a zero main diagonal
 and a dissimilarity interpretation); \verb+INPERM+ is a given permutation of the first $n$ integers;
 \verb+FIT+ is the least-squares optimal matrix (with variance-accounted-for
 of \verb+VAF+) to \verb+PROX+ having a strongly anti-Robinson form for the row and column
 object ordering given by \verb+INPERM+.

 \smallskip

An example follows using the same identity permutation as was implemented in fitting an AR form with \verb+arobfit.m+; as might be expected from using the more restrictive strongly anti-Robinson form, the \verb+VAF+ drops to .6128 from .6979.

\tiny

\begin{verbatim}
load number.dat
[fit,vaf] = sarobfit(number,1:10)

fit =

  Columns 1 through 6

         0    0.4210    0.5840    0.6965    0.6965    0.7960
    0.4210         0    0.2840    0.4960    0.4960    0.6730
    0.5840    0.2840         0    0.2753    0.2753    0.4553
    0.6965    0.4960    0.2753         0    0.2753    0.4553
    0.6965    0.4960    0.2753    0.2753         0    0.3977
    0.7960    0.6730    0.4553    0.4553    0.3977         0
    0.7960    0.6730    0.4553    0.4553    0.3977    0.3977
    0.8600    0.6820    0.6050    0.6050    0.5557    0.5557
    0.8600    0.6820    0.6050    0.6050    0.5557    0.5557
    0.8600    0.6820    0.6050    0.6050    0.5557    0.5557

  Columns 7 through 10

    0.7960    0.8600    0.8600    0.8600
    0.6730    0.6820    0.6820    0.6820
    0.4553    0.6050    0.6050    0.6050
    0.4533    0.6050    0.6050    0.6050
    0.3977    0.5557    0.5557    0.5557
    0.3977    0.5557    0.5557    0.5557
         0    0.3857    0.3857    0.3857
    0.3857         0    0.3857    0.3857
    0.3857    0.3857         0    0.3857
    0.3857    0.3857    0.3857         0


vaf =

    0.6128
\end{verbatim}

\large

The M-function, \verb+sarobfnd.m+,  finds and fits a strongly anti-Robinson matrix using iterative projection to
 a symmetric proximity matrix in the $L_{2}$-norm based on a permutation
 identified through the use of iterative quadratic assignment.  The function has the expected syntax
\begin{verbatim}
[find, vaf, outperm] = sarobfnd(prox, inperm, kblock)
\end{verbatim}
 \noindent where, again, \verb+PROX+ is the input proximity matrix ($n \times n$ with a zero main diagonal
 and a dissimilarity interpretation); \verb+INPERM+ is a given starting permutation of the first $n$ integers;
 \verb+FIND+ is the least-squares optimal matrix (with variance-accounted-for
 of \verb+VAF+) to \verb+PROX+ having a strongly anti-Robinson form for the row and column
 object ordering given by the ending permutation \verb+OUTPERM+. As usual, \verb+KBLOCK+
 defines the block size in the use the iterative quadratic assignment
 routine.

 \smallskip

In the MATLAB  recording below, and starting from a random permutation, a strongly anti-Robinson form is found with a \verb+VAF+ of .7210 (an expected drop from the value of .7782 for the anti-Robinson form found using \verb+arobfnd.m+).


\tiny


\begin{verbatim}
[find,vaf,outperm] = sarobfnd(number,randperm(10),1)

find =

  Columns 1 through 7

         0    0.4210    0.5840    0.6965    0.6965    0.7960
    0.4210         0    0.2840    0.4960    0.4960    0.6730
    0.5840    0.2840         0    0.0590    0.3835    0.4723
    0.6965    0.4960    0.0590         0    0.3835    0.4723
    0.6965    0.4960    0.3835    0.3835         0    0.3750
    0.7960    0.6730    0.4723    0.4723    0.3750         0
    0.7960    0.6730    0.4723    0.4723    0.3750    0.3750
    0.8355    0.7080    0.5714    0.5714    0.4275    0.4275
    0.8355    0.7080    0.5714    0.5714    0.5714    0.5714
    0.9090    0.7227    0.7227    0.7227    0.5714    0.5714

  Columns 8 through 10

    0.7960    0.8355    0.8355    0.9090
    0.6730    0.7080    0.7080    0.7227
    0.4723    0.5714    0.5714    0.7227
    0.4723    0.5714    0.5714    0.7227
    0.3750    0.4275    0.5714    0.5714
    0.3750    0.4275    0.5714    0.5714
         0    0.2960    0.3710    0.4380
    0.2960         0    0.3710    0.4380
    0.3710    0.3710         0    0.4000
    0.4380    0.4380    0.4000         0


vaf =

    0.7210


outperm =

     1     2     3     5     4     6     7    10     9     8
\end{verbatim}

\large




\subsection{Representation Through Multiple (Strongly) AR Matrices}

The representation of a proximity matrix by a single anti-Robinson structure extends easily to the additive use of multiple matrices.  The M-function, \verb+biarobfnd.m+, fits the sum of two anti-Robinson matrices using iterative projection to a symmetric proximity matrix in the $L_{2}$-norm based on permutations
 identified through the use of iterative quadratic assignment.  The usage syntax is
 \begin{verbatim}
[find,vaf,targone,targtwo,outpermone,outpermtwo] = ...
biarobfnd(prox,inperm,kblock)
\end{verbatim}
 \noindent where, as before, \verb+PROX+ is the input proximity matrix ($n \times n$ with a zero main diagonal
 and a dissimilarity interpretation);
 \verb+INPERM+ is a given starting permutation of the first $n$ integers;
 \verb+FIND+ is the least-squares optimal matrix (with variance-accounted-for
 of \verb+VAF+) to \verb+PROX+ and is the sum of the two anti-Robinson matrices
 \verb+TARGONE+ and \verb+TARGTWO+ based on the two row and column
 object orderings given by the ending permutations \verb+OUTPERMONE+
 and \verb+OUTPERMTWO+. As before, \verb+KBLOCK+ defines the block size in the use of the
 iterative quadratic assignment routine.

 \smallskip

In the example below, the two resulting AR forms are very clearly interpretable as number magnitude and digit structural properties; the \verb+VAF+ is, in effect, 100\%.


\tiny


\begin{verbatim}
load number.dat
[find,vaf,targone,targtwo,outpermone,outpermtwo] = ...
biarobfnd(number,1:10,1)


find =

  Columns 1 through 6

         0    0.4209    0.5840    0.7090    0.6840    0.8040
    0.4209         0    0.2840    0.3460    0.6460    0.5880
    0.5840    0.2840         0    0.3540    0.0588    0.6702
    0.7090    0.3460    0.3540         0    0.4130    0.4290
    0.6840    0.6460    0.0588    0.4130         0    0.4094
    0.8040    0.5880    0.6702    0.4290    0.4094         0
    0.7865    0.7568    0.4225    0.3000    0.3880    0.3960
    0.9107    0.6300    0.7960    0.5920    0.7420    0.4000
    0.8210    0.7975    0.3672    0.7975    0.2460    0.6714
    0.8500    0.6250    0.8080    0.2630    0.6829    0.5920

  Columns 7 through 10

    0.7865    0.9107    0.8210    0.8500
    0.7568    0.6300    0.7975    0.6250
    0.4225    0.7960    0.3672    0.8080
    0.3000    0.5920    0.7975    0.2630
    0.3880    0.7420    0.2460    0.6829
    0.3960    0.4000    0.6714    0.5920
         0    0.4169    0.3499    0.2960
    0.4169         0    0.4000    0.4587
    0.3499    0.4000         0    0.3922
    0.2960    0.4587    0.3922         0


vaf =

    0.9999


targone =

  Columns 1 through 6

         0    0.3406    0.6710    0.6926    0.6956    0.6956
    0.3406         0    0.2018    0.5421    0.5423    0.5880
    0.6710    0.2018         0    0.3333    0.3680    0.4662
    0.6926    0.5421    0.3333         0    0.3093    0.3206
    0.6956    0.5423    0.3680    0.3093         0    0.2055
    0.6956    0.5880    0.4662    0.3206    0.2055         0
    0.8303    0.6764    0.4662    0.3779    0.3779    0.2876
    0.8303    0.6764    0.6764    0.6764    0.6383    0.4675
    0.8303    0.7511    0.7138    0.6764    0.6383    0.4745
    0.8611    0.7943    0.7943    0.6764    0.6690    0.4836

  Columns 7 through 10

    0.8303    0.8303    0.8303    0.8611
    0.6764    0.6764    0.7511    0.7943
    0.4662    0.6764    0.7138    0.7943
    0.3779    0.6764    0.6764    0.6764
    0.3779    0.6383    0.6383    0.6690
    0.2876    0.4675    0.4745    0.4836
         0    0.3360    0.3366    0.3849
    0.3360         0    0.2243    0.3783
    0.3366    0.2243         0    0.3783
    0.3849    0.3783    0.3783         0


targtwo =

  Columns 1 through 6

         0   -0.3923   -0.3092   -0.0093    0.0139    0.0139
   -0.3923         0   -0.3092   -0.0116    0.0101    0.0139
   -0.3092   -0.3092         0   -0.0870   -0.0438    0.0137
   -0.0093   -0.0116   -0.0870         0   -0.0438   -0.0111
    0.0139    0.0101   -0.0438   -0.0438         0   -0.0889
    0.0139    0.0139    0.0137   -0.0111   -0.0889         0
    0.1211    0.1037    0.0207    0.0164   -0.0779   -0.4134
    0.1211    0.1037    0.0822    0.0804    0.0804   -0.1693
    0.1757    0.1037    0.0822    0.0804    0.0804    0.0804
    0.2039    0.2039    0.2039    0.1084    0.1084    0.1084

  Columns 7 through 10

    0.1211    0.1211    0.1211    0.1757    0.2039
    0.1037    0.1037    0.1037    0.1037    0.2039
    0.0207    0.0207    0.0822    0.0822    0.2039
    0.0164    0.0164    0.0804    0.0804    0.1084
   -0.0779   -0.0779    0.0804    0.0804    0.1084
   -0.4134   -0.4134   -0.1693    0.0804    0.1084
         0         0   -0.1961   -0.0844    0.1084
   -0.1961   -0.1961         0   -0.1211         0
   -0.0844   -0.0844   -0.1211         0   -0.0745
    0.1084    0.1084         0   -0.0745         0


outpermone =

     1     2     3     4     5     6     7     9     8    10


outpermtwo =

     9     5     3     1     7    10     4     2     8     6
\end{verbatim}

\large

For finding multiple SAR forms,  \verb+bisarobfnd.m+ has usage syntax
\begin{verbatim}
[find,vaf,targone,targtwo,outpermone,outpermtwo] = ...
bisarobfnd(prox,inperm,kblock)
\end{verbatim}
\noindent with all the various terms the same as for \verb+biarobfnd.m+ but now for strongly AR (SAR) structures.  The example below finds essentially the same representation as above (involving digit magnitude and structure) with a slight drop in the \verb+VAF+ to  99.06\%.

\tiny

\begin{verbatim}
[find,vaf,targone,targtwo,outpermone,outpermtwo] = ...
bisarobfnd(number,randperm(10),1)

find =

  Columns 1 through 6

         0    0.4210    0.5840    0.7095    0.6838    0.8519
    0.4210         0    0.2840    0.3460    0.6461    0.5892
    0.5840    0.2840         0    0.3541    0.0590    0.6090
    0.7095    0.3460    0.3541         0    0.4131    0.4278
    0.6838    0.6461    0.0590    0.4131         0    0.4090
    0.8519    0.5892    0.6090    0.4278    0.4090         0
    0.7260    0.7565    0.4830    0.3005    0.3882    0.3960
    0.8998    0.6153    0.8059    0.6067    0.7286    0.4000
    0.8208    0.8246    0.3670    0.7893    0.2460    0.6711
    0.8736    0.6250    0.7797    0.2630    0.6965    0.5920

  Columns 7 through 10

    0.7260    0.8998    0.8208    0.8736
    0.7565    0.6153    0.8246    0.6250
    0.4830    0.8059    0.3670    0.7797
    0.3005    0.6067    0.7893    0.2630
    0.3882    0.7286    0.2460    0.6965
    0.3960    0.4000    0.6711    0.5920
         0    0.4168    0.3502    0.2955
    0.4168         0    0.4000    0.4590
    0.3502    0.4000         0    0.3921
    0.2955    0.4590    0.3921         0


vaf =

    0.9906


targone =

  Columns 1 through 6

         0    0.3148    0.6038    0.6296    0.6296    0.7457
    0.3148         0    0.1778    0.5201    0.5201    0.6626
    0.6038    0.1778         0    0.2742    0.3230    0.5028
    0.6296    0.5201    0.2742         0    0.3192    0.5012
    0.6296    0.5201    0.3230    0.3192         0    0.2831
    0.7457    0.6626    0.5028    0.5012    0.2831         0
    0.7457    0.6626    0.5028    0.5012    0.3340    0.3021
    0.7936    0.7061    0.6997    0.6974    0.6027    0.5526
    0.7936    0.7061    0.6997    0.6974    0.6027    0.5526
    0.7936    0.7061    0.6997    0.6974    0.6027    0.5527

  Columns 7 through 10

    0.7457    0.7936    0.7936    0.7936
    0.6626    0.7061    0.7061    0.7061
    0.5028    0.6997    0.6997    0.6997
    0.5012    0.6974    0.6974    0.6974
    0.3340    0.6027    0.6027    0.6027
    0.3021    0.5526    0.5526    0.5527
         0    0.3229    0.3229    0.4963
    0.3229         0    0.2815    0.4197
    0.3229    0.2815         0    0.3001
    0.4963    0.4197    0.3001         0


targtwo =

  Columns 1 through 6

         0   -0.3567   -0.2640    0.0542    0.0542    0.0938
   -0.3567         0   -0.3327    0.0272    0.0272    0.0919
   -0.2640   -0.3327         0   -0.0198   -0.0198    0.0799
    0.0542    0.0272   -0.0198         0   -0.0198    0.0799
    0.0542    0.0272   -0.0198   -0.0198         0   -0.2008
    0.0938    0.0919    0.0799    0.0799   -0.2008         0
    0.0938    0.0919    0.0799    0.0799   -0.2008   -0.4344
    0.1260    0.1185    0.1062    0.1062    0.0939   -0.0811
    0.1260    0.1185    0.1062    0.1062    0.0939    0.0393
    0.1260    0.1185    0.1062    0.1062    0.0939    0.0393

  Columns 7 through 10

    0.0938    0.1260    0.1260    0.1260
    0.0919    0.1185    0.1185    0.1185
    0.0799    0.1062    0.1062    0.1062
    0.0799    0.1062    0.1062    0.1062
   -0.2008    0.0939    0.0939    0.0939
   -0.4344   -0.0811    0.0393    0.0393
         0   -0.1741   -0.0907   -0.0734
   -0.1741         0   -0.0907   -0.0734
   -0.0907   -0.0907         0   -0.1526
   -0.0734   -0.0734   -0.1526         0


outpermone =

     1     2     3     4     5     6     7     8     9    10


outpermtwo =

     5     9     3     1     7    10     4     2     8     6
\end{verbatim}

\large

\section[Circular-Anti-Robinson (CAR) Matrices]{Circular-Anti-Robinson  (CAR) Matrices for Symmetric Proximity Data}


In the approximation of a proximity matrix $\mathbf{P}$ by one
that is row/column reorderable to an AR form, the interpretation
of the fitted matrix in general had to be carried out  by
identifying a set of subsets through an increasing threshold
variable; each of the subsets contained objects that were
contiguous with respect to a given \emph{linear}  ordering along
a
continuum, and had a diameter defined by the maximum fitted value
within the subset.  To provide a further representation depicting the fitted values as lengths of paths in a graph, an
approximation was sought that satisfied the additional
constraints of an SAR matrix; still, the subsets thus identified
had
to contain objects contiguous with respect to a linear
ordering.  As one possible generalization of both
the AR and SAR constraints, we can define what will be called
circular anti-Robinson (CAR) and circular strongly-anti-Robinson
(CSAR) forms that allow the subsets identified from
increasing a threshold variable to be contiguous with respect to
a
\emph{circular} ordering of the objects around a closed
continuum.  Approximation matrices that are row/column
reorderable to display an AR or SAR form, respectively, will also
be (trivially) row/column reorderable to display what is
formally characterized below as a CAR  or a CSAR form, but not
conversely.  (Historically, there is a large literature on the possibility of circular structures emerging from and being identifiable in a given proximity matrix.  For a variety of references,  the reader is referred to the American Psychological Association sponsored volume edited by Plutchik and Conte (1997), or the discussion of metric circular unidimensional scaling from the Unidimensional Scaling Toolbox.   The extension of CAR forms to those that are also CSAR, however, has apparently not been a topic discussed in the literature before the appearance of Hubert, Arabie, and Meulman [1998];    this latter source forms the basis for much of the present section.)


\smallskip


To be explicit, an arbitrary symmetric matrix $\mathbf{Q} =
\{q_{ij}\}$, where $q_{ii} = 0$ for $1 \leq i,j \leq n$, is said
to be row/column reorderable to a circular anti-Robinson form
(or, for short, $\mathbf{Q}$ is a circular anti-Robinson (CAR)
matrix) if there exists a permutation, $\rho(\cdot)$, on the
first $n$ integers such that the reordered matrix
$\mathbf{Q}_{\rho} = \{q_{\rho(i) \rho(j) }\}$ satisfies the
conditions given in (II):

\medskip

\noindent (II):  for $1 \leq i \leq n-3$, and $i+1 < j \leq n-1$,

\smallskip

if $q_{\rho(i+1) \rho(j)} \leq  q_{\rho(i) \rho(j+1)}$, then

$q_{\rho(i+1) \rho(j)} \leq  q_{\rho(i) \rho(j)}$ and
$q_{\rho(i+1) \rho(j)} \leq  q_{\rho(i+1) \rho(j+1)}$;

\smallskip

if $q_{\rho(i+1) \rho(j)} \geq  q_{\rho(i) \rho(j+1)}$, then

$q_{\rho(i) \rho(j)} \geq  q_{\rho(i) \rho(j+1)}$ and
$q_{\rho(i+1) \rho(j+1)} \geq  q_{\rho(i)
 \rho(j+1)}$,

\smallskip


and, for $2 \leq i \leq n-2$,

\smallskip

if $q_{\rho(i+1) \rho(n)} \leq  q_{\rho(i) \rho(1)}$, then

$q_{\rho(i+1) \rho(n)} \leq  q_{\rho(i) \rho(n)}$ and
$q_{\rho(i+1) \rho(n)} \leq  q_{\rho(i+1) \rho(1)}$;

\smallskip

if $q_{\rho(i+1) \rho(n)} \geq  q_{\rho(i) \rho(1)}$, then

$q_{\rho(i) \rho(n)} \geq  q_{\rho(i) \rho(1)}$ and
$q_{\rho(i+1) \rho(1)} \geq  q_{\rho(i) \rho(1)}$.

\medskip

\noindent Interpretatively, within each row of
$\mathbf{Q}_{\rho}$ moving to the right from the main diagonal
and then wrapping back around to re-enter the same row from the
left, the entries never
decrease until a maximum is reached and then never increase
moving away from the maximum until the main diagonal is again
reached.  Given the symmetry of $\mathbf{P}$, a similar pattern
of entries
would be present within each column as well.  As noted above, any
AR matrix is CAR but not conversely.

\smallskip

In analogy to the SAR conditions that permit graphical
representation, a symmetric matrix $\mathbf{Q}$ is said to be
row/column reorderable to a circular strongly-anti-Robinson form
(or, for short, $\mathbf{Q}$ is a \emph{circular strongly-anti-Robinson}
(CSAR) matrix) if there exists a permutation, $\rho(\cdot)$, on
the first $n$ integers such that the reordered matrix
$\mathbf{Q}_{\rho} = \{q_{\rho(i) \rho(j)} \}$ satisfies the
conditions given by (II), \emph{and}

\medskip

for $1 \leq i \leq n-3$, and $i+1 < j \leq n-1$,

\smallskip

if $q_{\rho(i+1) \rho(j)} \leq  q_{\rho(i) \rho(j+1)}$,

 then
$q_{\rho(i+1) \rho(j)} =  q_{\rho(i) \rho(j)}$ im\-plies
$q_{\rho(i+1) \rho(j+1)} =  q_{\rho(i) \rho(j+1)}$, and
$q_{\rho(i+1) \rho(j)} =  q_{\rho(i+1) \rho(j+1)}$ im\-plies
 $q_{\rho(i) \rho(j)} =  q_{\rho(i) \rho(j+1)}$;

\smallskip

if $q_{\rho(i+1) \rho(j)} \geq  q_{\rho(i) \rho(j+1)}$,

then
$q_{\rho(i) \rho(j+1)} =  q_{\rho(i+1) \rho(j+1)}$ im\-plies
$q_{\rho(i) \rho(j)} =  q_{\rho(i+1) \rho(j)}$, and
$q_{\rho(i) \rho(j)} =  q_{\rho(i) \rho(j+1)}$ im\-plies
$q_{\rho(i+1) \rho(j)} =  q_{\rho(i+1) \rho(j+1)}$,

\medskip

and for $2 \leq i \leq n - 2$,

\smallskip


if $q_{\rho(i+1) \rho(n)} \leq  q_{\rho(i) \rho(1)}$, then
$q_{\rho(i+1) \rho(n)} =  q_{\rho(i) \rho(n)}$ im\-plies
$q_{\rho(i+1) \rho(1)} =  q_{\rho(i) \rho(1)}$, and
$q_{\rho(i+1) \rho(n)}$ $= q_{\rho(i+1) \rho(1)}$ im\-plies
$q_{\rho(i) \rho(n)} =  q_{\rho(i) \rho(1)}$;

\smallskip

if $q_{\rho(i+1) \rho(n)} \geq  q_{\rho(i) \rho(1)}$, then
$q_{\rho(i) \rho(1)}$ = $q_{\rho(i+1) \rho(1)}$ i\-mplies
$q_{\rho(i) \rho(n)}$ = $q_{\rho(i+1) \rho(n)}$, and
$q_{\rho(i) \rho(n)}$ = $q_{\rho(i) \rho(1)}$ im\-plies
$q_{\rho(i+1) \rho(n)}$ = $q_{\rho(i+1) \rho(1)}$.


\medskip

\noindent Again, the imposition of the stronger CSAR conditions
avoids the type
of graphical anomaly present in Figure 1(b) but now in the
context of a CAR
matrix --- when two fitted values that are adjacent within a row
are equal, the
fitted values in the same two adjacent columns must also be equal
for a row that
is either its immediate predecessor (if $q_{\rho(i+1) \rho(j)}
\leq q_{\rho(i)
\rho(j+1)}$), or successor (if $q_{\rho(i+1) \rho(j)} \geq
q_{\rho(i)
\rho(j+1)}$); a similar condition is imposed when two fitted
values that are
adjacent within a column are equal.  As noted,
any SAR matrix is CSAR but not conversely.

\smallskip


The computational strategy we suggest for identifying a
best-fitting CAR or CSAR approximation matrix is based on an
initial
circular unidimensional scaling obtained through the optimization
strategy developed by Hubert, Arabie, and Meulman (1997).
Specifically, we first institute a combination of combinatorial search for good
matrix reorderings and heuristic iterative projection to locate
the points of inflection when  minimum distance calculations
change directionality around a closed circular structure.
Approximation matrices to $\mathbf{P}$ are found through a
least-squares loss criterion, and they have the parameterized form
\[\mathbf{Q}_{\rho} = \{ \min(\mid x_{\rho(j)} - x_{\rho(i)} \mid
, \  x_{0} - \mid x_{\rho(j)} - x_{\rho(i)} \mid ) \ +c\} ,\]
where $c$ is an estimated additive constant, $x_{\rho(1)} \leq
x_{\rho(2)} \leq \cdots \leq x_{\rho(n)} \leq x_{0}$, and the
last
coordinate, $x_{0}$, is the circumference of the circular
structure.  Based on the inequality constraints implied by such a
collection of coordinates, a CAR approximation matrix can be
fitted
to $\mathbf{P}$ directly; then, beginning with this latter CAR
approximation, the identification and imposition of CSAR
constraints  proceeds through the heuristic use of iterative
projection, directly analogous to the way SAR constraints
in the linear  ordering context were identified and fitted,
beginning with a best approximation matrix satisfying just the
AR restrictions.

\subsection{Fitting a Given CAR Matrix in the $L_{2}$-Norm}


The  function M-file, \verb+cirarobfit.m+, fits a circular anti-Robinson (CAR) matrix using iterative projection to
 a symmetric proximity matrix in the $L_{2}$-norm.  Usage syntax is
\begin{verbatim}
[fit, vaf] = cirarobfit(prox,inperm,targ)
\end{verbatim}
\noindent where \verb+PROX+ is the input proximity matrix ($n \times n$ with a zero main diagonal
 and a dissimilarity interpretation);
 \verb+INPERM+ is a given permutation of the first $n$ integers (around a circle);
 \verb+TARG+ is a given $n \times n$ matrix having the circular anti-Robinson
 form that guides the direction in which distances are taken around the circle.
 The matrix \verb+FIT+ is the least-squares optimal approximation (with variance-accounted-for
 of \verb+VAF+) to \verb+PROX+ having an circular anti-Robinson form for the row and column
 object ordering given by \verb+INPERM+.

 \smallskip

A recording of a MATLAB  session follows that uses the \verb+number.dat+ data file; an equally-spaced circular anti-Robinson matrix \verb+targcircular+ obtained from the utility M-file, \verb+targcir.m+; and the identity permutation for the objects around the circular structure.  The fitted CAR matrix thus identified in this way has a \verb+VAF+ of 64.37\%.

\tiny

\begin{verbatim}
 load number.dat
 targcircular = targcir(10);
 [fit vaf] = cirarobfit(number,1:10,targcircular)

fit =

  Columns 1 through 6

         0    0.4210    0.5840    0.6510    0.6835    0.8040
    0.4210         0    0.2840    0.3460    0.6170    0.6170
    0.5840    0.2840         0    0.2753    0.2753    0.5460
    0.6510    0.3460    0.2753         0    0.2753    0.3844
    0.6835    0.6170    0.2753    0.2753         0    0.3844
    0.8040    0.6170    0.5460    0.3844    0.3844         0
    0.7730    0.7730    0.5460    0.3844    0.3844    0.3844
    0.7695    0.7695    0.7960    0.5920    0.5530    0.4000
    0.6597    0.6597    0.6597    0.8040    0.5530    0.5530
    0.6510    0.6510    0.6510    0.6510    0.6835    0.5920

  Columns 7 through 10

    0.7730    0.7695    0.6597    0.6510
    0.7730    0.7695    0.6597    0.6510
    0.5460    0.7960    0.6597    0.6510
    0.3844    0.5920    0.8040    0.6510
    0.3844    0.5530    0.5530    0.6835
    0.3844    0.4000    0.5530    0.5920
         0    0.3857    0.3857    0.3857
    0.3857         0    0.3857    0.3857
    0.3857    0.3857         0    0.3857
    0.3857    0.3857    0.3857         0


vaf =

    0.6437
\end{verbatim}

\large


\subsection{Finding a CAR Matrix in the $L_{2}$-Norm}

The M-file, \verb+cirarobfnd.m+, is our suggested strategy for identifying a best-fitting CAR matrix for
a symmetric proximity matrix in the $L_{2}$-norm based on a permutation that is
initially identified through the use of iterative quadratic assignment.  Based on an equally-spaced circular target matrix, \verb+order.m+ is first invoked to obtain a good (circular) permutation, which in turn is then used to construct a new circular target matrix with \verb+cirfit.m+. (We will mention here but not illustrate with an example, an alternative to the use of \verb+cirarobfnd.m+ called \verb+cirarobfnd_ac.m+; the latter M-file has the same syntax as
\verb+cirarobfnd.m+ but uses \verb+cirfitac.m+ rather than \verb+cirfit.m+ internally to obtain the new circular target matrices.)   The final output is generated from \verb+cirarobfit.m+  that no better permutation can be identified using the newer circular target matrix.   The usage syntax for \verb+cirarobfnd.m+ is as follows:
\begin{verbatim}
[find, vaf, outperm] = cirarobfnd(prox, inperm, kblock)
\end{verbatim}
\noindent where
 \verb+PROX+ is the input proximity matrix ($n \times n$ with a zero main diagonal
 and a dissimilarity interpretation);
 \verb+INPERM+ is a given starting permutation (assumed to be around the
 circle) of the first $n$ integers;
 \verb+FIND+ is the least-squares optimal matrix (with variance-accounted-for
 of \verb+VAF+) to \verb+PROX+ having a circular anti-Robinson form for the row and column
 object ordering given by the concluding permutation \verb+OUTPERM+. Again, \verb+KBLOCK+
 defines the block size in the use of the iterative quadratic assignment
 routine.

 \smallskip

An example of the use of \verb+cirarobfnd.m+ is given below that seems to lead to a circular ordering best interpreted according to the structural properties of the digits.  This solution is only one of several local optima identifiable by repeated application of  the routine using other random starting permutations. In general, the different local
optima observed differ in the way the odd digits,
$\{3,5,7,9\}$, and the even digits, $\{2,4,6,8\}$, are ordered
within these sets when moving clockwise around a circular
structure.
Explicitly, all local optima had a general structure of
$\rightarrow 0 \rightarrow 1 \rightarrow \{3,5,7,9\} \rightarrow
\{2,4,6,8\} \rightarrow$, but with some variation in order within
the odd and even digits.  For example, the CAR matrix given below
uses the odd digits as $\rightarrow 3 \rightarrow 5 \rightarrow
9 \rightarrow 7 \rightarrow$ and the even digits as
$\rightarrow 6 \rightarrow 8 \rightarrow 4 \rightarrow 2
\rightarrow$.

\tiny

\begin{verbatim}
[find, vaf, outperm] = cirarobfnd(number, randperm(10), 3)

find =

  Columns 1 through 6

         0    0.3460    0.5315    0.5315    0.6069    0.8040
    0.3460         0    0.4210    0.4340    0.6069    0.7895
    0.5315    0.4210         0    0.4340    0.6069    0.7895
    0.5315    0.4340    0.4340         0    0.0590    0.3670
    0.6069    0.6069    0.6069    0.0590         0    0.2460
    0.8040    0.7895    0.7895    0.3670    0.2460         0
    0.4460    0.7895    0.7895    0.4210    0.3880    0.3500
    0.4460    0.6300    0.9090    0.7697    0.6069    0.3960
    0.4160    0.6250    0.8500    0.7698    0.6069    0.3960
    0.4160    0.5880    0.7698    0.7698    0.6069    0.6069

  Columns 7 through 10

    0.4460    0.4460    0.4160    0.4160
    0.7895    0.6300    0.6250    0.5880
    0.7895    0.9090    0.8500    0.7698
    0.4210    0.7697    0.7698    0.7698
    0.3880    0.6069    0.6069    0.6069
    0.3500    0.3960    0.3960    0.6069
         0    0.3907    0.3907    0.4160
    0.3907         0    0.3907    0.4160
    0.3907    0.3907         0    0.4160
    0.4160    0.4160    0.4160         0


vaf =

    0.8128


outperm =

     4     2     1     3     5     9     7     8    10     6
\end{verbatim}

\large

\subsection{Finding a Circular Strongly-Anti-Robinson (CSAR) Matrix in the $L_{2}$-Norm}

The two M-functions, \verb+cirsarobfit.m+ and \verb+cirsarobfnd.m+, are direct analogues of \verb+cirarobfit.m+ and \verb+cirarobfnd.m+, respectively, but are concerned with fitting and finding  \emph{strongly} circular-anti-Robinson forms (also, we mention but do not illustrate, the M-file \verb+cirsarobfnd_ac.m+ which uses \verb+cirarobfnd_ac.m+ to obtain the initial CAR matrix that is then strengthened into one that is CSAR).  The syntax for \verb+cirsarobfit.m+, which fits a circular strongly-anti-Robinson matrix using iterative projection to
 a symmetric proximity matrix in the $L_{2}$-norm, is
\begin{verbatim}
[fit, vaf] = cirsarobfit(prox, inperm, targ)
\end{verbatim}
\noindent where, again, \verb+PROX+ is the input proximity matrix ($n \times n$ with a zero main diagonal
 and a dissimilarity interpretation); \verb+INPERM+ is a given permutation of the first $n$ integers; \verb+TARG+ is a given $n \times n$ matrix having the circular anti-Robinson
 form that guides the direction in which distances are taken around the circle.
 \verb+FIT+ is the least-squares optimal matrix (with variance-accounted-for
 of \verb+VAF+) to \verb+PROX+ having a strongly circular-anti-Robinson form for the row and column
 object ordering given by \verb+INPERM+.

 \smallskip

An example follows using the same identity permutation as in fitting a CAR form with \verb+cirarobfit.m+; as might be expected from using the more restrictive CSAR form, the variance-accounted-for drops to .4501 from .6437.

\tiny

\begin{verbatim}
[fit, vaf] = cirsarobfit(number,1:10,targcircular)

fit =

  Columns 1 through 6

         0    0.4210    0.5840    0.6505    0.6505    0.6505
    0.4210         0    0.2840    0.6505    0.6505    0.6505
    0.5840    0.2840         0    0.2753    0.2753    0.4306
    0.6505    0.6505    0.2753         0    0.2753    0.4306
    0.6505    0.6505    0.2753    0.2753         0    0.4306
    0.6505    0.6505    0.4306    0.4306    0.4306         0
    0.6505    0.6505    0.4306    0.4306    0.4306    0.4306
    0.6505    0.6505    0.6505    0.6505    0.6505    0.6505
    0.6505    0.6505    0.6505    0.6505    0.6505    0.6505
    0.6505    0.6505    0.6505    0.6505    0.6505    0.6505

  Columns 7 through 10

    0.6505    0.6505    0.6505    0.6505
    0.6505    0.6505    0.6505    0.6505
    0.4306    0.6505    0.6505    0.6505
    0.4306    0.6505    0.6505    0.6505
    0.4306    0.6505    0.6505    0.6505
    0.4306    0.6505    0.6505    0.6505
         0    0.3857    0.3857    0.3857
    0.3857         0    0.3857    0.3857
    0.3857    0.3857         0    0.3857
    0.3857    0.3857    0.3857         0


vaf =

    0.4501
\end{verbatim}

\large

The M-function, \verb+cirsarobfnd.m+, finds and fits a CSAR matrix using iterative projection to
 a symmetric proximity matrix in the $L_{2}$-norm based on a permutation
 identified through the use of iterative quadratic assignment.  It has the expected syntax
\begin{verbatim}
[find, vaf, outperm] = cirsarobfnd(prox, inperm, kblock)
\end{verbatim}
 \noindent where, again, \verb+PROX+ is the input proximity matrix ($n \times n$ with a zero main diagonal
 and a dissimilarity interpretation); \verb+INPERM+ is a given starting permutation of the first $n$ integers;
 \verb+FIND+ is the least-squares optimal matrix (with variance-accounted-for
 of \verb+VAF+) to \verb+PROX+ having a circular strongly-anti-Robinson form for the row and column
 object ordering given by the ending permutation \verb+OUTPERM+. As usual, \verb+KBLOCK+
 defines the block size in the use the iterative quadratic assignment
 routine. (Analogous to the last section, and as noted above, an alternative to \verb+cirsarobfnd.m+
is available, called \verb+cirsarobfnd_ac.m+  that uses \verb+cirfitac.m+ to obtain the circular target matrices.)

\smallskip

In the MATLAB  recording below, and starting from a random permutation, a circular strongly anti-Robinson form was found with a \verb+VAF+ of .7296 (again, this represents an expected drop from the value of .8119 for the CAR form --- this result is also listed below)).

\tiny


\begin{verbatim}
[find, vaf, outperm] = cirsarobfnd(number,randperm(10), 2)

target =

  Columns 1 through 6

         0    0.4160    0.4160    0.4160    0.6262    0.6262
    0.4160         0    0.3907    0.3907    0.3960    0.6263
    0.4160    0.3907         0    0.3907    0.3960    0.6263
    0.4160    0.3907    0.3907         0    0.3500    0.3880
    0.6262    0.3960    0.3960    0.3500         0    0.2460
    0.6262    0.6263    0.6263    0.3880    0.2460         0
    0.7858    0.7858    0.7858    0.4210    0.3670    0.0590
    0.7858    0.7858    0.9090    0.7895    0.7895    0.5810
    0.5880    0.6250    0.6300    0.7895    0.7895    0.5810
    0.4160    0.4160    0.4460    0.4460    0.8040    0.5810

  Columns 7 through 10

    0.7858    0.7858    0.5880    0.4160
    0.7858    0.7858    0.6250    0.4160
    0.7858    0.9090    0.6300    0.4460
    0.4210    0.7895    0.7895    0.4460
    0.3670    0.7895    0.7895    0.8040
    0.0590    0.5810    0.5810    0.5810
         0    0.4340    0.4340    0.5315
    0.4340         0    0.4210    0.5315
    0.4340    0.4210         0    0.3460
    0.5315    0.5315    0.3460         0


vaf =

    0.8119


outperm =

     6    10     8     7     9     5     3     1     2     4


find =

  Columns 1 through 6

         0    0.4246    0.4246    0.4246    0.7304    0.7304
    0.4246         0    0.3907    0.3907    0.3960    0.7304
    0.4246    0.3907         0    0.3907    0.3960    0.7304
    0.4246    0.3907    0.3907         0    0.3500    0.3880
    0.7304    0.3960    0.3960    0.3500         0    0.2460
    0.7304    0.7304    0.7304    0.3880    0.2460         0
    0.7304    0.7304    0.7304    0.4210    0.3670    0.0590
    0.7304    0.7304    0.7304    0.7304    0.7304    0.5810
    0.7304    0.7304    0.7304    0.7304    0.7304    0.5810
    0.4246    0.4246    0.4246    0.4246    0.7304    0.5810

  Columns 7 through 10

    0.7304    0.7304    0.7304    0.4246
    0.7304    0.7304    0.7304    0.4246
    0.7304    0.7304    0.7304    0.4246
    0.4210    0.7304    0.7304    0.4246
    0.3670    0.7304    0.7304    0.7304
    0.0590    0.5810    0.5810    0.5810
         0    0.4340    0.4340    0.5315
    0.4340         0    0.4210    0.5315
    0.4340    0.4210         0    0.3460
    0.5315    0.5315    0.3460         0


vaf =

    0.7296


outperm =

     6    10     8     7     9     5     3     1     2     4
\end{verbatim}

\large




\subsection{Representation Through Multiple (Strongly) CAR Matrices}

Just as we discussed  representing of proximity matrices through multiple (strongly) AR matrices, the analysis of a proximity matrix by a single (strongly) circular-anti-Robinson structure extends easily to the additive use of multiple matrices.  The M-function, \verb+bicirarobfnd.m+, fits the sum of two circular-anti-Robinson matrices using iterative projection to a symmetric proximity matrix in the $L_{2}$-norm based on permutations
 identified through the use of iterative quadratic assignment.  The syntax usage is
\begin{verbatim}
[find,vaf,targone,targtwo,outpermone,outpermtwo] = ...
bicirarobfnd(prox,inperm,kblock)
\end{verbatim}
 \noindent where, as before, \verb+PROX+ is the input proximity matrix ($n \times n$ with a zero main diagonal
 and a dissimilarity interpretation);
 \verb+INPERM+ is a given initial permutation of the first $n$ integers;
 \verb+FIND+ is the least-squares optimal matrix (with variance-accounted-for
 of \verb+VAF+) to \verb+PROX+ and is the sum of the two circular-anti-Robinson matrices
 \verb+TARGONE+ and \verb+TARGTWO+ based on the two row and column
 object orderings given by the final permutations \verb+OUTPERMONE+
 and \verb+OUTPERMTWO+. As before, \verb+KBLOCK+ defines the block size in the use  of the
 iterative quadratic assignment routine.


 \tiny

\begin{verbatim}
  [find,vaf,targone,targtwo,outpermone,outpermtwo] = ...
bicirarobfnd(number,randperm(10),1)

find =

  Columns 1 through 6

         0    0.4210    0.5632    0.7297    0.6840    0.8040
    0.4210         0    0.3048    0.3252    0.6460    0.5880
    0.5632    0.3048         0    0.3540    0.0380    0.6535
    0.7297    0.3252    0.3540         0    0.4340    0.4154
    0.6840    0.6460    0.0380    0.4340         0    0.4401
    0.8040    0.5880    0.6535    0.4154    0.4401         0
    0.7871    0.7580    0.4208    0.3317    0.3565    0.3963
    0.9090    0.6380    0.8131    0.5750    0.7418    0.4000
    0.8210    0.7926    0.3881    0.7841    0.2460    0.6710
    0.8521    0.6380    0.7841    0.2631    0.6830    0.5899

  Columns 7 through 10

    0.7871    0.9090    0.8210    0.8521
    0.7580    0.6380    0.7926    0.6380
    0.4208    0.8131    0.3881    0.7841
    0.3317    0.5750    0.7841    0.2631
    0.3565    0.7418    0.2460    0.6830
    0.3963    0.4000    0.6710    0.5899
         0    0.4176    0.3500    0.2960
    0.4176         0    0.4000    0.4590
    0.3500    0.4000         0    0.3920
    0.2960    0.4590    0.3920         0


vaf =

    0.9955


targone =

  Columns 1 through 6

         0    0.0858    0.0858    0.3086    0.4576    0.4576
    0.0858         0    0.0096    0.2443    0.2443    0.3863
    0.0858    0.0096         0    0.2133    0.2391    0.2391
    0.3086    0.2443    0.2133         0    0.0994    0.1207
    0.4576    0.2443    0.2391    0.0994         0    0.1207
    0.4576    0.3863    0.2391    0.1207    0.1207         0
    0.4818    0.4818    0.3631    0.2195    0.2195    0.2195
    0.4818    0.4818    0.4818    0.2195    0.2195    0.2195
    0.3153    0.4902    0.4902    0.4902    0.4711    0.3356
    0.3153    0.4361    0.4628    0.4902    0.7370    0.7185

  Columns 7 through 10

    0.4818    0.4818    0.3153    0.3153
    0.4818    0.4818    0.4902    0.4361
    0.3631    0.4818    0.4902    0.4628
    0.2195    0.2195    0.4902    0.4902
    0.2195    0.2195    0.4711    0.7370
    0.2195    0.2195    0.3356    0.7185
         0   -0.0393    0.3356    0.4818
   -0.0393         0    0.3356    0.4818
    0.3356    0.3356         0    0.2371
    0.4818    0.4818    0.2371         0


targtwo =

  Columns 1 through 6

         0    0.0765    0.1367    0.2969    0.2969    0.2969
    0.0765         0    0.0289    0.2395    0.3704    0.3704
    0.1367    0.0289         0    0.1609    0.3582    0.4319
    0.2969    0.2395    0.1609         0    0.1905    0.2793
    0.2969    0.3704    0.3582    0.1905         0    0.0670
    0.2969    0.3704    0.4319    0.2793    0.0670         0
    0.2678    0.3024    0.3024    0.3024    0.1839    0.1169
    0.1122    0.3024    0.3024    0.3555    0.2480    0.1959
    0.1122    0.3024    0.3024    0.3555    0.2480    0.1959
    0.1122    0.2012    0.2364    0.3555    0.2480    0.1959

  Columns 7 through 10

    0.2678    0.1122    0.1122    0.1122
    0.3024    0.3024    0.3024    0.2012
    0.3024    0.3024    0.3024    0.2364
    0.3024    0.3555    0.3555    0.3555
    0.1839    0.2480    0.2480    0.2480
    0.1169    0.1959    0.1959    0.1959
         0   -0.0105   -0.0105    0.1558
   -0.0105         0   -0.1278   -0.0478
   -0.0105   -0.1278         0   -0.0478
    0.1558   -0.0478   -0.0478         0


outpermone =

     3     5     9     7     6     8    10     4     2     1


outpermtwo =

     7    10     9     8     1     6     2     3     4     5
\end{verbatim}


\large

For finding multiple CSAR forms,  \verb+bicirsarobfnd.m+ has usage syntax
\begin{verbatim}
[find,vaf,targone,targtwo,outpermone,outpermtwo] = ...
bicirsarobfnd(prox,inperm,kblock)
\end{verbatim}
\noindent with all the various terms the same as for \verb+bicirarobfnd.m+ but now for strongly CAR (CSAR) structures.  The example below finds essentially the same representation as above (involving digit magnitude and structure) with a slight drop in the \verb+VAF+ from 99.55\% for CAR to 91.06\% for CSAR.

\tiny

\begin{verbatim}
  [find,vaf,targone,targtwo,outpermone,outpermtwo] = ...
bicirsarobfnd(number,randperm(10),1)

find =

  Columns 1 through 6

         0    0.4212    0.6464    0.6464    0.6840    0.8040
    0.4212         0    0.3284    0.3284    0.5122    0.6693
    0.6464    0.3284         0    0.3273    0.0947    0.6682
    0.6464    0.3284    0.3273         0    0.5111    0.3505
    0.6840    0.5122    0.0947    0.5111         0    0.4090
    0.8040    0.6693    0.6682    0.3505    0.4090         0
    0.8420    0.7215    0.4802    0.4027    0.4493    0.3718
    0.8420    0.7215    0.7215    0.6565    0.6906    0.4000
    0.8420    0.7215    0.3041    0.7204    0.2732    0.6895
    0.8420    0.7215    0.7204    0.2630    0.6895    0.5540

  Columns 7 through 10

    0.8420    0.8420    0.8420    0.8420
    0.7215    0.7215    0.7215    0.7215
    0.4802    0.7215    0.3041    0.7204
    0.4027    0.6565    0.7204    0.2630
    0.4493    0.6906    0.2732    0.6895
    0.3718    0.4000    0.6895    0.5540
         0    0.4055    0.2292    0.3339
    0.4055         0    0.4705    0.4055
    0.2292    0.4705         0    0.4694
    0.3339    0.4055    0.4694         0


vaf =

    0.9106


targone =

  Columns 1 through 6

         0    0.3924    0.6326    0.6326    0.6326    0.6337
    0.3924         0    0.3149    0.3149    0.4970    0.5686
    0.6326    0.3149         0    0.3149    0.4970    0.5686
    0.6326    0.3149    0.3149         0    0.1752    0.5686
    0.6326    0.4970    0.4970    0.1752         0    0.5686
    0.6337    0.5686    0.5686    0.5686    0.5686         0
    0.6337    0.6337    0.6337    0.6337    0.6337    0.6337
    0.6337    0.6337    0.6337    0.6337    0.6337    0.6337
    0.2162    0.3924    0.6326    0.6326    0.6326    0.6337
    0.2162    0.3924    0.6326    0.6326    0.6326    0.6337

  Columns 7 through 10

    0.6337    0.6337    0.2162    0.2162
    0.6337    0.6337    0.3924    0.3924
    0.6337    0.6337    0.6326    0.6326
    0.6337    0.6337    0.6326    0.6326
    0.6337    0.6337    0.6326    0.6326
    0.6337    0.6337    0.6337    0.6337
         0    0.4085    0.6337    0.6337
    0.4085         0    0.6337    0.6337
    0.6337    0.6337         0    0.2162
    0.6337    0.6337    0.2162         0


targtwo =

  Columns 1 through 6

         0   -0.2236    0.0570    0.0570    0.0570    0.0570
   -0.2236         0   -0.1686    0.0570    0.0570    0.0570
    0.0570   -0.1686         0   -0.1632   -0.1632   -0.1632
    0.0570    0.0570   -0.1632         0   -0.1632   -0.1632
    0.0570    0.0570   -0.1632   -0.1632         0   -0.1632
    0.0570    0.0570   -0.1632   -0.1632   -0.1632         0
    0.0503    0.1703    0.2083    0.2083    0.2083    0.2083
   -0.1215    0.0356    0.0878    0.0878    0.0878    0.0878
   -0.1215    0.0356    0.0878    0.0878    0.0878    0.0878
   -0.1215    0.0356    0.0878    0.0878    0.0878    0.0878

  Columns 7 through 10

    0.0503   -0.1215   -0.1215   -0.1215
    0.1703    0.0356    0.0356    0.0356
    0.2083    0.0878    0.0878    0.0878
    0.2083    0.0878    0.0878    0.0878
    0.2083    0.0878    0.0878    0.0878
    0.2083    0.0878    0.0878    0.0878
         0    0.0127    0.0127    0.0127
    0.0127         0   -0.3053   -0.3053
    0.0127   -0.3053         0   -0.3053
    0.0127   -0.3053   -0.3053         0


outpermone =

     5     7     6     4    10     8     2     1     9     3


outpermtwo =

     5     6     8     9    10     7     1     4     3     2
\end{verbatim}


\large

\section{Anti-Robinson (AR) Matrices for Two-Mode  Proximity Data}

In direct analogy to the extensions of Linear Unidimensional Scaling (LUS), it is possible to find and fit (more general) anti-Robinson (AR) forms to two-mode proximity matrices.  The same type of reordering strategy implemented by \verb+ordertm.m+ would be used, but the more general AR form would be fitted to the reordered square proximity matrix, $\mathbf{P}^{(tm)}_{\rho_{0}} = \{p^{(tm)}_{\rho_{0}(i) \rho_{0}(j)}\}$; the least-squares criterion
\[ \sum_{i,j = 1}^{n} w_{\rho_{0}(i) \rho_{0}(j)}(p^{(tm)}_{\rho_{0}(i) \rho_{0}(j)} - \hat{p}_{ij})^{2} , \]
is minimized, where  $w_{\rho_{0}(i) \rho_{0}(j)} = 0$ if $\rho_{0}(i)$ and $\rho_{0}(j)$ are both row or both column objects, and $= 1$ otherwise.  The entries in the matrix $\{\hat{p}_{ij}\}$ fitted to $\mathbf{P}^{(tm)}_{\rho_{0}}$ are AR in form (and which correspond to nonzero values of the weight function $w_{\rho_{0}(i) \rho_{0}(j)}$), and thus satisfy certain linear inequality constraints generated from how the row and column objects are intermixed by the given permutation $\rho_{0}(\cdot)$.   We note here and discuss this more completely in the section to follow that the patterning of entries in $\{\hat{p}_{ij}\}$  fitted to the original two-mode proximity matrix, with appropriate row and column permutations extracted from $\rho_{0}$, is called an anti-Q-form.

\subsection{Fitting and Finding Two-Mode AR Matrices}

The M-file \verb+arobfittm.m+ does a confirmatory two-mode anti-Robinson fitting of a given
ordering of the row and column objects of a two-mode proximity matrix
using the Dykstra-Kaczmarz iterative projection least-squares method.  The usage syntax has the form
\begin{verbatim}
[fit,vaf,rowperm,colperm] = arobfittm(proxtm,inperm)
\end{verbatim}
\noindent where \verb+PROXTM+ is the input two-mode proximity matrix; \verb+INPERM+ is the given ordering of the row and column objects together; \verb+FIT+  is an $n_{a} \times n_{b}$ (number of rows by number of columns) matrix
fitted to \verb+PROXTM(ROWPERM,COLPERM)+ with \verb+VAF+ being the variance-accounted-for
based on the (least-squares criterion) sum of
squared discrepancies between \verb+PROXTM(ROWPERM,COLMEAN)+ and \verb+FIT+; \verb+ROWPERM+ and \verb+COLPERM+ are the row and column object orderings derived from \verb+INPERM+.

\smallskip

The matrix given by \verb+FIT+ that is intended to approximate the row and column permuted two-mode proximity matrix, \verb+PROXTM(ROWPERM,COLPERM)+, displays a particularly important patterning of its entries called an anti-Q-form in the literature (see Hubert and Arabie, 1995,   for an extended discussion of this type of patterning for a two-mode matrix).  Specifically, a matrix is said to have the anti-Q-form (for rows and columns) if within each row and column the entries are nonincreasing to a minimum and thereafter nondecreasing.  \emph{Matrices satisfying the anti-Q-form have a convenient interpretation presuming an underlying unidimensional scale that jointly represents both the row and column objects}.   Explicitly, suppose a matrix has been appropriately row-ordered to display the anti-Q-form for columns.  Any dichotomization of the entries within a column at some threshold value (using 0 for entries below the threshold and 1 if at or above), produces a matrix that has the consecutive zeros property within each column, that is, all zeros within a column occur consecutively, uninterrupted by intervening ones.  In turn, any matrix with the consecutive zeros property for columns suggests the existence of a perfect scale (error-free), where row objects can be ordered along a continuum (using the same row order for the matrix that actually reflects the anti-Q-form for columns), and each column object is representable as an interval along the continuum (encompassing those consecutive row objects corresponding to zeros).
Historically, the type of pattern represented by the anti-Q-form has played a major role in the literature of (unidimensional) unfolding, and for example, is the basis of Coombs's (1964, Chapter 4)  parallelogram structure for a two-mode proximity matrix.  The reader is referred to Hubert (1974) for a review of some of these connections.

\smallskip


To provide an example of what an anti-Q-form looks like for our two-mode data matrix, \verb+goldfish_receptor+, we will use \verb+arobfndtm.m+  both to find and fit an anti-Robinson form using iterative projection to
a two-mode proximity matrix in the $L_{2}$-norm based on a permutation
identified through the use of iterative quadratic assignment. The usage syntax is
\begin{verbatim}
[find, vaf, outperm, rowperm, colperm] = ...
 arobfndtm(proxtm, inperm, kblock)
\end{verbatim}
\noindent where, again, \verb+INPERM+ is a given starting permutation of the first $n = n_{a} + n_{b}$ integers;
\verb+FIND+ is the least-squares optimal matrix (with variance-accounted-for of \verb+VAF+) displaying an anti-Q-form (because of the anti-Robinson form constructed for the combined row and column object ordering given by the ending permutation \verb+OUTPERM+). \verb+KBLOCK+ defines the block size in the use the iterative quadratic assignment
routine. \verb+ROWPERM+ and \verb+COLPERM+ are the resulting row and column permutations for
the objects.  In the listing below, the \verb+VAF+ for the given fitted matrix is very high: .9667 (which can be compared to the alternative representations given earlier with values of .8072 (linear unidimensional scaling),
.6209 (ultrametric), and .8663 (additive tree)).


\tiny

\begin{alltt}
  load goldfish_receptor.dat
  [find,vaf,outperm,rowperm,colperm] = ...
arobfndtm(goldfish_receptor,randperm(20),2);
  find

find =

  Columns 1 through 6

   68.0000   54.5000   80.0000  138.0000  145.0000  162.8000
   71.5000   54.5000   64.0000  128.0000  144.0000  162.8000
   71.5000   47.0000   61.0000  117.5000  117.5000  145.0000
   80.0000   47.5000   47.5000   98.0000  116.0000  137.5000
  155.0000  108.0000   63.0000   94.0000  103.0000  137.5000
  174.0000  125.0000   84.0000   49.0000   47.6667   76.0000
  200.0000  143.0000   91.0000   49.0000   47.6667   76.0000
  200.0000  156.0000  107.0000   67.0000   47.6667   60.0000
  200.0000  183.0000  177.0000  176.0000  168.0000  112.5000
  200.0000  200.0000  200.0000  198.0000  186.0000  112.5000
  200.0000  200.0000  200.0000  198.0000  188.0000  143.0000

  Columns 7 through 9

  162.8000  200.0000  200.0000
  162.8000  162.8000  173.0000
  145.0000  151.6667  158.0000
  138.5000  151.6667  158.0000
  138.5000  151.6667  158.0000
  106.0000  134.5000  134.5000
  106.0000  124.5000  124.5000
   78.0000  100.0000  100.0000
   82.5000   47.0000   46.0000
   82.5000   54.0000   47.5000
  111.0000   54.0000   47.5000

  vaf

vaf =

    0.9667

  outperm

outperm =

  Columns 1 through 10

    20    11    10    19     9    18     8     7    17    16

  Columns 11 through 20

     6     5     4    15    14    13     3    12     2     1

  rowperm\textsf{'}

ans =

  Columns 1 through 10

    11    10     9     8     7     6     5     4     3     2

  Column 11

     1

  colperm\textsf{'}

ans =

     9     8     7     6     5     4     3     2     1
\end{alltt}

\large

\subsection{Multiple Two-Mode AR Reorderings and Fittings}

The M-file, \verb+biarobfndtm.m+, finds and fits the sum of two anti-Q-forms (extracted from fitting two anti-Robinson matrices)  using iterative projection to
a two-mode proximity matrix in the $L_{2}$-norm based on permutations
identified through the use of iterative quadratic assignment.  In the usage
\begin{verbatim}
[find,vaf,targone,targtwo,outpermone,outpermtwo, ...
        rowpermone,colpermone,rowpermtwo,colpermtwo] = ...
    biarobfndtm(proxtm,inpermone,inpermtwo,kblock)
\end{verbatim}
\noindent
\verb+PROXTM+ is the usual input two-mode proximity matrix ($n_{a} \times n_{b}$)
with a dissimilarity interpretation, and
\verb+FIND+ is the least-squares optimal matrix (with variance-accounted-for
of \verb+VAF+) to \verb+PROXTM+. The latter matrix \verb+PROXTM+ is the sum of the two  matrices
\verb+TARGONE+ and \verb+TARGTWO+ based on the two row and column
object orderings given by the ending permutations \verb+OUTPERMONE+
and \verb+OUTPERMTWO+.  The two ending permutations of \verb+OUTPERMONE+
and \verb+OUTPERMTWO+ contain the ending row and column object orderings of \verb+ROWPERMONE+ and \verb+ROWPERMTWO+ and \verb+COLPERMONE+
and \verb+COLPERMTWO+. \verb+KBLOCK+ defines the block size in the use the
iterative quadratic assignment routine; the input permutations are \verb+INPERMONE+ and
\verb+INPERMTWO+.

\smallskip

As can be seen in the example below, the sum of two anti-Q-forms fitted to the \verb+goldfish_receptor+ data provides an almost perfect reconstruction (with a \verb+VAF+ of .9995).

\tiny

\begin{alltt}
  [find,vaf,targone,targtwo,outpermone,outpermtwo, ...
rowpermone,colpermone,rowpermtwo,colpermtwo] = ...
biarobfndtm(goldfish_receptor,randperm(20),randperm(20),2);

find

find =

  Columns 1 through 6

   47.3504   54.6226  111.0000  143.0000  188.0000  196.1177
   47.3504   54.6226   75.0000  100.0000  186.0000  199.8954
   46.0072   47.1738   90.0072  124.9856  167.9981  175.9981
   99.0098  101.1738   78.0098   59.9508   46.0000   66.9608
  122.0098  127.1738  115.0098   79.0098   48.9981   47.8673
  116.6197  152.0595   96.5053   72.7463   48.0000   52.0523
  198.0000  186.0000  154.0000  148.0000  103.0000   94.0000
  133.8750  156.0000  123.0000  126.7482  115.0000   98.0523
  141.0000  113.0000  142.0000  145.4795  115.0000  121.9575
  173.0000  140.0000  176.5991  176.4009  144.6719  128.6719
  200.2992  200.1738  160.7486  160.7486  145.0000  138.0000

  Columns 7 through 9

  199.9608  200.0000  201.9327
  200.0000  199.9924  197.3046
  176.9981  182.9981  200.0135
  106.9608  156.0000  200.0000
   89.1327  142.9981  199.9981
   84.0000  124.9924  173.3897
   63.0000  108.0000  155.0000
   49.0000   46.0153   79.3897
   60.0425   47.0000   60.9419
   66.5870   56.6719   84.3973
   80.0000   53.0000   65.5700

vaf

vaf =

    0.9995

targone

targone =

  Columns 1 through 6

   46.1875   46.1875  111.0900  143.0900  189.1858  197.1531
   46.1875   46.1875   83.7500  118.2801  187.1858  197.1531
   39.3017   38.7387   83.3017  118.2801  168.0431  176.0431
   96.3403   92.7387   75.3403   57.2813   57.2813   67.9962
  119.3403  118.7387  112.3403   76.3403   49.0431   49.7778
  143.6244  143.6244  123.5100   80.9988   49.1858   49.3100
  159.4691  147.4691  138.5000  135.0006  102.8519   94.0000
  160.8797  151.8810  138.5000  135.0006  116.1858   95.3100
  160.8797  153.7319  153.7319  153.7319  116.1858  113.2992
  173.0000  166.2124  164.3730  164.1748  129.4690  113.4690
  199.1362  191.7387  164.3730  164.3730  146.1858  138.0000

  Columns 7 through 9

  200.9962  203.4720  205.5571
  200.0000  202.1911  205.5571
  177.0431  183.0431  200.0585
  107.9962  156.7769  200.0585
   91.0431  143.0431  200.0431
   84.0000  127.1911  181.6422
   63.0000  107.8519  154.8519
   48.2140   48.2140   87.6422
   51.3841   48.2140   69.1944
   51.3841   41.4690   69.1944
   80.0000   55.2081   69.1944

targtwo

targtwo =

  Columns 1 through 6

  -26.2124         0   12.2261   12.2261   15.2029   15.2029
  -40.7319  -19.8797  -11.7319   -8.2525   -8.2525   -1.2140
    4.1190  -27.0047  -15.5000   -8.2525   -8.2525   -2.1988
    8.4351  -27.0047  -27.0047   -8.2525   -8.2525   -2.1988
    8.4351    1.1630   -8.7500  -18.2801   -8.2525   -2.1988
    8.4351    1.1630   -3.6244   -3.6244   -3.6244   -2.2081
    8.4351    1.1630   -0.0900   -0.0900   -3.6244   -3.4720
    8.4351    2.6696    2.6696    2.6696   -0.0585   -0.7769
    8.4351    2.6696    2.6696    2.6696   -0.0450   -0.0450
    8.4351    6.7055    6.7055    6.7055   -0.0450   -0.0450
   38.5309   38.5309   15.5000   12.9994    0.1481    0.1481

  Columns 7 through 9

   15.2029   15.2029   15.2029
   -1.1858    8.6584    8.6584
   -1.1858    0.7860    2.7423
   -1.1858         0    2.7423
   -1.1858         0    2.7423
   -1.1858         0         0
   -1.1858   -1.0354   -1.0354
  -11.2813   -1.0354   -1.0354
   -0.0450   -1.9104   -1.9104
   -0.0450   -0.0450   -0.0450
    0.1481         0         0

outpermone

outpermone =

  Columns 1 through 10

     1     2    12    13     3    14     4    15     5    16

  Columns 11 through 20

     6    17     7     8    18     9    10    19    11    20

outpermtwo

outpermtwo =

  Columns 1 through 10

    10    13     9    12     8    14     6    15     2    20

  Columns 11 through 20

    11     1    19    16     4     5    18    17     3     7

rowpermone\textsf{'}

ans =

  Columns 1 through 10

     1     2     3     4     5     6     7     8     9    10

  Column 11

    11

colpermone\textsf{'}

ans =

     1     2     3     4     5     6     7     8     9

rowpermtwo\textsf{'}

ans =

  Columns 1 through 10

    10     9     8     6     2    11     1     4     5     3

  Column 11

     7

colpermtwo\textsf{'}

ans =

     2     1     3     4     9     8     5     7     6
\end{alltt}


\large



\section{Some Bibliographic Comments}

There are a number of book-length presentations of (multi)dimensional scaling methods
available (encompassing differing collections of subtopics within the field).  We list
several of the better ones to consult in the reference section to follow, and note
these here in chronological order: Kruskal \& Wish (1978); Shiffman, Reynolds, \&
Young (1981); Everitt \& Rabe-Hesketh (1997); Carroll \& Arabie (1998); Cox \& Cox
(2001);  Lattin, Carroll, \& Green (2003); Hand (2004); Borg \& Groenen (2005).  The
items that would be closest to the approaches taken here with MATLAB and the emphasis
on least-squares, would be the monograph by Hubert, Arabie, and Meulman (2006), and
the reviews by Hubert, Arabie, \& Meulman (1997; 2001; 2002); Hubert, K\"{o}hn, \& Steinley
(in press); and Steinley \& Hubert (2005).




\clearpage


\begin{thebibliography}{99}

\bibitem{} Borg, I., \& Gronenen, P. J. F. (2005). \emph{Modern multidimensional scaling} (2nd Ed.).  New York:
Springer.

\bibitem{} Carroll, J. D., \& Arabie, P. (1998). Multidimensional scaling.
In M. H. Birnbaum (Ed.), \emph{Handbook of perception and cognition, Vol. 3} (pp.\ 179--250).
 San Diego: Academic Press.

 \bibitem{} Cox, T. F., \& Cox, M. A. A. (2001).  \emph{Multidimensional scaling} (2nd Ed.).  Boca Raton, FL:
 Chapman and Hall/CRC.


 \bibitem{} Everitt, B. S., \& Rabe-Hesketh, S. (1997). \emph{The analysis of
 proximity data}.  New York: Wiley.

 \bibitem{} Hand, D. J. (2004). \emph{Measurement theory and practice}.  New York: Oxford University Press.

 \bibitem{} Hubert, L. J., Arabie, P., \& Meulman, J. J. (1997). Linear and
circular unidimensional scaling for symmetric proximity matrices. \emph{British
Journal of Mathematical and Statistical Psychology}, \emph{50}, 253--284.


\bibitem{} Hubert, L., Arabie, P., \& Meulman, J. (2001).
\emph{Combinatorial data analysis: Optimization by dynamic programming}.  SIAM
Monographs on Discrete Mathematics and Applications. Philadelphia: SIAM.

\bibitem{} Hubert, L. J., Arabie, P., \& Meulman, J. J. (2002).
Linear unidimensional scaling in the $L_{2}$-norm: Basic optimization methods using
MATLAB.
  \emph{Journal of Classification}, \emph{19}, 303--328.

\bibitem{} Hubert, L., Arabie, P., \& Meulman, J. (2006).
\emph{The structural representation of proximity matrices with MATLAB}. ASA-SIAM
Series on Statistics and Applied Probability.
 Philadelphia: SIAM.

\bibitem{} Hubert, L., K\"{o}hn, H.-F., \& Steinley, D. (in press). Order-constrained proximity matrix representations: Ultrametric generalizations and constructions with MATLAB. In S. Kolenikov, L. Thombs, \& D. Steinley (Eds.), \emph{Current methodological developments of statistics in the social sciences}(pp. xx-xx). New York: Wiley.


 \bibitem{} Hubert, L., \& Steinley, D. (2005). Agreement among Supreme Court justices: Categorical vs.\  continuous representation.  \emph{SIAM News}, \emph{38(8)}, 4--7.

 \bibitem{} Lattin, J., Carroll, J. D., \& Green, P. E. (2003).  \emph{Analyzing multivariate data}.  Pacific Grove, CA: Brooks/Cole.





 \bibitem{} Kruskal, J. B., \& Wish, M. (1978). \emph{Multidimensional scaling}.
  Newbury Park, CA: Sage.


\bibitem{} Schiffman, S. S., Reynolds, M. L., \& Young, F. W. (1981).
 \emph{Introduction to multidimensional scaling}.  New York: Academic Press.

\bibitem{} Wollan, P. C., \& Dykstra, R. L. (1987). Minimizing linear inequality constrained
Mahalanobis distances.  \emph{Applied Statistics}, \emph{36}, 234--240.




\end{thebibliography}

\newpage

\appendix

\section{Header Comments for the M-files Mentioned in the Text or Used Internally by Other M-files;
Given in Alphabetical Order}

\normalsize

\section*{arobfit.m}

\begin{verbatim}
% AROBFIT fits an anti-Robinson matrix using iterative projection to
% a symmetric proximity matrix in the $L_{2}$-norm.
%
% syntax: [fit, vaf] = arobfit(prox, inperm)
%
% PROX is the input proximity matrix ($n \times n$ with a zero main
% diagonal and a dissimilarity interpretation);
% INPERM is a given permutation of the first $n$ integers;
% FIT is the least-squares optimal matrix (with variance-
% accounted-for of VAF) to PROX having an anti-Robinson form for
% the row and column object ordering given by INPERM.
\end{verbatim}


\section*{arobfnd.m}

\begin{verbatim}
% AROBFND finds and fits an anti-Robinson
% matrix using iterative projection to
% a symmetric proximity matrix in the $L_{2}$-norm based on a
% permutation identified through the use of iterative quadratic
% assignment.
%
% syntax: [find, vaf, outperm] = arobfnd(prox, inperm, kblock)
%
% PROX is the input proximity matrix ($n \times n$ with a zero main
% diagonal and a dissimilarity interpretation);
% INPERM is a given starting permutation of the first $n$ integers;
% FIND is the least-squares optimal matrix (with
% variance-accounted-for of VAF) to PROX having an anti-Robinson
% form for the row and column object ordering given by the ending
% permutation OUTPERM. KBLOCK defines the block size in the use of the
% iterative quadratic assignment routine.
\end{verbatim}

\section*{arobfittm.m}

\begin{verbatim}
%  AROBFITTM does a confirmatory two-mode anti-Robinson fitting of a
%  given ordering of the row and column objects of a two-mode
%  proximity matrix PROXTM using Dykstra's (Kaczmarz's)
%  iterative projection least-squares method.
%
%  syntax: [fit,vaf,rowperm,colperm] = arobfittm(proxtm,inperm)
%
%  INPERM is the given ordering of the row and column objects
%  together; FIT is an nrow (number of rows) by ncol (number of
%  columns) matrix fitted to PROXTM(ROWPERM,COLPERM)
%  with VAF being the variance-accounted for and
%  based on the (least-squares criterion) sum of
%  squared discrepancies between FIT and PROXTM(ROWPERM,COLMEAN);
%  ROWPERM and COLPERM are the row and column object orderings
%  derived from INPERM.
\end{verbatim}

\section*{arobfndtm.m}

\begin{verbatim}
% AROBFNDTM finds and fits an anti-Robinson
% form using iterative projection to
% a two-mode proximity matrix in the $L_{2}$-norm based on a
% permutation identified through the use of iterative quadratic
% assignment.
%
% syntax: [find, vaf, outperm, rowperm, colperm] = ...
% arobfndtm(proxtm, inperm, kblock)
%
% PROXTM is the input two-mode proximity matrix
% ($n_{a} \times n_{b}$ with a dissimilarity interpretation);
% INPERM is a given starting permutation
% of the first $n = n_{a} + n_{b}$ integers;
% FIND is the least-squares optimal matrix (with
% variance-accounted-for of VAF) to PROXTM having the anti-Robinson
% form for the row and column
% object ordering given by the ending permutation OUTPERM. KBLOCK
% defines the block size in the use of the iterative quadratic
% assignment routine. ROWPERM and COLPERM are the resulting
% row and column permutations for the objects.
\end{verbatim}

\section*{biarobfnd.m}

\begin{verbatim}
% BIAROBFND finds and fits the sum of two
% anti-Robinson matrices using iterative projection to
% a symmetric proximity matrix in the $L_{2}$-norm
% based on permutations identified through
% the use of iterative quadratic assignment.
%
% syntax: [find,vaf,targone,targtwo,outpermone, ...
%     outpermtwo] = biarobfnd(prox,inperm,kblock)
%
% PROX is the input proximity matrix ($n \times n$ with a zero
% main diagonal and a dissimilarity interpretation);
% INPERM is a given starting permutation of the first $n$ integers;
% FIND is the least-squares optimal matrix (with
% variance-accounted-for of VAF)
% to PROX and is the sum of the two anti-Robinson matrices
% TARGONE and TARGTWO based on the two row and column
% object orderings given by the ending permutations OUTPERMONE
% and OUTPERMTWO. KBLOCK defines the block size in the use of the
% iterative quadratic assignment routine.
\end{verbatim}

\section*{bisarobfnd.m}

\begin{verbatim}
% BISAROBFND finds and fits the sum of two
% strongly anti-Robinson matrices using iterative
% projection to a symmetric proximity matrix in
% the $L_{2}$-norm based on permutations
% identified through the use of iterative quadratic assignment.
%
% syntax: [find,vaf,targone,targtwo,outpermone,outpermtwo] = ...
%   bisarobfnd(prox,inperm,kblock)
%
% PROX is the input proximity matrix ($n \times n$ with a zero
% main diagonal and a dissimilarity interpretation);
% INPERM is a given starting permutation of the first $n$ integers;
% FIND is the least-squares optimal matrix (with
% variance-accounted-for of VAF) to PROX and is the sum of the two
% strongly anti-Robinson matrices;
% TARGONE and TARGTWO are based on the two row and column
% object orderings given by the ending permutations OUTPERMONE
% and OUTPERMTWO. KBLOCK defines the block size in the use the
% iterative quadratic assignment routine.
\end{verbatim}

\section*{biarobfndtm.m}

\begin{verbatim}
% BIAROBFNDTM finds and fits the sum of
% two anti-Robinson matrices using iterative projection to
% a two-mode proximity matrix in the $L_{2}$-norm based on
% permutations identified through the use of
% iterative quadratic assignment.
%
% syntax: [find,vaf,targone,targtwo,outpermone,outpermtwo, ...
%        rowpermone,colpermone,rowpermtwo,colpermtwo] = ...
%   biarobfndtm(proxtm,inpermone,inpermtwo,kblock)
%
% PROXTM is the input two-mode proximity matrix ($nrow \times ncol$)
% with a dissimilarity interpretation);
% FIND is the least-squares optimal matrix (with variance-
% accounted-for of VAF) to PROXTM and is the sum of the two matrices
% TARGONE and TARGTWO based on the two row and column
% object orderings given by the ending permutations OUTPERMONE
% and OUTPERMTWO, and in turn ROWPERMONE and ROWPERMTWO and
% COLPERMONE and COLPERMTWO. KBLOCK defines the block size
% in the use of the iterative quadratic assignment routine;
% the input permutations are INPERMONE and INPERMTWO.
\end{verbatim}

\section*{bicirarobfnd.m}

\begin{verbatim}
% BICIRAROBFND finds and fits the sum of two circular
% anti-Robinson matrices using iterative projection to
% a symmetric proximity matrix in the $L_{2}$-norm based on
% permutations identified through the use of
% iterative quadratic assignment.
%
% syntax: [find,vaf,targone,targtwo,outpermone,outpermtwo] = ...
%      bicirarobfnd(prox,inperm,kblock)
%
% PROX is the input proximity matrix ($n \times n$ with a
% zero main diagonal and a dissimilarity interpretation);
% INPERM is a given starting permutation of the first $n$ integers;
% FIND is the least-squares optimal matrix (with
% variance-accounted-for of VAF) to PROX and is the sum of the
% two circular anti-Robinson matrices;
% TARGONE and TARGTWO are based on the two row and column
% object orderings given by the ending permutations OUTPERMONE
% and OUTPERMTWO.
\end{verbatim}

\section*{bicirsarobfnd.m}

\begin{verbatim}
% BICIRSAROBFND fits the sum of two strongly circular anti-Robinson
% matrices using iterative projection to a symmetric proximity
% matrix in the $L_{2}$-norm based on permutations
% identified through the use of iterative quadratic assignment.
%
% syntax: [find,vaf,targone,targtwo,outpermone,outpermtwo] = ...
%      bicirsarobfnd(prox,inperm,kblock)
%
% PROX is the input proximity matrix ($n \times n$ with a zero main
% diagonal and a dissimilarity interpretation);
% INPERM is a given starting permutation of the first $n$ integers;
% FIND is the least-squares optimal matrix (with variance-
% accounted-for of VAF) to PROX and is the
% sum of the two strongly circular anti-Robinson matrices;
% TARGONE and TARGTWO are based on the two row and column
% object orderings given by the ending permutations OUTPERMONE
% and OUTPERMTWO. KBLOCK defines the block size in the use of the
% iterative quadratic assignment routine.
\end{verbatim}





\section*{bicirac.m}

\begin{verbatim}
% BICIRAC finds and fits the sum of two circular
% unidimensional scales using iterative projection to
% a symmetric proximity matrix in the $L_{2}$-norm based on
% permutations identified through the use
% of iterative quadratic assignment.
%
% syntax: [find,vaf,targone,targtwo,outpermone,outpermtwo, ...
%     addconone,addcontwo] = bicirac(prox,inperm,kblock)
%
% PROX is the input proximity matrix ($n \times n$ with a zero
% main diagonal and a dissimilarity interpretation);
% INPERM is a given starting permutation of the first $n$ integers;
% FIND is the least-squares optimal matrix (with variance-
% accounted-for of VAF) to PROX and is the sum of the two
% circular anti-Robinson matrices;
% TARGONE and TARGTWO are based on the two row and column
% object orderings given by the ending permutations OUTPERMONE
% and OUTPERMTWO. KBLOCK defines the block size in the use of the
% iterative quadratic assignment routine and ADDCONONE and ADDCONTWO
% are the two additive constants for the two model components.
\end{verbatim}

\section*{biscallp.m}

\begin{verbatim}

%BISCALLP carries out a bidimensional scaling of a symmetric proximity
%  matrix using iterative linear programming.
%  PROX is the input proximity matrix (with a zero main diagonal and a
%  dissimilarity interpretation);
%  INPERMONE is the input beginning permutation for the first dimension
%  (a permuation of the first $n$ integers); INPERMTWO is the input beginning
%  permutation for the second dimension;
%  NOPT controls the confirmatory or exploratory fitting of the unidimensional
%  scales; a value of NOPT = 0 will fit in a confirmatory manner the two scales
%  indicated by INPERMONE and INPERMTWO; a value of NOPT = 1 uses iterative LP
%  to locate the better permutations to fit;
%  OUTPERMONE is the final object permutation for the first dimension;
%  OUTPERMTWO is the final object permutation for the second dimension;
%  COORDONE is the set of first dimension coordinates in ascending order;
%  COORDTWO is the set of second dimension coordinates in ascending order;
%  ADDCONONE is the additive constant for the first dimensional model;
%  ADDCONTWO is the additive constant for the second dimensional model;
%  DEV is the variance-accounted-for in PROX by the bidimensional scaling.
\end{verbatim}



\section*{biscalqa.m}

\begin{verbatim}
%  BISCALQA carries out a bidimensional scaling of a symmetric
%  proximity matrix using iterative quadratic assignment.
%
%  syntax: [outpermone,outpermtwo,coordone,coordtwo,fitone,fittwo,...
%    addconone,addcontwo,vaf] = ...
%     biscalqa(prox,targone,targtwo,inpermone,inpermtwo,kblock,nopt)
%
%  PROX is the input proximity matrix (with a zero main diagonal
%  and a dissimilarity interpretation);
%  TARGONE is the input target matrix for the first dimension
%  (usually with a zero main diagonal and a dissimilarity
%  interpretation representing equally spaced locations along
%  a continuum); TARGTWO is the input target
%  matrix for the second dimension;
%  INPERMONE is the input beginning permutation for the first
%  dimension (a permutation of the first $n$ integers);
%  INPERMTWO is the input beginning
%  permutation for the second dimension;
%  the insertion and rotation routines use from 1 to KBLOCK
%  (which is less than or equal to $n-1$) consecutive objects in
%  the permutation defining the row and column orders of the data
%  matrix. NOPT controls the confirmatory or exploratory fitting
%  of the unidimensional scales; a value of NOPT = 0 will fit in a
%  confirmatory manner the two scales
%  indicated by INPERMONE and INPERMTWO;
%  a value of NOPT = 1 uses iterative QA
%  to locate the better permutations to fit;
%  OUTPERMONE is the final object permutation for the
%  first dimension; OUTPERMTWO is the final object permutation
%  for the second dimension;
%  COORDONE is the set of first dimension coordinates
%  in ascending order; COORDTWO is the set of second dimension
%  coordinates in ascending order;
%  ADDCONONE is the additive constant for the first
%  dimensional model; ADDCONTWO is the additive constant for
%  the second dimensional model;
%  VAF is the variance-accounted-for in PROX by
%  the bidimensional scaling.
\end{verbatim}



\section*{biscaltmac.m}

\begin{verbatim}
% BISCALTMAC finds and fits the sum of two linear
% unidimensional scales using iterative projection to
% a two-mode proximity matrix in the $L_{2}$-norm based on
% permutations identified through the use of iterative quadratic
% assignment.
%
% syntax: [find,vaf,targone,targtwo,outpermone,outpermtwo, ...
%        rowpermone,colpermone,rowpermtwo,colpermtwo,addconone,...
%        addcontwo,coordone,coordtwo,axes] = ...
%    biscaltmac(proxtm,inpermone,inpermtwo,kblock,nopt)
%
% PROXTM is the input two-mode proximity matrix ($nrow \times ncol$
% with a dissimilarity interpretation);
% FIND is the least-squares optimal matrix (with variance-accounted-
% for of VAF) to PROXTM and is the sum of the two matrices
% TARGONE and TARGTWO based on the two row and column
% object orderings given by the ending permutations OUTPERMONE
% and OUTPERMTWO, and in turn ROWPERMONE and ROWPERMTWO and
% COLPERMONE and COLPERMTWO. KBLOCK defines the block size
% in the use of the iterative quadratic assignment routine and
% ADDCONONE and ADDCONTWO are
% the two additive constants for the two model components;
% The $n$ coordinates
% are in COORDONE and COORDTWO.  The input permutations are INPERMONE
% and INPERMTWO.  The $n \times 2$ matrix AXES gives the
% plotting coordinates for the
% combined row and column object set.
% NOPT controls the confirmatory or
% exploratory fitting of the unidimensional
% scales; a value of NOPT = 0 will
% fit in a confirmatory manner the two scales
% indicated by INPERMONE and INPERMTWO;
% a value of NOPT = 1 uses iterative QA
% to locate the better permutations to fit.
\end{verbatim}



\section*{cat\_vs\_con\_orderfit.m}

\begin{verbatim}
% CAT_VS_CON_ORDERFIT uses a constraining order to fit a best
% ultrametric, anti-Robinson form, and linear unidimensional scale; all
% three of these representations conform to this order.
%
% syntax: [findultra,vafultra,vafarob,arobprox,fitlinear,vaflinear,...
%    coord,addcon] = cat_vs_con_orderfit(prox,inperm,conperm)
%
% PROX is the input dissimilarity matrix and INPERM is
% a starting permutation for how the ultrametric constraints are searched.
% The permutation CONPERM is a given constraining order.
% As output, FINDULTRA is the best ultrametric found with VAF of
% VAFULTRA; AROBPROX is the best AR form identified with VAF of
% VAFAROB; FITLINEAR is the best LUS model with VAF of VAFLINEAR with
% COORD constraining the coordinates and ADDCON the additive constant.
\end{verbatim}



\section*{cat\_vs\_con\_orderfnd.m}

\begin{verbatim}
% CAT_VS_CON_ORDERFND finds a constraining order to fit a best
% ultrametric, anti-Robinson form, and linear unidimensional scale; all
% three of these representations conform to this order.
%
% syntax: [findultra,vafultra,conperm,vafarob,arobprox,fitlinear,vaflinear,...
%    coord,addcon] = cat_vs_con_orderfnd(prox,inperm)
%
% PROX is the input dissimilarity matrix and INPERM is
% a starting permutation for how the ultrametric constraints are searched.
% The permutation CONPERM is a given order found and used to
% constrain the various representations. FINDULTRA is the best ultrametric
% found with VAF of VAFULTRA; AROBPROX is the best AR form identified
% with VAF of VAFAROB; FITLINEAR is the best LUS model with VAF of VAFLINEAR
% with COORD constraining the coordinates and ADDCON the additive constant.
\end{verbatim}



\section*{cent\_linearfit}

\begin{verbatim}
% CENT_LINEARFIT fits a structure to a proximity matrix by first fitting
% a centroid metric and secondly a linear unidimensional scale
% to the residual matrix where the latter is constrained by a given object order.
%
% syntax: [find,vaf,outperm,targone,targtwo,lengthsone,coordtwo,addcontwo] = ...
%      cent_linearfit(prox,inperm)
%
% PROX is the input proximity matrix (with a zero main diagonal
% and a dissimilarity interpretation); INPERM is the given
% input constraining order (permutation) which is also given
% as the output vector OUTPERM;
% FIND is the found least-squares matrix (with variance-accounted-for
% of VAF) to PROX. TARGTWO is the linear unidimensional scaling
% component of the decomposition defined by the coordinates in COORDTWO
% with additive constant ADDCONTWO;
% TARGONE is the centroid metric component defined by the
% lengths in LENGTHSONE.
\end{verbatim}



\section*{cent\_linearfnd}

\begin{verbatim}
% CENT_LINEARFND finds fits a structure to a proximity matrix by first fitting
% a centroid metric and secondly a linear unidimensional scale
% to the residual matrix.
%
% syntax: [find,vaf,outperm,targone,targtwo,lengthsone,coordtwo,addcontwo] = ...
%      cent_linearfnd(prox,inperm)
%
% PROX is the input proximity matrix (with a zero main diagonal
% and a dissimilarity interpretation); INPERM is the given
% input beginnining order (permutation); the found output vector is OUTPERM;
% FIND is the found least-squares matrix (with variance-accounted-for
% of VAF) to PROX. TARGTWO is the linear unidimensional scaling
% component of the decomposition defined by the coordinates in COORDTWO
% with addtive constant ADDCONTWO;
% TARGONE is the centroid metric component defined by the
% lengths in LENGTHSONE.
\end{verbatim}



\section*{centfit.m}

\begin{verbatim}
% CENTFIT finds the least-squares fitted centroid metric (FIT) to
% PROX, the input proximity matrix (with a zero main diagonal
% and a dissimilarity interpretation).
%
% syntax: [fit,vaf,lengths] = centfit(prox)
%
% The $n$ values that serve to define the approximating sums,
% $g_{i} + g_{j}$, are given in the vector LENGTHS of size $n \times 1$.
\end{verbatim}



\section*{centfittm.m}

\begin{verbatim}
% CENTFITTM finds the least-squares fitted two-mode centroid metric
% (FIT) to PROXTM, the two-mode rectangular input proximity matrix
% (with a dissimilarity interpretation).
%
% syntax: [fit,vaf,lengths] = centfittm(proxtm)
%
% The $n$ values (where $n$ = number of rows + number of columns)
% serve to define the approximating sums,
% $u_{i} + v_{j}$, where the $u_{i}$ are for the rows and the $v_{j}$
% are for the columns; these are given in  the vector LENGTHS of size
% $n \times 1$, with row values first followed by the column values.
\end{verbatim}

\section*{cirarobfit.m}

\begin{verbatim}
% CIRAROBFIT fits a circular anti-Robinson matrix using iterative
% projection to a symmetric proximity matrix in the $L_{2}$-norm.
%
% syntax: [fit, vaf] = cirarobfit(prox,inperm,targ)
%
% PROX is the input proximity matrix ($n \times n$ with a zero
% main diagonal and a dissimilarity interpretation);
% INPERM is a given permutation of the first $n$ integers (around
% a circle); TARG is a given $n \times n$ matrix having the
% circular anti-Robinson form that guides the direction in which
% distances are taken around the circle.
% FIT is the least-squares optimal matrix (with variance-
% accounted-for of VAF) to PROX having a circular anti-Robinson
% form for the row and column object ordering given by INPERM.
\end{verbatim}

\section*{cirarobfnd.m}

\begin{verbatim}
% CIRAROBFND finds and fits a circular
% anti-Robinson matrix using iterative projection to
% a symmetric proximity matrix in the $L_{2}$-norm based on a
% permutation identified through the use of iterative
% quadratic assignment.
%
% syntax: [find, vaf, outperm] = cirarobfnd(prox, inperm, kblock)
%
% PROX is the input proximity matrix ($n \times n$ with a zero
% main diagonal and a dissimilarity interpretation);
% INPERM is a given starting permutation (assumed to be around the
% circle) of the first $n$ integers; FIT is the least-squares optimal
% matrix (with variance-accounted-for of VAF) to PROX having a
% circular anti-Robinson form for the row and column
% object ordering given by the ending permutation OUTPERM.
% KBLOCK defines the block size in the use of the iterative
% quadratic assignment routine.
\end{verbatim}

\section*{cirsarobfit.m}

\begin{verbatim}
% CIRSAROBFIT fits a strongly circular anti-Robinson matrix
% using iterative projection to
% a symmetric proximity matrix in the $L_{2}$-norm.
%
% syntax: [fit, vaf] = cirsarobfit(prox,inperm,target)
%
% PROX is the input proximity matrix ($n \times n$ with a zero
% main diagonal and a dissimilarity interpretation);
% INPERM is a given permutation of the first $n$ integers
% (around a circle);
% TARGET is a given $n \times n$ matrix having the circular
% anti-Robinson form that guides the direction in which distances
% are taken around the circle.
% FIT is the least-squares optimal matrix (with variance-
% accounted-for of VAF) to PROX having a strongly circular
% anti-Robinson form for the row and column object ordering
% given by INPERM.
\end{verbatim}

\section*{cirsarobfnd.m}

\begin{verbatim}
% CIRSAROBFND finds and fits a strongly circular
% anti-Robinson matrix using iterative projection to
% a symmetric proximity matrix in the $L_{2}$-norm based on a
% permutation identified through the use of
% iterative quadratic assignment.
%
% syntax: [find, vaf, outperm] = cirsarobfnd(prox, inperm, kblock)
%
% PROX is the input proximity matrix ($n \times n$ with a zero
% main diagonal and a dissimilarity interpretation);
% INPERM is a given starting permutation (assumed to be around the
% circle) of the first $n$ integers;
% FIT is the least-squares optimal matrix (with variance-
% accounted-for of VAF) to PROX having a strongly
% circular anti-Robinson form for the row and column
% object ordering given by the ending permutation OUTPERM. KBLOCK
% defines the block size in the use of the iterative
% quadratic assignment routine.
\end{verbatim}



\section*{circularplot.m}

\begin{verbatim}
% CIRCULARPLOT plots the object set using the coordinates
% around a circular structure derived from the $n \times n$
% interpoint distance matrix around a circle given by CIRC.
% The positions are labeled by the order of objects
% given in INPERM.
%
% syntax: [circum,radius,coord,degrees,cumdegrees] = ...
%   circularplot(circ,inperm)
%
% The output consists of a plot, the circumference of the
% circle (CIRCUM) and radius (RADIUS); the coordinates of
% the plot positions (COORD), and the degrees and cumulative
% degrees induced between the plot positions
% (in DEGREES and CUMDEGREES).
% The positions around the circle are numbered from 1
% (at the "noon" position) to $n$, moving
% clockwise around the circular structure.
\end{verbatim}



\section*{cirfit.m}

\begin{verbatim}
%  CIRFIT does a confirmatory fitting of a given order
%  (assumed to reflect a circular ordering around a closed
%  unidimensional structure) using Dykstra's
%  (Kaczmarz's) iterative projection least-squares method.
%
%  syntax: [fit, diff] = cirfit(prox,inperm)
%
%  INPERM is the given order; FIT is an $n \times n$ matrix that
%  is fitted to PROX(INPERM,INPERM) with least-squares value DIFF.
\end{verbatim}



\section*{cirfitac.m}

\begin{verbatim}
%  CIRFITAC does a confirmatory fitting (including
%  the estimation of an additive constant) for a given order
%  (assumed to reflect a circular ordering around a closed
%  unidimensional structure) using the Dykstra--Kaczmarz
%  iterative projection least-squares method.
%
%  syntax: [fit, vaf, addcon] = cirfitac(prox,inperm)
%
%  INPERM is the given order; FIT is an $n \times n$ matrix that
%  is fitted to PROX(INPERM,INPERM) with variance-accounted-for of
%  VAF; ADDCON is the estimated additive constant.
\end{verbatim}



\section*{class\_scaledp.m}

\begin{verbatim}
%  CLASS_SCALEDP carries out a unidimensional seriation or
%  scaling of a set of object classes defined for a symmetric proximity
%  matrix using dynamic programming.
%
%  syntax: [permut,cumobfun] = class_scaledp(prox,numbclass,membclass)
%
%  PROX is the ($n \times n$) input proximity matrix (with a zero
%  main diagonal and a dissimilarity interpretation);
%  NUMBCLASS (= $n_{c}$) is the number of object classes to be
%  sequenced;
%  MEMBCLASS is an $n \times 1$ vector containing the input class
%  membership and includes all the integers from 1 to NUMBCLASS and
%  zeros when objects are to be deleted from consideration;
%  PERMUT is the order of the classes in the optimal permutation (say,
%  $\rho^{*}$);
%  CUMOBFUN gives the cumulative values of the objective function for
%  the successive placements of the objects in the optimal permutation:
%  $\sum_{i=1}^{k} (t_{i}^{(\rho^{*})})^{2}$ for $k = 1, \ldots, n_{c}$.
%
%  Initializations:  The vectors VALSTORE and IDXSTORE store the
%  results of the recursion for the $(2^n_{c})-1$ nonempty subsets of the
%  set of classes. The integer positions in these vectors correspond to
%  subsets whose binary number equivalents are equal to those integer positions.
\end{verbatim}

\section*{concave\_monotonic\_regression\_dykstra.m}

\begin{verbatim}
% CONCAVE_MONOTONIC_REGRESSION_DYKSTRA returns a vector of values in YHAT that are
% weakly monotonic with respect to the values in an independent input
% vector X, define a concave function, and minimize the least-squares
% loss to the values in the dependent input vector Y.  The
% variance-accounted-for in Y from YHAT is given by VAF_YHAT.
%
% syntax: [yhat,vaf_yhat] = concave_monotonic_regression_dykstra(x,y)
%
% The least-squares optimization is carried out through Dykstra's method of
% iterative projection.
\end{verbatim}

\section*{convex\_concave\_monotonic\_regression\_dykstra.m}

\begin{verbatim}
% CONVEX_CONCAVE_MONOTONIC_REGRESSION_DYKSTRA returns a vector of values
% in YHAT that are weakly monotonic with respect to the values in an
% independent input vector X, define a convex function up to the median
% observation in X and a concave function thereafter, and minimize the
% least-squares loss to the values in the dependent input vector Y.  The
% variance-accounted-for in Y from YHAT is given by VAF_YHAT.
%
% syntax: [yhat,vaf_yhat] = convex_concave_monotonic_regression_dykstra(x,y)
%
% The least-squares optimization is carried out through Dykstra's method of
% iterative projection.
\end{verbatim}

\section*{convex\_monotonic\_regression\_dykstra.m}

\begin{verbatim}
% CONVEX_MONOTONIC_REGRESSION_DYKSTRA returns a vector of values in YHAT that are
% weakly monotonic with respect to the values in an independent input
% vector X, define a convex function, and minimize the least-squares
% loss to the values in the dependent input vector Y.  The
% variance-accounted-for in Y from YHAT is given by VAF_YHAT.
%
% syntax: [yhat,vaf_yhat] = convex_monotonic_regression_dykstra(x,y)
%
% The least-squares optimization is carried out through Dykstra's method of
% iterative projection.
\begin{verbatim}




\section*{eqspace\_cirfitac.m}

\begin{verbatim}
%  EQSPACE_CIRFITAC does a confirmatory fitting (including
%  the estimation of an additive constant) for a given order
%  (assumed to reflect a circular ordering around a closed
%  unidimensional structure) using the Dykstra--Kaczmarz
%  iterative projection least-squares method. Also, an equally-spaced
%  confirmatory fitting alternative is carried out.
%
%  syntax: [fit, vaf, addcon, eqfit, eqvaf, eqaddcon] = ...
%             eqspace_cirfitac(prox,inperm)
%
%  INPERM is the given order; FIT is an $n \times n$ matrix that
%  is fitted to PROX(INPERM,INPERM) with variance-accounted-for of
%  VAF; ADDCON is the estimated additive constant. The equally-spaced
%  output alternatives are prefixed with an EQ.
\end{verbatim}



\section*{eqspace\_linfitac.m}

\begin{verbatim}
%  EQSPACE_LINFITAC does a confirmatory fitting of a given unidimensional order
%  using the Dykstra--Kaczmarz iterative projection
%  least-squares method, but differing from linfit.m in
%  including the estimation of an additive constant.  Also
%  an equally-spaced confirmatory fitting alternative is carried out.
%
%  syntax: [fit, vaf, coord, addcon, eqfit, eqvaf, eqaddcon] = ...
%             eqspace_linfitac(prox,inperm)
%
%  INPERM is the given order;
%  FIT is an $n \times n$ matrix that is fitted to
%  PROX(INPERM,INPERM) with variance-accounted-for VAF;
%  COORD gives the ordered coordinates whose absolute differences
%  could be used to reconstruct FIT; ADDCON is the estimated
%  additive constant that can be interpreted as being added to PROX.
%  The equally-spaced output alternatives are prefixed with an EQ.
\end{verbatim}



\section*{eqspace\_ultrafit.m}

\begin{verbatim}
% EQSPACE_ULTRAFIT fits a given ultrametric using iterative projection to
% a symmetric proximity matrix in the $L_{2}$-norm.  Also, an
% equally-spaced confirmatory fitting alternative is carried out using the
% entries in TARG (assumed to be integer-valued reflecting the level at
% which the clusters are formed).
%
% syntax: [fit,vaf,eqfit,eqvaf,eqaddcon] = eqspace_ultrafit(prox,targ)
%
% PROX is the input proximity matrix (with a zero main diagonal
% and a dissimilarity interpretation);
% TARG is an ultrametric matrix of the same size as PROX;
% FIT is the least-squares optimal matrix (with
% variance-accounted-for of VAF) to PROX satisfying the ultrametric
% constraints implicit in TARG.  The equally-spaced output alternatives are
% prefixed with an EQ.
\end{verbatim}

\section*{least\_squares\_dykstra.m}

\begin{verbatim}
% LEAST_SQUARES_DYKSTRA carries out an inequality constrained least-squares
% task using iterative projection.
%
% syntax: [solution, kuhn_tucker, iterations, end_condition] = ...
%    least_squares_dykstra(data,covariance,constraint_array, ...
%    constraint_constant,equality_flag)
%
%  The input arguments are an $n \times 1$ vector, DATA; an $n \times n$
%  positive-definite matrix, COVARIANCE; a $k \times n$ constraint matrix,
%  CONSTRAINT_ARRAY; the $k \times 1$ right-hand-side constraint vector,
%  CONSTRAINT_CONSTANT; and a $k \times 1$ EQUALITY_FLAG vector with
%  values of 0 when a corresponding constraint is an inequality; and 1 if
%  an equality.
%  The weighted least-squares criterion (with weights defined by the
%  inverse of COVARIANCE) is minimized by a SOLUTION that satisfies
%  CONSTRAINT_ARRAY * SOLUTION being in EQUALITY_FLAG relation to
%  CONSTRAINT_CONSTANT.  As additional output arguments, there is a $k
%  \times 1$ KUHN_TUCKER vector (useful for some applications); the number
%  of ITERATIONS taken (maximum default value is ITERMAX = 1.0e+04 set in
%  the program), and an END_CONDITION flag: 0: no error; 1: itermax
%  exceeded; 2: invalid constant; 3: invalid constraint function.
\begin{verbatim}

\section*{linear\_order\_member.m}

\begin{verbatim}
% LINEAR_ORDER_MEMBER provides an (n-1) x n partition membership matrix
% called MEMBER based on the input permutation INPERM of size n.  MEMBER
% defines (with values of 1 and 2) those objects before and after each of
% the n-1 separations in INPERM.  MEMBER is used in the various
% PARTITIONFIT routines.
%
% syntax: [member] = linear_order_member(inperm)
\end{verbatim}

\section*{linearplot.m}

\begin{verbatim}
% LINEARPLOT plots the object set using the ordered coordinates in COORD
% and labels the positions by the order of the objects given in INPERM.
%
% syntax: [linearlength] = linearplot(coord,inperm)
%
% The output value LINEARLENGTH is the sum of the interpoint distances from
% COORD.
\end{verbatim}



\section*{linfit.m}

\begin{verbatim}
%  LINFIT does a confirmatory fitting of a given
%  unidimensional order using Dykstra's
%  (Kaczmarz's) iterative projection least-squares method.
%
%  syntax: [fit, diff, coord] = linfit(prox,inperm)
%
%  INPERM is the given order;
%  FIT is an $n \times n$ matrix that is fitted to
%  PROX(INPERM,INPERM) with least-squares value DIFF;
%  COORD gives the ordered coordinates whose absolute
%  differences could be used to reconstruct FIT.
\end{verbatim}



\section*{linfit\_tied.m}

\begin{verbatim}
%  LINFIT_TIED does a confirmatory fitting of a given
%  unidimensional order using Dykstra's
%  (Kaczmarz's) iterative projection least-squares method. This
%  includes the possible imposition of tied coordinates.
%
%  syntax: [fit, diff, coord] = linfit_tied(prox,inperm,tiedcoord)
%
%  INPERM is the given order;
%  FIT is an $n \times n$ matrix that is fitted to
%  PROX(INPERM,INPERM) with least-squares value DIFF;
%  COORD gives the ordered coordinates whose absolute
%  differences could be used to reconstruct FIT; TIEDCOORD
%  is the tied pattern of coordinates imposed (in order)
%  along the continuum (using the integers from 1 up to n
%  to indicate the tied positions).
\end{verbatim}



\section*{linfitac.m}

\begin{verbatim}
%  LINFITAC does a confirmatory fitting of a given unidimensional order
%  using the Dykstra--Kaczmarz iterative projection
%  least-squares method, but differing from linfit.m in
%  including the estimation of an additive constant.
%
%  syntax: [fit, vaf, coord, addcon] = linfitac(prox,inperm)
%
%  INPERM is the given order;
%  FIT is an $n \times n$ matrix that is fitted to
%  PROX(INPERM,INPERM) with variance-accounted-for VAF;
%  COORD gives the ordered coordinates whose absolute differences
%  could be used to reconstruct FIT; ADDCON is the estimated
%  additive constant that can be interpreted as being added to PROX.
\end{verbatim}

\section*{linfitac\_altcomp.m}

\begin{verbatim}
%  LINFITAC_ALTCOMP does a confirmatory fitting of a given unidimensional order
%  using the Dykstra--Kaczmarz iterative projection
%  least-squares method, but differing from linfit.m in
%  including the estimation of an additive constant.
%
%  syntax: [fit, vaf, coord, addcon] = linfitac_altcomp(prox,inperm)
%
%  INPERM is the given order;
%  FIT is an $n \times n$ matrix that is fitted to
%  PROX(INPERM,INPERM) with variance-accounted-for VAF;
%  COORD gives the ordered coordinates whose absolute differences
%  could be used to reconstruct FIT; ADDCON is the estimated
%  additive constant that can be interpreted as being added to PROX. Note
%  that in comparison with linfitac.m, ADDCON here has the opposite sign.
\end{verbatim}



\section*{linfitac\_missing.m}

\begin{verbatim}
%  LINFITAC_MISSING does a confirmatory fitting of a given unidimensional order
%  using the Dykstra--Kaczmarz iterative projection
%  least-squares method, but differing from linfit.m in
%  including the estimation of an additive constant;also, missing entries
%  in the input proximity matrix PROX are given values of zero.
%
%  syntax: [fit, vaf, addcon] = ...
%                linfitac_missing(prox,inperm,proxmiss)
%
%  INPERM is the given order;
%  FIT is an $n \times n$ matrix that is fitted to
%  PROX(INPERM,INPERM) with variance-accounted-for VAF;
%  ADDCON is the estimated additive constant that can be interpreted
%  as being added to PROX.  PROXMISS is the same size as PROX (with main
%  diagonal entries all zero); an off-diagonal entry of 1.0 denotes an
%  entry in PROX that is present and 0.0 if it is absent.
\end{verbatim}



\section*{linfitac\_tied.m}

\begin{verbatim}
%  LINFITAC_TIED does a confirmatory fitting of a given unidimensional order
%  using the Dykstra--Kaczmarz iterative projection
%  least-squares method, but differing from linfit_tied.m in
%  including the estimation of an additive constant.  This also allows
%  the possible imposition of tied coordinates.
%
%  syntax: [fit, vaf, coord, addcon] = linfitac_tied(prox,inperm,tiedcoord)
%
%  INPERM is the given order;
%  FIT is an $n \times n$ matrix that is fitted to
%  PROX(INPERM,INPERM) with variance-accounted-for VAF;
%  COORD gives the ordered coordinates whose absolute differences
%  could be used to reconstruct FIT; ADDCON is the estimated
%  additive constant that can be interpreted as being added to PROX.
%  TIEDCOORD is the tied pattern of coordinates imposed (in order)
%  along the continuum (using the integers from 1 up to n
%  to indicate the tied positions).
\end{verbatim}

\section*{linfitl1.m}

\begin{verbatim}
%LINFITL1 does a confimatory fitting in the $L_{1}$ norm of a given unidimensional
%  order using linear programming.
%  INPERM is the given order; FIT is an $n \times n$ matrix that is fitted to
%  PROX(INPERM,INPERM) with $L_{1}$ value DIFF; COORD gives the ordered coordinates
%  whose absolute differences could be used to reconstruct FIT.
%  EXITFLAG indicates the success of the optimization ( > 0 indicates convergence;
%  0 indicates that the maximum number of function evaluations or iterations were
%  reached; and < 0 denotes nonconvergence).
\end{verbatim}

\section*{linfitl1ac.m}

\begin{verbatim}
%LINFITL1AC does a confimatory fitting in the $L_{1}$ norm of a given unidimensional
%  order using linear programming, with the estimation of
%  an additive constant (ADDCON).
%  INPERM is the given order; FIT is an $n \times n$ matrix that is fitted to
%  PROX(INPERM,INPERM) with deviance DEV; COORD gives the ordered coordinates
%  whose absolute differences could be used to reconstruct FIT.
%  EXITFLAG indicates the success of the optimization ( > 0 indicates convergence;
%  0 indicates that the maximum number of function evaluations or iterations were
%  reached; and < 0 denotes nonconvergence).
\end{verbatim}



\section*{linfittm.m}

\begin{verbatim}
%  LINFITTM does a confirmatory two-mode fitting of a given
%  unidimensional ordering of the row and column objects of
%  a two-mode proximity matrix PROXTM using Dykstra's (Kaczmarz's)
%  iterative projection least-squares method.
%
%  syntax: [fit,diff,rowperm,colperm,coord] = linfittm(proxtm,inperm)
%
%  INPERM is the given ordering of the row and column objects
%  together; FIT is an nrow (number of rows) by ncol (number
%  of columns) matrix of absolute coordinate differences that
%  is fitted to PROXTM(ROWPERM,COLPERM) with DIFF being the
%  (least-squares criterion) sum of squared discrepancies
%  between FIT and PROXTM(ROWPERM,COLMEAN);
%  ROWPERM and COLPERM are the row and column object orderings
%  derived from INPERM.  The nrow + ncol coordinates
%  (ordered with the smallest
%  set at a value of zero) are given in COORD.
\end{verbatim}



\section*{linfittmac.m}

\begin{verbatim}
%  LINFITTMAC does a confirmatory two-mode fitting of a given
%  unidimensional ordering of the row and column objects of
%  a two-mode proximity matrix PROXTM using Dykstra's (Kaczmarz's)
%  iterative projection least-squares method;
%  it differs from linfittm.m  by including the estimation of an
%  additive constant.
%
%  syntax: [fit,vaf,rowperm,colperm,addcon,coord] = ...
%    linfittmac(proxtm,inperm)
%
%  INPERM is the given ordering of the row and column objects
%  together; FIT is an nrow (number of rows) by ncol (number
%  of columns) matrix  of absolute coordinate differences that
%  is fitted to PROXTM(ROWPERM,COLPERM) with VAF being the
%  variance-accounted-for.  ROWPERM and COLPERM are the row and
%  column object orderings derived from INPERM.  ADDCON is the
%  estimated additive constant that can be interpreted as being
%  added to PROXTM (or, alternatively, subtracted
%  from the fitted matrix FIT).  The nrow + ncol coordinates
%  (ordered with the smallest
%  set at a value of zero) are given in COORD.
\end{verbatim}

\section*{linfittmac\_altcomp.m}

\begin{verbatim}
%  LINFITTMAC_ALTCOMP does a confirmatory two-mode fitting of a given
%  unidimensional ordering of the row and column objects of
%  a two-mode proximity matrix PROXTM using Dykstra's (Kaczmarz's)
%  iterative projection least-squares method;
%  it differs from linfittm.m  by including the estimation of an
%  additive constant.
%
%  syntax: [fit,vaf,rowperm,colperm,addcon,coord] = ...
%    linfittmac_altcomp(proxtm,inperm)
%
%  INPERM is the given ordering of the row and column objects
%  together; FIT is an nrow (number of rows) by ncol (number
%  of columns) matrix  of absolute coordinate differences that
%  is fitted to PROXTM(ROWPERM,COLPERM) with VAF being the
%  variance-accounted-for.  ROWPERM and COLPERM are the row and
%  column object orderings derived from INPERM.  ADDCON is the
%  estimated additive constant that can be interpreted as being
%  added to PROXTM (or, alternatively, subtracted
%  from the fitted matrix FIT).  The nrow + ncol coordinates
%  (ordered with the smallest
%  set at a value of zero) are given in COORD.  Note that in comparison
%  with linfittmac.m, ADDCON here has the opposite sign.
\end{verbatim}

\section*{lsqisotonic.m -- from the MATLAB Statistics Toolbox}

\begin{verbatim}
%LSQISOTONIC Isotonic least squares.
%   YHAT = LSQISOTONIC(X,Y) returns a vector of values that minimize the
%   sum of squares (Y - YHAT).^2 under the monotonicity constraint that
%   X(I) > X(J) => YHAT(I) >= YHAT(J), i.e., the values in YHAT are
%   monotonically non-decreasing with respect to X (sometimes referred
%   to as "weak monotonicity").  LSQISOTONIC uses the "pool adjacent
%   violators" algorithm.
%
%   If X(I) == X(J), then YHAT(I) may be <, ==, or > YHAT(J) (sometimes
%   referred to as the "primary approach").  If ties do occur in X, a plot
%   of YHAT vs. X may appear to be non-monotonic at those points.  In fact,
%   the above monotonicity constraint is not violated, and a reordering
%   within each group of ties, by ascending YHAT, will produce the desired
%   appearance in the plot.
%
%   YHAT = LSQISOTONIC(X,Y,W) performs weighted isotonic regression using
%   the non-negative weights in W.

%   Copyright 2003-2006 The MathWorks, Inc.
%   $Revision: 1.1.6.5 $  $Date: 2006/06/20 20:51:42 $

%   References:
%      [1] Kruskal, J.B. (1964) "Nonmetric multidimensional scaling: a
%          numerical method", Psychometrika 29:115-129.
%      [2] Cox, R.F. and Cox, M.A.A. (1994) Multidimensional Scaling,
%          Chapman&Hall.
\end{verbatim}

\section*{matrix\_colorcode.m}

\begin{verbatim}
% MATRIX_COLORCODE constructs a color representation for the values in an
% $n \times m$ matrix, DATAMATRIX.  The rows and columns of DATAMATRIX are
% permuted by ROWPERM and COLPERM, respectively.  CMAP is the input
% colormap for the representation (e.g., bone(256)).
\end{verbatim}

\section*{matrix\_movie.m}

\begin{verbatim}
% MATRIX_MOVIE constructs a color movie of the effects of a series
% of permutations on a proximity matrix.
% DATAMATRIX is an n by n symmetric proximity matrix; PERMS is
% a cell array containing NUMPERMS permutations; CMAP
% is the input colormap used for the representation (e.g.,
% bone(256)).
\end{verbatim}



\section*{monotonic\_regression\_dykstra.m}

\begin{verbatim}
% MONOTONIC_REGRESSION_DYKSTRA returns a vector of values in YHAT that are
% weakly monotonic with respect to the values in an independent input
% vector X, and minimize the least-squares loss to the values in the
% dependent input vector Y.  The variance-accounted-for in Y from YHAT is
% given by VAF_YHAT.
%
% syntax: [yhat,vaf_yhat] = monotonic_regression_dykstra(x,y)
%
% The least-squares optimization is carried out through Dykstra's method of
% iterative projection.
\end{verbatim}


\section*{order.m}

\begin{verbatim}
% ORDER carries out an iterative Quadratic Assignment maximization
% task using a given square ($n x n$) proximity matrix PROX (with
% a zero main diagonal and a dissimilarity interpretation).
%
% syntax: [outperm,rawindex,allperms,index] = ...
%   order(prox,targ,inperm,kblock)
%
% Three separate local operations are used to permute
% the rows and columns of the proximity matrix to maximize the
% cross-product index with respect to a given square target matrix
% TARG: pairwise interchanges of objects in the permutation defining
% the row and column order of the square proximity matrix;
% the insertion of from 1 to KBLOCK
% (which is less than or equal to $n-1$) consecutive objects in
% the permutation defining the row and column order of the data
% matrix; the rotation of from 2 to KBLOCK
% (which is less than or equal to $n-1$) consecutive objects in
% the permutation defining the row and column order of the data
% matrix. INPERM is the input beginning permutation (a permutation
% of the first $n$ integers).
% OUTPERM is the final permutation of PROX with the
% cross-product index RAWINDEX
% with respect to TARG. ALLPERMS is a cell array containing INDEX
% entries corresponding to all the
% permutations identified in the optimization from ALLPERMS{1} =
% INPERM to ALLPERMS{INDEX} = OUTPERM.
\end{verbatim}



\section*{order\_missing.m}

\begin{verbatim}
% ORDER_MISSING carries out an iterative Quadratic Assignment maximization
% task using a given square ($n x n$) proximity matrix PROX (with
% a zero main diagonal and a dissimilarity interpretation; missing entries
% PROX are given values of zero).
%
% syntax: [outperm,rawindex,allperms,index] = ...
%   order_missing(prox,targ,inperm,kblock,proxmiss)
%
% Three separate local operations are used to permute
% the rows and columns of the proximity matrix to maximize the
% cross-product index with respect to a given square target matrix
% TARG: pairwise interchanges of objects in the permutation defining
% the row and column order of the square proximity matrix;
% the insertion of from 1 to KBLOCK
% (which is less than or equal to $n-1$) consecutive objects in
% the permutation defining the row and column order of the data
% matrix; the rotation of from 2 to KBLOCK
% (which is less than or equal to $n-1$) consecutive objects in
% the permutation defining the row and column order of the data
% matrix. INPERM is the input beginning permutation (a permutation
% of the first $n$ integers).  PROXMISS is the same size as PROX (with
% main diagonal entries all zero); an off-diagonal entry of 1.0 denotes an
% entry in PROX that is present and 0.0 if it is absent.
% OUTPERM is the final permutation of PROX with the
% cross-product index RAWINDEX
% with respect to TARG. ALLPERMS is a cell array containing INDEX
% entries corresponding to all the
% permutations identified in the optimization from ALLPERMS{1} =
% INPERM to ALLPERMS{INDEX} = OUTPERM.
\end{verbatim}



\section*{orderpartitionfit.m}

\begin{verbatim}
% ORDERPARTITIONFIT provides a least-squares approximation to a proximity
% matrix based on a given collection of partitions with ordered classes.
%
% syntax: [fit,weights,vaf] = orderpartitionfit(prox,lincon,membership)
%
% PROX is the n x n input proximity matrix (with a zero main diagonal
% and a dissimilarity interpretation); LINCON is the given constraining
% linear order (a permutation of the integers from 1 to n).
% MEMBERSHIP is the m x n matrix indicating cluster membership, where
% each row corresponds to a specific ordered partition (there are
% m partitions in general);
% the columns are in the identity permutation input order used for PROX.
% FIT is an n x n matrix fitted to PROX (through least-squares) constructed
% from the nonnegative weights given in the m x 1 WEIGHTS vectors
% corresponding to each of the ordered partitions.  VAF is the variance-
% accounted-for in the proximity matrix PROX by the fitted matrix FIT.
\end{verbatim}



\section*{orderpartitionfnd.m}

\begin{verbatim}
% ORDERPARTITIONFND uses dynamic programming to
% construct a linearly constrained cluster analysis that
% consists of a collection of partitions with from 1 to
% n ordered classes.
%
% syntax: [membership,objectives,permmember,clusmeasure,...
%    cluscoord,residsumsq] = orderpartitionfnd(prox,lincon)
%
% PROX is the input proximity matrix (with a zero main diagonal
% and a dissimilarity interpretation); LINCON is the given
% constraining linear order (a permutation of the integers from
% 1 to n).
% MEMBERSHIP is the n x n matrix indicating cluster membership,
% where rows correspond to the number of ordered clusters,
% and the columns are in the identity permutation input order
% used for PROX. PERMMEMBER uses LINCON to reorder the columns
% of MEMBERSHIP.
% OBJECTIVES is the vector of merit values maximized in the
% construction of the ordered partitions; RESIDSUMSQ is the
% vector of residual sum of squares obtained for the ordered
% partition construction.  CLUSMEASURE is the n x n matrix
% (upper-triangular) containing the cluster measures for contiguous
% object sets; the appropriate values in CLUSMEASURE are added
% to obtain the values optimized in OBJECTIVES; CLUSCOORD is also
% an n x n (upper-triangular) matrix but now containing the coordinates
% that would be would be used for all the (ordered)
% objects within a class.
\end{verbatim}



\section*{ordertm.m}

\begin{verbatim}
% ORDERTM carries out an iterative
% quadratic assignment maximization task using the
% two-mode proximity matrix PROXTM
% (with entries deviated from the mean proximity)
% in the upper-right- and lower-left-hand portions of
% a defined square ($n x n$) proximity matrix
% (called SQUAREPROX with a dissimilarity interpretation)
% with zeros placed elsewhere ($n$ = number of rows +
% number of columns of PROXTM = nrow + ncol).
%
% syntax: [outperm, rawindex, allperms, index, squareprox] = ...
%   ordertm(proxtm, targ, inperm, kblock)
%
% Three separate local operations are used to permute
% the rows and columns of the square
% proximity matrix to maximize the cross-product
% index with respect to a square target matrix TARG:
% pairwise interchanges of objects in the
% permutation defining the row and column
% order of the square proximity matrix; the insertion of from 1 to
% KBLOCK (which is less than or equal to $n-1$) consecutive objects
% in the permutation defining the row and column order of the
% data matrix; the rotation of from 2 to KBLOCK (which is less than
% or equal to $n-1$) consecutive objects in
% the permutation defining the row and column order of the data
% matrix. INPERM is the input beginning permutation (a permutation
% of the first $n$ integers).
% PROXTM is the two-mode $nrow x ncol$ input proximity matrix.
% TARG is the $n x n$ input target matrix.
% OUTPERM is the final permutation of SQUAREPROX with the
% cross-product index RAWINDEX
% with respect to TARG. ALLPERMS is a cell array containing INDEX
% entries corresponding to all the
% permutations identified in the optimization from ALLPERMS{1}
% = INPERM to ALLPERMS{INDEX} = OUTPERM.
\end{verbatim}



\section*{partitionfit.m}

\begin{verbatim}
% PARTITIONFIT provides a least-squares approximation to a proximity
% matrix based on a given collection of partitions.
%
% syntax: [fitted,vaf,weights,end_condition] = partitionfit(prox,member)
%
% PROX is the n x n input proximity matrix (with a zero main diagonal
% and a dissimilarity interpretation); MEMBER is the m x n matrix
% indicating cluster membership, where each row corresponds to a specific
% partition (there are m partitions in general); the columns of MEMBER
% are in the same input order used for PROX.
% FITTED is an n x n matrix fitted to PROX (through least-squares)
% constructed from the nonnegative weights given in the m x 1 WEIGHTS
% vector corresponding to each of the partitions.  VAF is the variance-
% accounted-for in the proximity matrix PROX by the fitted matrix FITTED.
% END_CONDITION should be zero for a normal termination of the optimization
% process.
\end{verbatim}

\section*{partitionfit\_addcon.m}

\begin{verbatim}
% PARTITIONFIT provides a least-squares approximation to a proximity
% matrix based on a given collection of partitions.
%
% syntax: [fitted,vaf,weights,end_condition] = partitionfit_addcon(prox,member)
%
% PROX is the n x n input proximity matrix (with a zero main diagonal
% and a dissimilarity interpretation); MEMBER is the m x n matrix
% indicating cluster membership, where each row corresponds to a specific
% partition (there are m partitions in general); the columns of MEMBER
% are in the same input order used for PROX.
% FITTED is an n x n matrix fitted to PROX (through least-squares)
% constructed from the nonnegative weights given in the m x 1 WEIGHTS
% vector corresponding to each of the partitions.  VAF is the variance-
% accounted-for in the proximity matrix PROX by the fitted matrix FITTED.
% END_CONDITION should be zero for a normal termination of the optimization
% process.  ADDCON is an automatically estimated additive constrant.
\end{verbatim}

\section*{partitionfit\_twomode.m}

\begin{verbatim}
% PARTITIONFIT_TWOMODE provides a least-squares approximation to a two-mode
% proximity matrix based on a given collection of partitions.
%
% syntax: [fitted,vaf,weights,end_condition] = partitionfit_twomode(prox,member)
%
% PROXTM is the nrow x ncol two-mode input proximity matrix (with a zero main diagonal
% and a dissimilarity interpretation); MEMBER is the m x n (n = nrow+ ncol) matrix
% indicating cluster membership, where each row corresponds to a specific
% partition (there are m partitions in general); the columns of MEMBER
% are in the same order used for PROXTM, with rows first and columns to follow.
% FITTED is an nrow x ncol matrix fitted to PROXTM (through least-squares)
% constructed from the nonnegative weights given in the m x 1 WEIGHTS
% vector corresponding to each of the partitions.  VAF is the variance-
% accounted-for in the proximity matrix PROXTM by the fitted matrix FITTED.
% END_CONDITION should be zero for a normal termination of the optimization
% process.
\end{verbatim}

\section*{partitionfit\_twomode\_addcon}

\begin{verbatim}
% PARTITIONFIT_TWOMODE_ADDCON provides a least-squares approximation to a two-mode
% proximity matrix based on a given collection of partitions.
%
% syntax: [fitted,vaf,weights,end_condition] = partitionfit_twomode_addcon(prox,member)
%
% PROXTM is the nrow x ncol two-mode input proximity matrix (with a zero main diagonal
% and a dissimilarity interpretation); MEMBER is the m x n (n = nrow+ ncol) matrix
% indicating cluster membership, where each row corresponds to a specific
% partition (there are m partitions in general); the columns of MEMBER
% are in the same order used for PROXTM, with rows first and columns to follow.
% FITTED is an nrow x ncol matrix fitted to PROXTM (through least-squares)
% constructed from the nonnegative weights given in the m x 1 WEIGHTS
% vector corresponding to each of the partitions.  VAF is the variance-
% accounted-for in the proximity matrix PROXTM by the fitted matrix FITTED.
% END_CONDITION should be zero for a normal termination of the optimization
% process.  ADDCON is an automatically estimated additive constant.
\end{verbatim}

\section*{proxmon.m}

\begin{verbatim}
%  PROXMON produces a monotonically transformed proximity matrix
%  (MONPROXPERMUT) from the order constraints obtained from each
%  pair of entries in the input proximity matrix PROXPERMUT
%  (symmetric with a zero main diagonal and a dissimilarity
%  interpretation).
%
%  syntax: [monproxpermut, vaf, diff] = proxmon(proxpermut, fitted)
%
%  MONPROXPERMUT is close to the
%  $n \times n$ matrix FITTED in the least-squares sense;
%  the variance accounted for (VAF) is how
%  much variance in MONPROXPERMUT can be accounted for by
%  FITTED; DIFF is the value of the least-squares criterion.
\end{verbatim}



\section*{proxmontm.m}

\begin{verbatim}
%  PROXMONTM produces a monotonically transformed
%  two-mode proximity matrix (MONPROXPERMUTTM)
%  from the order constraints obtained
%  from each pair of entries in the input two-mode
%  proximity matrix PROXPERMUTTM (with a dissimilarity
%  interpretation).
%
%  syntax: [monproxpermuttm, vaf, diff] = ...
%       proxmontm(proxpermuttm, fittedtm)
%
%  MONPROXPERMUTTM is close to the $nrow \times ncol$
%  matrix FITTEDTM in the least-squares sense;
%  The variance accounted for (VAF) is how much variance
%  in MONPROXPERMUTTM can be accounted for by FITTEDTM;
%  DIFF is the value of the least-squares criterion.
\end{verbatim}



\section*{proxstd.m}

\begin{verbatim}
%  PROXSTD produces a standardized proximity matrix (STANPROX)
%  from the input $n \times n$ proximity matrix
%  (PROX) with zero main diagonal and a dissimilarity
%  interpretation.
%
%  syntax: [stanprox, stanproxmult] = proxstd(prox,mean)
%
%  STANPROX entries have unit variance (standard deviation of one)
%  with a mean of MEAN given as an input number;
%  STANPROXMULT (upper-triangular) entries have a sum of
%  squares equal to $n(n-1)/2$.
\end{verbatim}

\section*{sarobfit.m}

\begin{verbatim}
% SAROBFIT fits a strongly anti-Robinson matrix using
% iterative projection to a symmetric proximity matrix
% in the $L_{2}$-norm.
% PROX is the input proximity matrix ($n \times n$ with a
% zero main diagonal and a dissimilarity interpretation).
%
% syntax: [fit, vaf] = sarobfit(prox, inperm)
%
% INPERM is a given permutation of the first $n$ integers;
% FIT is the least-squares optimal matrix (with
% variance-accounted-for of VAF) to PROX having a strongly
% anti-Robinson form for the row and column
% object ordering given by INPERM.
\end{verbatim}

\section*{sarobfnd.m}

\begin{verbatim}
% SAROBFND finds and fits a strongly
% anti-Robinson matrix using iterative projection to
% a symmetric proximity matrix in the $L_{2}$-norm based on a
% permutation identified through the use of iterative
% quadratic assignment.
%
% syntax: [find, vaf, outperm] = sarobfnd(prox, inperm, kblock)
%
% PROX is the input proximity matrix ($n \times n$ with a zero
% main diagonal and a dissimilarity interpretation);
% INPERM is a given starting permutation of the first $n$ integers;
% FIND is the least-squares optimal matrix (with
% variance-accounted-for of VAF) to PROX having a strongly
% anti-Robinson form for the row and column
% object ordering given by the ending permutation OUTPERM. KBLOCK
% defines the block size in the use of the iterative
% quadratic assignment routine.
\end{verbatim}

\section*{skew\_symmetric\_lawler\_dp.m}

\begin{verbatim}
%  SKEW_SYMMETRIC_LAWLER_DP carries out a reordering of a skew-symmetric proximity
%  matrix using dynamic programming, and by maximizing the above-diagonal
%  sum of proximities.
%  PROX is the input skew-symmetric proximity matrix (with a zero main
%  diagonal);
%  PERMUT is the order of the objects in the optimal permutation;
%  PROX_PERMUT is the reordered proximity matrix using PERMUT;
%  CUMOBFUN gives the cumulative values of the objective function for
%  the successive placements of the objects in the optimal permutation.

%  Initializations.  The vectors VALSTORE and IDXSTORE store the results of
%  of the recursion for the $(2^n)-1$ nonempty subsets of $S$. The integer
%  positions in these vectors correspond to subsets whose binary
%  number equivalents are equal those integer positions.
\end{verbatim}

\section*{skew\_symmetric\_scaling.m}

\begin{verbatim}
% SKEW_SYMMETRIC_SCALING performs a closed-form least squares scaling of a
% skew-symmetric proximity matrix.
%
% syntax: [coord,sort_coord,permut,prox_permut,vaf,...
%   alpha_multiplier,alpha_vaf,alpha_coord] = skew_symmetric_scaling(prox)
%
% COORD contains the least-squares coordinates which are sorted from
% smallest to largest in SORT_COORD; VAF is the variance they account for;
% PERMUT is the object permutation
% corresponding to SORT_COORD with PROX_PERMUT the reordered skew-symmetric
% proximity matrix.  For equally-spaced coordinates, ALPHA_MULTIPLIER
% defines the multiplicative constant on the integer-valued coordinates; a
% collection of equally-spaced coordinates is given by ALPHA_COORD with
% ALPHA_VAF the variance they account for.
\end{verbatim}





\section*{targcir.m}

\begin{verbatim}
%  TARGCIR produces a symmetric proximity matrix of size
%  $n \times n$, containing distances
%  between equally and unit-spaced positions
%  around a circle: targcircular(i,j) = min(abs(i-j),n-abs(i-j)).
%
%  syntax: [targcircular] = targcir(n)
\end{verbatim}



\section*{targlin.m}

\begin{verbatim}
%  TARGLIN produces a symmetric proximity matrix of size
%  $n \times n$, containing distances
%  between equally and unit-spaced positions
%  along a line: targlinear(i,j) = abs(i-j).
%
%  syntax: [targlinear] = targlin(n)
\end{verbatim}



\section*{ultrafit.m}

\begin{verbatim}
% ULTRAFIT fits a given ultrametric using iterative projection to
% a symmetric proximity matrix in the $L_{2}$-norm.
%
% syntax: [fit,vaf] = ultrafit(prox,targ)
%
% PROX is the input proximity matrix (with a zero main diagonal
% and a dissimilarity interpretation);
% TARG is an ultrametric matrix of the same size as PROX;
% FIT is the least-squares optimal matrix (with
% variance-accounted-for of VAF) to PROX satisfying the ultrametric
% constraints implicit in TARG.
\end{verbatim}



\section*{unicirac.m}

\begin{verbatim}
% UNICIRAC finds and fits a circular
% unidimensional scale using iterative projection to
% a symmetric proximity matrix in the $L_{2}$-norm based on a
% permutation identified through the use of iterative
% quadratic assignment.
%
% syntax: [find, vaf, outperm, addcon] = unicirac(prox, inperm, kblock)
%
% PROX is the input proximity matrix ($n \times n$ with a
% zero main diagonal and a dissimilarity interpretation);
% INPERM is a given starting permutation (assumed to be around the
% circle) of the first $n$ integers;
% FIND is the least-squares optimal matrix (with
% variance-accounted-for of VAF) to PROX having a circular
% anti-Robinson form for the row and column
% object ordering given by the ending permutation OUTPERM.
% The spacings among the objects are given by the diagonal entries
% in FIND (and the extreme (1,n) entry in FIND). KBLOCK
% defines the block size in the use of the iterative quadratic
% assignment routine. The additive constant for the model is
% given by ADDCON.
\end{verbatim}

\section*{uniscallp.m}

\begin{verbatim}
%UNISCALLP carries out a unidimensional scaling of a symmetric proximity
%  matrix using iterative linear programming.
%  PROX is the input proximity matrix (with a zero main diagonal and a
%  dissimilarity interpretation);
%  INPERM is the input beginning permutation (a permuation of the first $n$ integers).
%  OUTPERM is the final permutation of PROX.
%  COORD is the set of coordinates of the unidimensional scaling
%  in ascending order;
%  DIFF is the value of the l1 loss function for the
%  coordinates and object permutation; and FIT is the matrix of absolute
%  coordinate differences being fit to PROX(OUTPERM,OUTPERM).
\end{verbatim}

\section*{uniscallpac.m}

\begin{verbatim}
%UNISCALLPAC carries out a unidimensional scaling of a symmetric proximity
%  matrix using iterative linear programming, with the inclusion of an
%  additive constant (ADDCON) in the model.
%  PROX is the input proximity matrix (with a zero main diagonal and a
%  dissimilarity interpretation);
%  INPERM is the input beginning permutation (a permuation of the first $n$ integers).
%  OUTPERM is the final permutation of PROX.
%  COORD is the set of coordinates of the unidimensional scaling
%  in ascending order;
%  DEV is the value of deviance (the normalized $L_{1}$ loss function) for the
%  coordinates and object permutation; and FIT is the matrix being fit to
%  PROX(OUTPERM,OUTPERM) with the given deviance.
\end{verbatim}


\section*{uniscaltmac\_altcomp.m}

\begin{verbatim}
% UNISCALTMAC finds and fits a linear
% unidimensional scale using iterative projection to
% a two-mode proximity matrix in the $L_{2}$-norm based on a
% permutation identified through the use of iterative
% quadratic assignment.
%
% syntax: [find,vaf,outperm,rowperm,colperm,addcon,coord] = ...
%    uniscaltmac_altcomp(proxtm,inperm,kblock)
%
% PROXTM is the input two-mode proximity matrix
% ($n_{a} \times n_{b}$ with a zero main diagonal
% and a dissimilarity interpretation);
% INPERM is a given starting permutation of the
% first $n = n_{a} + n_{b}$ integers;
% FIND is the least-squares optimal matrix (with
% variance-accounted-for of VAF) to PROXTM having a linear
% unidimensional form for the row and column
% object ordering given by the ending permutation OUTPERM.
% The spacings among the objects are given by the entries in FIND.
% KBLOCK defines the block size in the use of the iterative
% quadratic assignment routine.
% The additive constant for the model is given by ADDCON.
% ROWPERM and COLPERM are the resulting row and column
% permutations for the objects.  The nrow + ncol coordinates
% (ordered with the smallest set at a value of zero)
% are given in COORD.
\end{verbatim}



\section*{uniscalqa.m}

\begin{verbatim}
%  UNISCALQA carries out a unidimensional scaling of a symmetric
%  proximity matrix using iterative quadratic assignment.
%
%  syntax: [outperm, rawindex, allperms, index, coord, diff] = ...
%   uniscalqa(prox, targ, inperm, kblock)
%
%  PROX is the input proximity matrix (with a zero main diagonal
%  and a dissimilarity interpretation);
%  TARG is the input target matrix (usually with a zero main
%  diagonal and a dissimilarity interpretation representing
%  equally spaced locations along a continuum);
%  INPERM is the input beginning permutation (a permutation of the
%  first $n$ integers). OUTPERM is the final permutation of PROX
%  with the cross-product index RAWINDEX
%  with respect to TARG redefined as
%  $ = \{abs(coord(i) - coord(j))\}$;
%  ALLPERMS is a cell array containing INDEX entries corresponding
%  to all the permutations identified in the optimization from
%  ALLPERMS{1} = INPERM to ALLPERMS{INDEX} = OUTPERM.
%  The insertion and rotation routines use from 1 to KBLOCK
%  (which is less than or equal to $n-1$) consecutive objects in
%  the permutation defining the row and column order of the data
%  matrix.  COORD is the set of coordinates of the unidimensional
%  scaling in ascending order;
%  DIFF is the value of the least-squares loss function for the
%  coordinates and object permutation.
\end{verbatim}



\end{document}
