# Design Matrix

**Design Matrix**

The Design Matrix allows additional constraints to be placed on the real parameter estimates through the definition of the beta parameters, or to specify individual covariates to be included in the model. The best way to explain the use of the Design Matrix is to illustrate its use. For simple examples, see Basics for examples with a single group where constraints are used to estimate the mean of a set of survival rates, or to remove the confounding between 2 parameters by making them the same. See Advanced for more complex examples involving models with more than 1 group, and how to code design matrices with group+time effects, and individual covariates for examples using individual covariates. The section Default discusses how the identity matrix is used as the default design matrix when no matrix has been developed. Commands provides descriptions of the various menu options in the Design Matrix Window to develop the various matrices. Columns in the design matrix can also be labeled so that you can interpret the structure of the model both when the model is retrieved or viewing the beta parameter estimates. You will be pleased later when you try to interpret a model if you take the time now to label the columns and document your thinking at the time you constructed the model.

The best way to understand the Design Matrix commands is to experiment with the program, exploring the various commands. The Design Matrix window can be closed and then initialized with the Design menu option from a parameter matrix window (PIM Window) or the Results Browser window.

When the Design menu option is selected, a pop-up menu appears with the options Full, Reduced, or Identity:

– The Full menu choice gives you a design matrix with an intercept, group effects (if more than one group), time effects, and group*time effects for each parameter. Labels are attached to the column headings of the design matrix to identify the effect. The Full menu choice only works when the PIMs specify a number of parameters equal to a group*time model for each parameter. However, this option does allow you to restructure the PIMs, e.g., as an age*time set of PIMs, and then create the full design matrix with age and time effects. The Pre-Defined Models menu choice of the Run menu from the Results Browser Window will also build various design matrices for you. There is an option under the File | Preferences dialog window (Set Preferences) to change the design matrix coding to use the first row of a time effect as the refernce row, rather than the last row.

– The Reduced option asks you to enter the number of columns to create in the design matrix, and then creates a matrix of all zeros and the specified number of columns. The number of rows in the design matrix is always equal to the number of parameters in the parameter matrices.

– The Identity option results in the number of columns in the matrix equaling the number of rows, with the diagonal filled with ones and the rest of the matrix zeros. This is an Identity matrix, and provides no constraints on the parameters.

If you change the number of parameters in the parameter matrices, you must redo the design matrix. Hence, don’t start the design matrix process until you have correctly specified the parameter matrices.

Useful options for large, complicated design matrices are to Save the current design matrix to a dBase (DBF) file, edit the design matrix with a spreadsheet program, copy the design matrix to the clipboard from the spreadsheet, and then Paste the clipboard back into the design matrix.

Text and background colors of cells in the design matrix are colored differently to help the user distinguish zero cells from cells containing ones or cells containing values other than 0 or 1. See Design Matrix Colors for more information.

Several sets of labels are available with the design matrix to help the user interpret the output. See Design Matrix Labels for more information.

Columns in the design matrix can be moved and reordered, or retrieved from another design matrix available in the Results Browser window.

See Design Matrix Scaling Covariates for why “reasonable” values should be used in the design matrix.

Twelve special functions are also allowed in the cells of the design matrix that are useful with individual covariates: the add, product, power, eq, gt, ge, lt, and le functions.