{"id":198,"date":"2017-04-18T02:41:36","date_gmt":"2017-04-18T02:41:36","guid":{"rendered":"http:\/\/sites.warnercnr.colostate.edu\/gwhite\/?page_id=198"},"modified":"2017-05-06T04:19:51","modified_gmt":"2017-05-06T04:19:51","slug":"design-matrix","status":"publish","type":"page","link":"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/design-matrix\/","title":{"rendered":"Design Matrix"},"content":{"rendered":"<p><span style=\"color: #0000ff;font-family: Arial, helvetica, sans-serif;font-size: small\"><a href=\"http:\/\/warnercnr.colostate.edu\/~gwhite\/mark\/markhelp\/index.html\">Contents<\/a> &#8211; <a href=\"http:\/\/warnercnr.colostate.edu\/~gwhite\/mark\/markhelp\/idx.htm\">Index<\/a><\/span><\/p>\n<hr \/>\n<p><span style=\"color: #0000ff;font-family: Arial, helvetica, sans-serif;font-size: medium\"><b>Design Matrix<\/b><\/span><\/p>\n<p><span style=\"color: #0000ff;font-family: Arial, helvetica, sans-serif;font-size: small\">The Design Matrix allows additional constraints to be placed on the <a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/real-parameters\/\">real parameter<\/a> estimates through the definition of the <a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/beta-parameters\/\">beta parameters<\/a>, or to specify individual covariates to be included in the model.\u00a0 The best way to explain the use of the Design Matrix is to illustrate its use.\u00a0 For simple examples, see <a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/design-matrix-basics\/\">Basics<\/a> 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.\u00a0 See <a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/design-matrix-advanced-applications\/\">Advanced<\/a> for more complex examples involving models with more than 1 group, and how to code design matrices with group+time effects, and <a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/individual-covariates-basic\/\">individual covariates<\/a> for examples using individual covariates.\u00a0 The section <a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/identity-design-matrix\/\">Default<\/a> discusses how the identity matrix is used as the default design matrix when no matrix has been developed.\u00a0\u00a0 <a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/design-matrix-commands\/\">Commands<\/a> provides descriptions of the various menu options in the Design Matrix Window to develop the various matrices.\u00a0 Columns in the design matrix can also be <a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/design-matrix-labels\/\">labeled<\/a> so that you can interpret the structure of the model both when the model is retrieved or viewing the beta parameter estimates.\u00a0 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.<\/span><\/p>\n<p><span style=\"color: #0000ff;font-family: Arial, helvetica, sans-serif;font-size: small\">The best way to understand the Design Matrix commands is to experiment with the program, exploring the various commands.\u00a0 The Design Matrix window can be closed and then initialized with the Design menu option from a parameter matrix window (<a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/parameter-index-matrices-pim\/\">PIM Window<\/a>) or the <a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/results-browser-window\/\">Results Browser<\/a> window.\u00a0\u00a0<\/span><\/p>\n<p><span style=\"color: #0000ff;font-family: Arial, helvetica, sans-serif;font-size: small\">When the Design menu option is selected, a pop-up menu appears with the options Full, Reduced, or Identity:<\/span><\/p>\n<p><span style=\"color: #0000ff;font-family: Arial, helvetica, sans-serif;font-size: small\">&#8211; 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.\u00a0 Labels are attached to the column headings of the design matrix to identify the effect.\u00a0 The Full menu choice only works when the PIMs specify a number of parameters equal to a group*time model for each parameter.\u00a0 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.\u00a0 The <a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/pre-defined-models\/\">Pre-Defined Models<\/a> menu choice of the <a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/run-window\/\">Run<\/a> menu from the <a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/results-browser-window\/\">Results Browser<\/a> Window will also build various design matrices for you.\u00a0 There is an option under the File | Preferences dialog window (<\/span><span style=\"font-family: Arial, helvetica, sans-serif;font-size: small\"><a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/set-preferences\/\">Set Preferences<\/a><\/span><span style=\"color: #0000ff;font-family: Arial, helvetica, sans-serif;font-size: small\">) to change the design matrix coding to use the first row of a time effect as the refernce row, rather than the last row.\u00a0<\/span><\/p>\n<p><span style=\"color: #0000ff;font-family: Arial, helvetica, sans-serif;font-size: small\">&#8211; 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.\u00a0 The number of rows in the design matrix is always equal to the number of parameters in the parameter matrices.\u00a0\u00a0<\/span><\/p>\n<p><span style=\"color: #0000ff;font-family: Arial, helvetica, sans-serif;font-size: small\">&#8211; 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.\u00a0 This is an <a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/identity-design-matrix\/\">Identity<\/a> matrix, and provides no constraints on the parameters.\u00a0\u00a0<\/span><\/p>\n<p><span style=\"color: #0000ff;font-family: Arial, helvetica, sans-serif;font-size: small\">If you change the number of parameters in the parameter matrices, you must redo the design matrix.\u00a0 Hence, don&#8217;t start the design matrix process until you have correctly specified the parameter matrices.<\/span><\/p>\n<p><span style=\"color: #0000ff;font-family: Arial, helvetica, sans-serif;font-size: small\">Useful options for large, complicated design matrices are to <a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/save-design-matrix\/\">Save<\/a> 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 <a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/paste-clipboard-design-matrix\/\">Paste<\/a> the clipboard back into the design matrix.<\/span><\/p>\n<p><span style=\"color: #0000ff;font-family: Arial, helvetica, sans-serif;font-size: small\">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.\u00a0 See <a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/design-matrix-colors\/\">Design Matrix Colors<\/a> for more information.<\/span><\/p>\n<p><span style=\"color: #0000ff;font-family: Arial, helvetica, sans-serif;font-size: small\">Several sets of labels are available with the design matrix to help the user interpret the output.\u00a0 See<a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/design-matrix-labels\/\"> Design Matrix Labels<\/a> for more information.\u00a0<\/span><\/p>\n<p><span style=\"color: #0000ff;font-family: Arial, helvetica, sans-serif;font-size: small\">Columns in the design matrix can be moved and <a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/design-matrix-reorder-columns\/\">reordered<\/a>, or <a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/?page_id=398&amp;preview=true\">retrieved<\/a> from another design matrix available in the <a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/results-browser-window\/\">Results Browser<\/a> window.<\/span><\/p>\n<p><span style=\"color: #0000ff;font-family: Arial, helvetica, sans-serif;font-size: small\">See <a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/design-matrix-scaling-covariates\/\">Design Matrix Scaling Covariates<\/a> for why &#8220;reasonable&#8221; values should be used in the design matrix.<\/span><\/p>\n<p><span style=\"color: #0000ff;font-family: Arial, helvetica, sans-serif;font-size: small\">Twelve special functions are also allowed in the cells of the design matrix that are useful with <a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/individual-covariates-basic\/\">individual covariates<\/a>: the add, product, power, eq, gt, ge, lt, and le <a href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/design-matrix-functions\/\">functions<\/a>.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Contents &#8211; Index 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.\u00a0 The best way &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"more-link\" href=\"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/design-matrix\/\"> <span class=\"screen-reader-text\">Design Matrix<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":117,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-198","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/wp-json\/wp\/v2\/pages\/198","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/wp-json\/wp\/v2\/users\/117"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/wp-json\/wp\/v2\/comments?post=198"}],"version-history":[{"count":6,"href":"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/wp-json\/wp\/v2\/pages\/198\/revisions"}],"predecessor-version":[{"id":404,"href":"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/wp-json\/wp\/v2\/pages\/198\/revisions\/404"}],"wp:attachment":[{"href":"https:\/\/sites.warnercnr.colostate.edu\/gwhite\/wp-json\/wp\/v2\/media?parent=198"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}