Group

Group of series. Groups are used for working with collections of series objects (series, alphas, links).

Group Declaration

group create a group object.

To declare a group, enter the keyword group, followed by a name, and optionally, a list of series or expressions:

group salesvrs

group nipa cons(-1) log(inv) g x

You may use the wildcard characters “*” and “?” to match more than one series in the workfile, and you may use the keywords “and” and “not” to specify that certain items should be excluded from the group:

group g a* and *1

makes a group G containing all series whose names begin with the letter “a” and end with “1”, while

group g a* b* not *1 *2

makes a group G containing all series whose names begin with either letter “a” or “b” that do not end with either “1” or “2”.

Additionally, a number of object procedures will automatically create a group.

Note: to convert data between groups and matrices, see
“Copying Data Between Matrices and Series/Groups”,
stom,
stomna,
mtos.

Group Views

cause pairwise Granger causality tests.

coint test for cointegration between series in a group.

cor correlation matrix between series.

correl correlogram of the first series in the group.

cov covariance matrix between series.

cross cross correlogram of the first two series.

display display table, graph, or spool in object window.

dtable dated data table.

dups duplicates display for observations in the group.

freq frequency table -way contingency table.

label label information for the group.

lrcov compute the symmetric, one-sided, or strict one-sided long-run covariance matrix for a group of series.

members display the members of the group.

pcomp principal components analysis on the members of the group.

sheet spreadsheet view of the series in the group.

stats descriptive statistics.

testbtw tests of equality for mean, median, or variance, between series in group.

uroot independent (panel) unit root test on the series in the group.

uroot2 dependent (second generation panel) unit root tests on the series in the group.

Group Procs

add add one or more series to the group.

clearcontents clear a contiguous block of observations in a group.

clearhist clear the contents of the history attribute.

clearremarks clear the contents of the remarks attribute.

copy creates a copy of the group.

ddloadtmpl loads a dated data table template for the group.

ddrowopts set the individual row options for the dated data table view of the series in a group.

ddsavetmpl saves the current dated data table settings as a new template.

ddtabopts set the table default options for the dated data table view of the series in a group.

deleteobs delete observations from a group.

displayname set display name.

distdata save distribution plot data to a matrix.

drop drop one or more series from the group.

insertobs shift the observations of the group up or downwards, inserting blank observations.

makepcomp save the scores from a principal components analysis of the series in a group.

makesystem creates a system object from the group for other estimation methods.

makewhiten whiten a series in the group.

olepush push updates to OLE linked objects in open applications.

reorder reorder the members of the group.

resample resample from rows of group.

setattr set the value of an object attribute.

setfillcolor set custom spreadsheet fill coloring for the group.

setformat set the display format in the group spreadsheet for the specified series.

setindent set the indentation in the group spreadsheet for the specified series.

setjust set the justification for cells in the spreadsheet view of the group object.

settextcolor set custom spreadsheet text coloring for the group.

setwidth set the column width in the group spreadsheet for the specified series.

sort change display order for group spreadsheet.

Group Graph Views

Graph creation types are discussed in detail in
“Graph Creation Command Summary”.

area area graph of the series in the group.

band area band graph.

bar single or multiple bar graph view of all series.

boxplot boxplot of each series in the group.

distplot distribution graph.

dot dot plot graph.

errbar error bar graph view.

hilo high-low(-open-close) chart.

line single or multiple line graph view of all series.

mixed mixed-type graph.

pie pie chart view.

qqplot quantile-quantile plots.

scat scatterplot.

scatmat matrix of all pairwise scatter plots.

scatpair scatterplot pairs graph.

seasplot seasonal line graph.

spike spike graph.

xyarea XY area graph.

xybar XY bar graph.

xyline XY line graph.

xyerrbar XY error bar graph.

xypair XY pairs graph.

Group Data Members

(i) i-th series in the group. Simply append “(i)” to the group name (without a “.”). For use as argument to functions that take a series, not as a series object.

Scalar Values

@comobs number of observations in the current sample for which each series in the group has a non-missing value (observations in the common sample).

@count number of series in the group.

@minobs number of non-missing observations in the current sample for the shortest series in the group.

@maxobs number of non-missing observations in the current sample for the the longest series in the group.

String Values

@attr("arg") string containing the value of the arg attribute, where the argument is specified as a quoted string.

@description string containing the object description (if available).

@depends string containing a list of the series in the current workfile on which this group depends.

@detailedtype string with the object type: “GROUP”.

@displayname string containing the Group’s display name. If the Group has no display name set, the name is returned.

@members string containing a space delimited list of the names of the series contained in the Group.

@name string containing the Group’s name.

@remarks string containing the Group’s remarks (if available).

@seriesname(i) string containing the name of the i-th series in the group.

@type string with the object type: “GROUP”.

@updatetime string representation of the time and date at which the Group was last updated.

Group Examples

To create a group G1, you may enter:

group g1 gdp income

To change the contents of an existing group, you can repeat the declaration, or use the add and drop commands:

group g1 x y

g1.add w z

g1.drop y

The following commands produce a cross-tabulation of the series in the group, display the covariance matrix, and test for equality of variance:

g1.freq

g1.cov

g1.testbtw(var,c)

You can index selected series in the group:

show g1(2).line

series sum=g1(1)+g1(2)

To create a scalar containing the number of series in the group, use the command:

scalar nsers=g1.@count