scatpair |

Display a scatterplot pairs graph (if possible).

The data will be plotted in pairs, where the first two series or columns are plotted against each other, the second two series or columns are plotted against each other, and so forth. If the number of series or columns is odd, the last one will be ignored.

Scatterplots are simply XY plots with symbols turned on and lines turned off (see
Graph::setelem). The scatpair graph type is equivalent to using
scat with the “mult=pairs” option indicating that the data should be graphed in pairs.

Syntax

scatpair(options) o1 o2 [o3 ... ]

object_name.scatpair(options) [auxiliary_spec(arg)]

where o1, o2, ..., are series or group objects.

Following the scatpair keyword, you may specify general graph characteristics using options. Available options include plotting the data in multiple graphs, template application, and adding axis extensions.

The optional auxilary_spec allows you to add fit lines to the scatterplot (regression lines, kernel fit, nearest neighbor fit, orthogonal regression, and confidence ellipses; see
“Auxiliary Spec”).

Options

Scale options

a (default) | Automatic single scale. |

d | Dual scaling with no crossing. |

x | Dual scaling with possible crossing. |

n | Normalized scale (zero mean and unit standard deviation). |

ab=type | Add axis border along data scales, where type may be “hist” or “h” (histogram), “boxplot” or “b”, “kernel” or “k”. (Note: axis borders are not available for panel graphs with “panel=” options that involve summaries: mean, median, etc.) |

Multiple series pair options

m | Place scatterplots in multiple graphs. |

Template and printing options

o=template | Use appearance options from the specified template. template may be a predefined template keyword (“default” - current global defaults, “classic”, “modern”, “reverse”, “midnight”, “spartan”, “monochrome”) or a graph in the workfile. |

t=graph_name | Use appearance options and copy text and shading from the specified graph. |

b / -b | [Apply / Remove] bold modifiers of the base template style specified using the “o=” option above. |

w / -w | [Apply / Remove] wide modifiers of the base template style specified using the “o=” option above. |

reset | Resets all graph options to the global defaults. May be used to remove existing customization of the graph. |

p | Print the graph. |

The options which support the “–” may be preceded by a “+” or “–” indicating whether to turn on or off the option. The “+” is optional.

Note that use of the template option will override the symbol setting.

Graph data options

The following option is available in categorical graph settings:

contract=key | Contract the data as specified by key, where key may be: “mean”, “median”, “max”, “min”, “sum”, “var” - variance, “sd” - standard deviation, “sumsq” - sum of the squared values, “skew” - skewness, “kurt” - kurtosis, “nas” - number of missing values, “obs” - number of observations, “unique” - error if the series is not identical for all observations in a given group, “first” - first observation in category using workfile order, “last” - last observation in category using workfile order, “quant(quantile)” - where quantile is a number between 0 and 1. |

Panel options

The following option applies when graphing panel structured data.

panel=arg (default taken from global settings) | Panel data display: “stack” (stack the cross-sections), “individual” or “i” (separate graph for each cross-section), “combine” or “c” (combine cross-section graphs in a single frame), “mean” (plot means across cross-sections), “median” (plot median across cross-sections). (Note: more general versions of these panel graphs may be constructed as categorical graphs.) |

Examples

Basic examples

scatpair weight height age length

displays a combined scatterplot with AGE on the horizontal and HEIGHT on the vertical axis, and with WEIGHT on the horizontal and LENGTH on the vertical axis.

group g1 weight height age length

g1.scatpair

displays the same graph using the named group G1.

g1.scatpair(m, ab=kern)

displays each scatterplot in a separate frame with kernel density plots along the borders.

g1.scatpair(t=scat2)

displays the pairwise scatterplots, using the graph object SCAT2 as a template.

g1.scatpair(d)

shows a scatterplot for the pairs with dual scales and no crossing.

Panel examples

g1.scatpair kernfit

shows the scatterplot of the stacked panel data for pairs of series in G1. The scatterplot will be drawn with a common symbol type and color for all observations, and the kernel fit will use all of the observations.

g1.scatpair(panel=individual) linefit

displays, in individual frames, scatterplot pairs with fitted regression lines for each of the cross-sections.

g1.scatpair(panel=combined) linefit

displays the cross-section scatterplots and regression lines in a single graph frame. Different symbols and colors will be used for each cross-section series pair in the graph.

g1.scatpair(panel=stacked, contract=mean) nnfit kernfit

displays a scatterplot matrix of the mean values for each period (computed across cross-sections) in a single graph frame, along with nearest neighbor and kernel regression fits for the means.

Categorical examples

group cgrp income consumption interest savings

cgrp.scatpair(d) within(sex)

displays a scatterplot pair graph (CONSUMPTION versus INCOME; and SAVINGS and INTEREST) categorized by values of sex, with observations displayed in the same graph frame using different symbols and colors to denote cross-sections, and dual scaling.

cgrp.scatpair(d) within(sex) kernfit linefit

displays the same scatterplot but with linear regression and kernel regression fits for the observations in each category for each pair of series.

cgrp.scatpair(d) across(state) within(sex) nnfit

displays scatterplots for observations in each STATE in different frames. Within each frame, observations are depicted using different symbols and colors to denote SEX, and a nearest neighbor regression is fit to observations in each category.

cgrp.scatpair(d, contract=mean) nnfit within(state)

computes mean values for the series in CGRP for each STATE, and displays paired scatterplots of the means, along with a line depicting the nearest neighbor regression fit to the means, in a single graph frame.

Cross-references

See
“Graphing Data” for a detailed discussion of graphs in EViews, and
“Templates” for a discussion of graph templates. See
Graph::graph for graph declaration and other graph types.

For a description of the available fit lines, see
“Auxiliary Graph Types”.

See
xyline for a description of XY graphs.