Declares one or more symmetric matrix data structures.



ROWS = scalar, vector or pointer or text Number of rows, or labels for rows (and columns); default *
VALUES = numbers Values for all the symmetric matrices; default *
MODIFY = string token Whether to modify (instead of redefining) existing structures (yes, no); default no
IPRINT = string tokens Information to be used by default to identify the symmetric matrices in output (identifier, extra); if this is not set, they will be identified in the standard way for each type of output



IDENTIFIER = identifiers Identifiers of the symmetric matrices
VALUES = identifiers Values for each symmetric matrix
DECIMALS = scalars Number of decimal places for printing
EXTRA = texts Extra text associated with each identifier
MINIMUM = scalars Minimum value for the contents of each structure
MAXIMUM = scalars Maximum value for the contents of each structure
DREPRESENTATION = scalars or texts Default format to use when the contents represent dates and times



A symmetric square matrix is symmetric about its leading diagonal: that is, the value in column i of row j is the same as that in column j of row i. For example:

1 2 3

2 1 4

3 4 1

Symmetric matrices often occur in statistics. Suppose, for example, that we have n random variables X1Xn. Then the covariance of Xi with Xj is the same as the covariance of Xj with Xi. The covariance matrix of the random variables is therefore symmetric: the off-diagonal elements of the matrix are the covariances (and the diagonal elements are the variances).

Because of this symmetry, Genstat stores only the diagonal elements and those below it; this is called the lower triangle. So you must specify only these values, whether in the declaration by SSPM or in a READ statement. (As always, you give them in row order: so if there are n rows, then for the first you supply one value, for the second two, and so on.) Likewise, Genstat prints only the lower triangle in output, for example with PRINT.

The ROWS option defines both the number of rows and the number of columns. The simplest way of doing this is to use a scalar to define the number of rows and columns explicitly. Alternatively, you can set ROWS to a variate, text or pointer, whose length then defines the number of rows and whose values will then be used as labels, for example when the symmetric matrix is printed. Finally, if you specify a factor, the number of levels defines the number of rows and the labels if available, or otherwise the levels, are used for labelling.

Values can be assigned to the symmetric matrices by either the VALUES option or the VALUES parameter. The option defines a common value for all the matrices in the declaration, while the parameter allows them each to be given a different value. If both the option and the parameter are specified, the parameter takes precedence.

If the MODIFY option is set to yes any existing attributes and values of the symmetric matrices are retained (if still appropriate); otherwise these are lost.

The DECIMALS parameter lets you define a number of decimal places to be used by default when each symmetric matrix is printed. You can associate a text of extra annotation with each symmetric matrix using the EXTRA parameter. The MINIMUM and MAXIMUM parameters allow you to define lower and upper limits on the values in each symmetric matrix. Genstat then prints warnings if any values outside that range are allocated to the matrix. The DREPRESENTATION parameter allows a scalar or a single-valued text to be specified for each symmetric matrix to indicate that the matrix stores dates and times, and to define a format to be used for these, by default, when they are printed; details are given in the description of the PRINT directive.

The IPRINT option can be set to specify how the symmetric matrices will be identified in output. If IPRINT is not set, they will be identified in whatever way is usual for the section of output concerned. For example, the PRINT directive generally uses their identifiers (although this can be changed using the IPRINT option of PRINT itself).




See also


Commands for: Data structures.


" Example SYMM-1: declaring a symmetric matrix"
VARIATE Weight,Height,Reach 
POINTER [VALUES=Weight,Height,Reach] Vars 
SYMMETRICMATRIX [ROWS=Vars; VALUES=1.0,0.68,1.0,0.43,0.72,1.0] Correl
PRINT Correl 
Updated on January 17, 2018

Was this article helpful?