3 Building a Path Coefficients Model Mx Script

- Title
- Group type
- Read and select any observed data, supply labels
- Declare matrices to express the model
- Specify parameters, (starting) values, equality constraints
- Define matrix formulae for the model
- Request fit functions, output and optimization options
- End

`#NGroups 3`

statement.
*Title*Calculate genetic and environmental variance components

A new title must be given at the start of each group.*Set the Group Type*Calculation NGroups=3

where`NGroups`

is the number of groups. This parameter is specified for the first group only. Calculation groups allow the specification of matrix operations in an algebra section which can greatly simplify the structure of the script. Here, we use the calculation group to specify the free and fixed parameters in the model, , and , and calculate their squared quantities, to be used in the expectations of the variances and the MZ and DZ covariances of the model (see Section ).*Matrices Declaration*Begin Matrices; X Lower 1 1 Free Y Lower 1 1 Fixed Z Lower 1 1 Free W Lower 1 1 Free H Full 1 1 Q Full 1 1 End Matrices;

The matrices declaration section begins with a`Begin Matrices;`

line and ends with a`End Matrices;`

line. Up to 26 matrices can be declared, each starting on a new line. Matrix names are restricted to one letter, from A to Z. The name is followed by the matrix type (see Mx manual for details on available matrix types), the number of rows and the number of colums. All matrix elements are fixed by default. If the keyword`Free`

appears, each modifiable element has a free parameter specified to be estimated. In this example, four 1 1 matrices have been declared. Matrices`X`

,`Z`

and`W`

represent free parameters*a*,*e*and*d*, respectively. The parameter*c*in matrix`Y`

is fixed to zero (the word`Fixed`

appears only for clarification). Two additional matrices,`H`

and`Q`

, are declared for fixed scalars to be used in the model specification.*Labels, Numbers and Parameters*Label Row X add_gen Label Row Y comm_env Label Row Z spec_env Label Row W dom_gen Matrix H .5 Matrix Q .25 Start .6 All

Labels can be given for the row or column (or both) of any matrix. Values can be assigned to matrix elements using the`Matrix`

command. If the matrix element is modifiable, the assigned value will be the starting value. The`Start`

command here is used to assign the same starting value to`All`

the free parameters in the model. In genetic problems, we must assign starting values to parameters. In the present case, the only parameters to be estimated are*a, d*and*e*. In choosing starting values for twin data, a useful rule of thumb is to assume that the total variance is divided equally between the parameters that are to be estimated. In this case the predicted total variance is which is close to the observed total variance in these data. For other data, other starting values may be required. Good starting values can save a significant amount of computer time, whereas bad starting values may cause any optimizer to fail to find a global minimum, or to hit a maximum number of iterations before converging.*Algebra Section*Begin Algebra; A= X*X'; C= Y*Y'; E= Z*Z'; D= W*W'; End Algebra;

The algebra section begins with a`Begin Algebra;`

statement and ends with a`End Algebra;`

statement. Each algebra operation starts on a new line and ends with a semi-colon (it may run over several lines so a ; is essential to mark the end of a formula). The matrix on the left side of the`=`

sign is newly defined as the result of the matrix operation on the right side of the`=`

sign. Matrices on the right have to be declared in the matrices declaration section or defined in a previous algebra statement. In this example the quantities , , and are calculated in matrices`A`

,`C`

,`E`

and`D`

, respectively.*End*

Every group ends with an`End`

statement.

*Data Section*Data NInput_vars=2 NObservations=534 Labels bmi_t1 bmi_t2 CMatrix Symmetric File=ozbmimzf.cov

where:`NInputvars`

is number of input variables, i.e., , if there are variables assessed for each member of a twin pair`NObservations`

is number of observations or sample size, i.e., number of pairs used to compute the data matrix in this group.

`Labels`

). This is*very*useful for clarification of the Mx output. Mx will read a covariance matrix (`CMatrix`

), a correlation matrix (`KMatrix`

), or a matrix of polychoric and polyserial correlations (`PMatrix`

). The matrix may be read as a lower triangle in free format (the default, the keyword`Symmetric`

is optional), or as a full matrix if the keyword`Full`

is specified. It will also read means (`Means`

) when these are needed. Summary statistics can be read from within the Mx script, for example,CMatrix Symmetric 0.7247 0.5891 0.7915

Alternatively, the data matrices can be read from separate files, e.g.,CMatrix Symmetric File=ozbmimzf.cov

The lines referring to the actual data,`Data`

,`Labels`

and`CMatrix`

can be saved in a`dat`

file (e.g.`ozbmimzf.dat`

which can then be included in the Mx script with the following statement:#include ozbmimzf.dat

*Matrices declaration*Matrices= Group 1

The`= Group 1`

command includes all the declared and defined matrices from the group 1 into the current group.*Model specification*Covariances A+C+D+E | A+C+D_ A+C+D | A+C+D+E;

The expected covariance matrix is specified using a matrix formulation with the expected variances for twin 1 and twin 2 on the diagonal and the expected covariance between twins, in this case for MZ's, as the off-diagonal element. The expectation for the variance, , is translated into`A+C+D+E`

; that for the MZ covariance, , into`A+C+D`

. The resulting four 1 1 matrices are concatenated using the horizontal bar`|`

and the vertical bar`_`

operators to form the 2 2 expected covariance matrix, corresponding to the 2 2 observed covariance matrix. Note that the covariance statement needs to end with a semicolon.*Options*Option RSiduals

Various options for statistical output and optimization can be specified. Usually, the choice of estimation procedure will be either maximum likelihood if covariance matrices are being analyzed, or weighted least squares if matrices of polychoric, polyserial, or product-moment correlations are being analyzed. The`RSiduals`

option is very useful as it results in the printing of the observed, expected and residual matrices in the output.

`@`

, is used to
premultiply the matrix `A`

by the scalar .5 and the matrix
`D`

by the scalar .25. The specification extends easily to the
multivariate case (see Section ?).
After successfully running the Mx input script, by default, Mx prints the

- User's input script
- Parameter Specifications
- Parameter Estimates
- Measures of overall goodness-of-fit.

`NDecimals=`

- set number of decimals in printed output (, default: =4) -- useful for simulation work.`Iterations=`

- set maximum number of iterations (default: 1000).