Sym

Symmetric matrix (symmetric two-dimensional array).

Sym Declaration

sym declare sym object.

Declare by providing a name after the sym keyword, with the optionally specified dimension in parentheses:

sym(10) symmatrix

You may optionally assign a scalar, a square matrix or another sym in the declaration. If the square matrix is not symmetric, the sym will contain the lower triangle. The sym will be sized and initialized accordingly.

Sym Views

cor correlation matrix by columns.

cov covariance matrix by columns.

eigen eigenvalues calculation for a symmetric matrix.

label label information for the symmetric matrix.

sheet spreadsheet view of the symmetric matrix.

stats descriptive statistics by column.

Sym Procs

clearcollabels clear the column labels in a svector object.

clearhist clear the contents of the history attribute.

clearremarks clear the contents of the remarks attribute.

clearrowlabels clear the row labels in a vector object.

copy creates a copy of the sym.

displayname set display name.

export save sym matrix as Excel 2007 XLSX, CSV, tab-delimited ASCII text, RTF, HTML, Enhanced Metafile, PDF, TEX, or MD file on disk.

fill fill the elements of the matrix.

import imports data from a foreign file into the sym object.

olepush push updates to OLE linked objects in open applications.

read (deprecated) import data from disk.

resize resize the sym object

setattr set the value of an object attribute.

setcollabels set the column labels in a sym object.

setformat set the display format for the sym spreadsheet.

setindent set the indentation for the sym spreadsheet.

setjust set the horizontal justification for all cells in the spreadsheet view of the sym object.

setrowlabels set the row labels in a sym object.

setwidth set the column width in the sym spreadsheet.

showlabels displays the custom row and column labels of a sym spreadsheet.

write export data to disk.

Sym Graph Views

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

area area graph of the columns of the matrix.

band area band graph.

bar bar graph of each column against the row index.

boxplot boxplot graph.

distplot distribution graph.

dot dot plot graph.

errbar error bar graph view.

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

line line graph of each column against the row index.

mixed mixed-type graph.

pie pie chart view.

qqplot quantile-quantile graph.

scat scatter diagrams of the columns of the sym.

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.

xyerrbar XY error bar graph.

xyline XY line graph.

xypair XY pairs graph.

Sym Data Members

String values

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

@collabels string containing the column labels of the sym.

@description string containing the Sym object’s description (if available).

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

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

@name string containing the Sym object’s name.

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

@rowlabels string containing the row labels of the sym.

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

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

Scalar values

(i,j) (i,j)-th element of the sym. Simply append “(i,j)” to the sym name (without a “.”).

@cols number of columns in the sym.

@rows number of rows in the sym.

Matrix values

@col(arg) Returns the columns defined by arg. arg may be an integer, vector of integers, string, or svector of strings. Integers correspond to column numbers so that, for example, arg = 2 specifies the second column. Strings correspond to column labels so that arg = "2" specifies the first column labeled “2”.

@diag vector containing the diagonal elements of the sym.

@drop(arg) Returns the sym with the rows and columns defined by arg removed. arg may be an integer, vector of integers, string, or svector of strings. Integers correspond to row and column numbers so that, for example, arg = 2 specifies the second row and column. Strings correspond to row and column labels so that arg = "2" specifies the first row and column labeled “2”.

@dropboth(arg1, arg2) Returns the matrix with the rows defined by arg1 and columns defined by arg2 removed. The args may be integers, vectors of integers, strings, or svectors of strings. Integers correspond to row or column numbers so that, for example, arg1 = 2 specifies the second row. Strings correspond to row or column labels so that arg2 = "2" specifies the first column labeled “2”.

@dropcol(arg) Returns the matrix with the columns defined by arg removed. arg may be an integer, vector of integers, string, or svector of strings. Integers correspond to column numbers so that, for example, arg = 2 specifies the second column. Strings correspond to column labels so that arg = "2" specifies the first column labeled “2”.

@droprow(arg) Returns the matrix with rows defined by arg removed. arg may be an integer, vector of integers, string, or svector of strings. Integers correspond to row numbers so that, for example, arg = 2 specifies the second row. Strings correspond to row labels so that arg = "2" specifies the first row labeled “2”.

@row(arg) Returns the rows defined by arg. arg may be an integer, vector of integers, string, or svector of strings. Integers correspond to row numbers so that, for example, arg = 2 specifies the second row. Strings correspond to row labels so that arg = "2" specifies the first row labeled “2”.

@sub(arg) Returns the sym with rows and columns defined by arg. arg may be an integer, vector of integers, string, or svector of strings. Integers correspond to row and column numbers so that, for example, arg = 2 specifies the second row and column. Strings correspond to row and column labels so that arg = "2" specifies the first row and column labeled “2”.

@sub(arg1, arg2) Returns the matrix with rows defined by arg1 and columns defined by arg2. The args may be integers, vectors of integers, strings, or svectors of strings. Integers correspond to row or column numbers so that, for example, arg1 = 2 specifies the second row. Strings correspond to row or column labels so that arg2 = "2" specifies the first column labeled “2”.

@t Returns transpose (copy) of the sym.

Sym Examples

The declaration:

sym results(10)

results=3

creates the matrix RESULTS and initializes each value to be 3. The following assignment statements also create and initialize sym objects:

sym copymat=results

sym covmat1=eq1.@coefcov

sym(3,3) count

count.fill 1,2,3,4,5,6,7,8,9,10

Graphs, covariances, and statistics may be generated for the columns of the matrix:

copymat.line

copymat.cov

copymat.stats

You can use explicit indices to refer to matrix elements:

scalar diagsum=cov1(1,1)+cov1(2,2)+cov(3,3)