Mx quick reference

Syntax

The syntax described for commands follows these conventions:

• alternatives are represented by /

• optional parameters or keywords are enclosed by { and }

• items to be substituted according to the specific application are enclosed by < and >

Minimum specifications

Groups must contain at minimum the following lines:

• Title

• DAta

• MAtrices

• COvariance

• OUtput or ENd

See also the section on save and get commands for Mx system files.

Data line options

Syntax:

DA {CA/CO} {NI=n NG=n NO=n}

• First group must specify number of groups (NG)

• Specifies type of group: CA forces calculation group; CO forces constraint group.

• Supplies parameters, NI number of input variables; NO number of observations.

Input data

Syntax:

ME/AV/RA/VL {FI=filename}
CM/KM/PM/AC/AI {FU} {FI=filename}
CT <r> <c> {FI=filename}

Several different commands to read raw data, contingency tables or summary statistics, either from the input script or an external file: Default for symmetric matrices CM KM PM AC AI is symmetric.

• ME Vector of means

• CM Covariance matrix

• PM or KM Correlation matrix

• AC PRELIS type asymptotic covariance; AI is for inverse

• CT Contingency table; requires number of rows and columns on same line.

• RA Rectangular matrix of raw data

• VL Variable length input for unbalanced raw data

Labels and select

Syntax:

LAbels
<label list>
SElect
<label list>/<numlist>
LAbels row/col A
<label list>

NI labels may be read for the input variables, and either labels or variable numbers may be used to select variables. After supplying covariance or mean command, labels may be provided for the rows or columns of defined matrices.

Matrices command

Syntax:

MAT
<name> <type> <r> <c>{=<name><group>/FR}
<name> <type> <r> <c>{=<name><group>/FR}
.
.
<name> <type> <r> <c>{=<name><group>/FR}

Defines matrices for use in current or subsequent groups. May be equated to matrices in earlier groups, and all modifiable elements may be freed with FR. Type, structure, shape and number of free elements are as follows:

# free

Type Structure  elements
ZE Null 0
UN Unit  0
ID Identity 0
IZ  Identity | Zero 0
ZI  Zero | Identity 0
DI  Diagonal  r
SD  Subdiagonal  r(r − 1)/2
ST  Standardized r(r − 1)/2
SY Symmetric r(r + 1)/2
LO Lower triang. r(r + 1)/2
FU Full  r × c

Number of free elements indicates how many el-

ements should be supplied with commands such

as PA MA and SP

Matrix operators and functions

The following unary and binary operators may be used:

Function  Example Priority
Invert  A~  1
Transpose  A'  1
Power elem.  A ^B  2
Multiply  A * B  3
Dot prod  A . B  3
Kronecker prod ⊗ A @ B  3
Element div.  A % B  3
Add  A + B  4
Subtract  A - B  4
Horiz stick  A | B  5
Vert stick  A _B  6

Operations with lower numbers are evaluated

first, equal priority operations are carried out from left to right. Matrix functions are defined by a keyword followed by parentheses. The expression within the parentheses will be evaluated prior to the function evaluation.

Keyword Function  Restriction
\tr() Trace r = c
\det() Determinant  r = c
\exp() Exponent (e^{A})  None
\ln()  Natural logarithm None
\sqrt() Square root  None
\d2v() Diagonal to Vector None
\v2d() Vector to Diagonal r or c = 1
\m2v() Matrix to Vector  None
\stnd() Standardize matrix r = c
\eval() Real eigenvalues  r = c
\evec() Real eigenvectors r = c
\ival() Imaginary eigenval r = c
\ivec() Imaginary eigenvec r = c

Means/Thresholds/Covariance

Means, thresholds and covariances may be formed with any combination of matrices, operators and functions. Parentheses may be used to change order of evaluation. Examples:

Means A /
Thresholds X|Y /
Covariances (I-B)~*(G*F*G'+P)*(I-B)~ /
Compute S-I*R*J /

Thresholds can be used only in groups with contingency table data. Mx will use means in covariance analysis if both a means model and observed means are supplied. Mx requires means formulation in raw data analysis. Compute is recommended keyword for calculation groups, to make reading input files easier.

Putting numbers in matrices

MA command

Syntax:

MA <matrix name> {FI=filename}
<numlist>

where <numlist> is a free format list of numbers. The list of numbers must be equal to the number of free elements of that matrix, e.g. r × c for a full matrix of order (r × c), or m for an m × m diagonal matrix.

ST and VA commands

Syntax:

ST/VA <value> <element list>/ ALL

where <element list> consists of matrix elements (e.g. A 1 2 3) and may include the TO keyword

The TO keyword operates differently for ST and VA, otherwise these keywords are synonymous.

Putting parameters in matrices

PA command

Syntax:

PA <matrix name> {FI=filename}
<numlist>

where <numlist> is a list of 1’s and 0’s

The PA command requests a different free parameter for every element with a 1. A zero fixes the corresponding matrix element.

SP command

SP <matrix name>
<numlist>

where numlist contains not necessarily distinct integers.

SPecify is a convenient method of defining constraints between parameters. If two elements are given the same value, then the same free parameter is assigned to both elements. A zero indicates that the element does not have a free parameter.

FRee and FIx commands

Syntax:

FI/FR <value> <element list>

where <element list> is a list of matrix elements DRop commands

Syntax:

                                          DRop <parameter list>

where <element list> is a list of parameter specification numbers Drop fixes all occurences of a parameter with that ‘sp’ number to zero.

EQ command

Syntax:

                                          EQ <matrix element list>

EQ passes the value and the parameter specification of the first matrix element in the list to the remaining elements in the list. Elements of matrices in the current group may be specified with 2 subscripts (e.g. A 1 2). Elements in previous groups must be specified with 3 subscripts (e.g. X 2 5 4).

BOundary command

Syntax:

                                          BO low high <parlist> / ALL

where parlist is a list of parameter names or a list of parameter SP numbers. Free parameters in the list will be bounded to lie between low and high. Negative numbers will bound non-linear constraints.

Mx system files

Mx will save the current data, model specifications and parameter estimates with the save command. Estimation may proceed from this point later in the same run or in another job by using Get. Save may be used only in multiple fit mode. Get instead of a DAta line will restore the saved dataset and allow model modifications.

Options

A wide variety of options allow use of non-default fit functions, decreasing or increasing printed output, saving of matrices and binary files. Optimization parameters may also be adjusted.

Optimization parameters

• MUltiple - special command that can be used on last group. Causes Mx to enter multiple fit mode, in which models can be altered e.g. SP 1 A to give new parameter specifications for matrix A in group 1

• NOne - prevents all output

• RS - gives observed, expected and residual (O-E) matrices

• IT=n Alters maximum numbers of iterations

• NAG=n If n > 0 then creates separate output file NAGDUMP.OUT.

• MXA=<filename> Writes values of matrix A to file. Can write expected covariances (%E) or means (%M)

• draw=<filename> If RAM-specified model, will create RAMPATH graphics file

Limitations

Any characters after column 120 in the input script are ignored. External data files may be any length within operating system limits. Workspace is normally 100,000 double precision words for MSDOS versions and 1,000,000 for mainframe versions.