# Running a Matrix Check

Simulation Master Tutorials > Running a Matrix Check

When using rank order correlation of input variables, a correlation matrix must be used to define correlation among random variables.  A requirement is that the matrix be either positive semi-definite or positive definite.

Simulation Master has a matrix check tool to verify the definiteness of a correlation matrix.  It also checks the matrix format such as diagonals being 1.  In this tutorial we will run the tool to see how it operates.

## Opening the Matrix Check Tool

To open the matrix check tool, click the Matrix Check button on the Simulation Master ribbon.

The matrix check form will appear.

## Running a Matrix Check

First we'll run a check on a good matrix.  Click the minimize button next to the box in the Select Correlation Matrix pane.  Then select the matrix as shown below.

Click the Run Check button to start the check.  In addition to checking definiteness, the tool checks the formatting.  If there is a formatting error, you will get a pop up error message.  Format checks are:

• The first row and first column cells contain valid cell addresses.
• All diagonals must be 1.
• All cells below the diagonal must have numeric values ≥ -1 and ≤ 1. Cells above the
diagonal can be blank.

The results will appear in the form.

## Example of a Matrix That is Not Correct

Now lets run a check on a matrix that is neither positive definite or positive semi-definite.  Consider the matrix below.

If we run a matrix check, we get the following result.

In the conflict pair box we see two possibilities for the problem.

• The correlation between cells A3 and A1.
• The correlation between cells A3 and A2.

One or both of these correlations is causing the matrix to not be PD or PSD.  Looking at the correlations we see that A1 and A2 are strongly positively correlated.  Likewise A2 and A3 are also strongly positively correlated.  A1 and A3 cannot have a strong negative correlation.

In other words, is A1 is high, A2 and A3 are likely to be high.  Therefore A3 cannot be likely to be low when A1 is high.

The method used to test definiteness is to find an n x n matrix’s n upper left determinants.  If all determinants are > 0, then the matrix is positive definite. If all determinants are ≥ 0, then the matrix is positive semi-definite.

The procedure for the 3 x 3 matrix is shown below with each colored rectangle showing an upper left matrix for which each determinant is calculated. For each iteration, the tool adds a new variable to the check. Once a problem is found (determinant < 0), the tool will stop checking and show the variable pairs in the last row checked.

### Pasting the Results to a Worksheet

You can paste the results to a worksheet to refer to while correcting any problems.  To paste the results, click the Paste button.  Then select the upper left cell where you want to paste.

After clicking OK and closing the check matrix tool, the possible conflict pairs are pasted to the worksheet.