help biplot dialog: biplot
-------------------------------------------------------------------------------
Title
[MV] biplot -- Biplots
Syntax
biplot varlist [if] [in] [, options]
options description
-------------------------------------------------------------------------
Main
rowover(varlist) identify observations from different
groups of varlist; may not be combined
with separate or norow
dim(# #) two dimensions to be displayed; default
dim(2 1)
std use standardized instead of centered
variables
alpha(#) row weight=#; column weight=1-#; default
is 0.5
stretch(#) stretch the column (variable) arrows
mahalanobis approximate Mahalanobis distance; implies
alpha(0)
xnegate negate the data relative to the x axis
ynegate negate the data relative to the y axis
autoaspect adjust aspect ratio on the basis of the
data; default aspect ratio is 1
separate produce separate plots for rows and
columns; may not be combined with
rowover()
nograph suppress graph
table display table showing biplot coordinates
Rows
rowopts(row_options) affect rendition of rows (observations)
row#opts(row_options) affect rendition of rows (observations) in
the #th group of varlist defined in
rowover(); available only with rowover()
rowlabel(varname) specify label variable for rows
(observations)
norow suppress row points; may not be combined
with rowover()
generate(newvar_x newvar_y) store biplot coordinates for observations
in variables newvar_x and newvar_y
Columns
colopts(col_options) affect rendition of columns (variables)
negcol include negative column (variable) arrows
negcolopts(col_options) affect rendition of negative columns
(variables)
nocolumn suppress column arrows
Y axis, X axis, Titles, Legend, Overall
twoway_options any options other than by() documented in
[G] twoway_options
-------------------------------------------------------------------------
row_options description
-------------------------------------------------------------------------
marker_options change look of markers (color, size, etc.)
marker_label_options change look or position of marker labels
nolabel remove the default row (variable) label
from the graph
name(name) override the default name given to rows
(observations)
-------------------------------------------------------------------------
col_options description
-------------------------------------------------------------------------
pcarrow_options affect the rendition of paired-coordinate
arrows
nolabel remove the default column (variable) label
from the graph
name(name) override the default name given to columns
(variables)
-------------------------------------------------------------------------
Menu
Statistics > Multivariate analysis > Biplot
Description
biplot displays a two-dimensional biplot of a dataset. A biplot
simultaneously displays the observations (rows) and the relative
positions of the variables (columns). Marker symbols (points) are
displayed for observations and arrows are displayed for variables.
Observations are projected to two dimensions such that the distance
between the observations is approximately preserved. The cosine of the
angle between arrows approximates the correlation between the variables.
Options
+------+
----+ Main +-------------------------------------------------------------
rowover(varlist) distinguishes groups among observations (rows) by
highlighting observations on the plot for each group identified by
equal values of the variables in varlist. By default, the graph
contains a legend that consists of group names. rowover() may not be
combined with separate or norow.
dim(# #) identifies the dimensions to be displayed. For instance, dim(3
2) plots the third dimension (vertically) versus the second dimension
(horizontally). The dimension numbers cannot exceed the number of
variables. The default is dim(2 1).
std produces a biplot of the standardized variables instead of the
centered variables.
alpha(#) specifies that the variables be scaled by lambda^# and the
observations by lambda^(1-#), where lambda are the singular values.
It is required that 0 <= # <= 1. The most common values are 0, 0.5,
and 1. The default is alpha(0.5) and is known as the symmetrically
scaled biplot or symmetric factorization biplot. The result with
alpha(1) is the principal-component biplot, also called the
row-preserving metric (RPM) biplot. The biplot with alpha(0) is
referred to as the column-preserving metric (CPM) biplot.
stretch(#) causes the length of the arrows to be multiplied by #. For
example, stretch(1) would leave the arrows the same length,
stretch(2) would double their length, and stretch(0.5) would halve
their length.
mahalanobis implies alpha(0) and scales the positioning of points
(observations) by sqrt(n-1) and positioning of arrows (variables) by
1/sqrt(n-1). This additional scaling causes the distances between
observations to change from being approximately proportional to the
Mahalanobis distance to instead being approximately equal to the
Mahalanobis distance. Also, the inner products between variables
approximate their covariance.
xnegate specifies that dimension-1 (x axis) values be negated (multiplied
by -1).
ynegate specifies that dimension-2 (y axis) values be negated (multiplied
by -1).
autoaspect specifies that the aspect ratio be automatically adjusted
based on the range of the data to be plotted. This option can make
some biplots more readable. By default, biplot uses an aspect ratio
of one, producing a square plot. Some biplots will have little
variation in the y-axis direction, and using the autoaspect option
will better fill the available graph space while preserving the
equivalence of distance in the x and y axes.
As an alternative to autoaspect, the twoway_option aspectratio() can
be used to override the default aspect ratio. biplot accepts the
aspectratio() option as a suggestion only and will override it when
necessary to produce plots with balanced axes; i.e., distance on the
x axis equals distance on the y axis.
twoway_options, such as xlabel(), xscale(), ylabel(), and yscale(),
should be used with caution. These options are accepted but may have
unintended side effects on the aspect ratio.
separate produces separate plots for the row and column categories. The
default is to overlay the plots. separate may not be combined with
rowover().
nograph suppresses displaying the graph.
table displays a table with the biplot coordinates.
+------+
----+ Rows +-------------------------------------------------------------
rowopts(row_options) affects the rendition of the points plotting the
rows (observations). This option may not be combined with rowover().
The following row_options are allowed:
marker_options affect the rendition of markers drawn at the plotted
points, including their shape, size, color, and outline; see [G]
marker_options.
marker_label_options specify the properties of marker labels; see [G]
marker_label_options. mlabel() in rowopts() may not be combined
with the rowlabel() option.
nolabel removes the default row label from the graph.
name(name) overrides the default name given to rows.
row#opts(row_options) affects rendition of the points plotting the rows
(observations) in the #th group identified by equal values of the
variables in varlist defined in rowover(). This option requires
specifying rowover(). See rowopts() above for the allowed
row_options, except mlabel() is not allowed with row#opts().
rowlabel(varname) specifies label variable for rows (observations).
norow suppresses plotting of row points. This option may not be combined
with rowover().
generate(newvar_x newvar_y) stores biplot coordinates for rows in
variables newvar_x and newvar_y.
+---------+
----+ Columns +----------------------------------------------------------
colopts(col_options) affects the rendition of the arrows and points
plotting the columns (variables). The following col_options are
allowed:
pcarrow_options affect the rendition of paired-coordinate arrows; see
> [G] graph twoway pcarrow.
nolabel removes the default column label from the graph.
name(name) overrides the default name given to columns.
negcol includes negative column (variable) arrows on the plot.
negcolopts(col_options) affects the rendition of the arrows and points
plotting the negative columns (variables). The col_options allowed
are given above.
nocolumn suppresses plotting of column arrows.
+-----------------------------------------+
----+ Y axis, X axis, Titles, Legend, Overall +--------------------------
twoway_options are any of the options documented in [G] twoway_options
excluding by(). These include options for titling the graph (see [G]
title_options) and for saving the graph to disk (see [G]
saving_option). See autoaspect above for a warning against using
options such as xlabel(), xscale(), ylabel(), and yscale().
Examples
Setup
. webuse renpainters
Biplot of 10 Renaissance painters on four attributes
. biplot composition-expression, alpha(1) stretch(10) table
rowlabel(painter) rowopts(name(Painters))
colopts(name(Attributes)) title(Renaissance painters) autoaspect
Same as above, but highlights observations with the same score on
attribute colour
. biplot composition-expression, alpha(1) stretch(10) table
rowover(colour) rowlabel(painter) colopts(name(Attributes))
title(Renaissance painters) autoaspect
Same as above, but uses the defined names and suppresses the marker label
. biplot composition-expression, alpha(1) stretch(10) table
rowover(colour) row1opts(name("Color score: 4") nolabel)
row2opts(name("Color score: 7") nolabel) row3opts(name("Color
score: 8") nolabel) row4opts(name("Color score: 9") nolabel)
row5opts(name("Color score: 10") nolabel) row6opts(name("Color
score: 12") nolabel) row7opts(name("Color score: 16") nolabel)
colopts(name(Attributes)) title(Renaissance painters) autoaspect
Saved results
biplot saves the following in r():
Scalars
r(rho1) explained variance by component 1
r(rho2) explained variance by component 2
r(rho) total explained variance
r(alpha) value of alpha() option
Matrices
r(U) biplot coordinates for the observations; stored
only if the row dimension does not exceed Stata's
maximum matrix size; as an alternative, use
generate() to store biplot coordinates for the
observations in variables
r(V) biplot coordinates for the variables
r(Vstretch) biplot coordinates for the variables times
stretch() factor
Also see
Manual: [MV] biplot
Help: [MV] ca, [MV] mds, [MV] pca