Usage Note 40631: How can I save the X and Z matrix from PROC MIXED or PROC GLIMMIX to a data set?
Prior to SAS 9.2 there were no options for producing the X and Z matrices from PROC MIXED, GLIMMIX, or the %GLIMMIX macro. However, you could have used PROC GLMMOD to generate the X and Z matrices.
Beginning in SAS 9.2, the OUTDESIGN option in the PROC GLIMMIX statement creates a SAS data set that contains the contents of the X and/or the Z matrix. If the data are processed by subjects as shown in the "Dimensions" table, then the Z matrix saved to the data set corresponds to a single subject. In other words, if the data are processed by subjects, then the OUTDESIGN data set contains a stacking of Zi matrices rather than a block diagonal structure. By default, the GLIMMIX procedure includes in the OUTDESIGN data set the X and Z matrix (if present) and the variables in the input data set. The order of the observations in the OUTDESIGN data set is the same as the order of the input data set. You can use the OUTDESIGN option in combination with the NOFIT option if you want to produce X and/or Z matrices without fitting the model. The following example writes the X and Z matrices to the OUTDESIGN= data set.
data heights;
input Family Gender$ Height @@;
datalines;
1 F 67 1 F 66 1 F 64 1 M 71 1 M 72 2 F 63
2 F 63 2 F 67 2 M 69 2 M 68 2 M 70 3 F 63
3 M 64 4 F 67 4 F 66 4 M 67 4 M 67 4 M 69
;
run;
/* not processed by subjects - block diagonal z matrix */
proc glimmix data=heights outdesign(z)=zmatrix;
class Family Gender;
model Height = Gender;
random Family Family*Gender;
run;
proc print data=zmatrix;
run;
/* processed by subjects - stacked z matrix */
proc glimmix data=heights outdesign(z)=zmatstack;
class Family Gender;
model Height = Gender;
random int Gender/subject=family;
run;
proc print data=zmatstack;
run;
/* not process by subjects -- both x and z matrices */
proc glimmix data=heights outdesign=xzmatrix nofit;
class Family Gender;
model Height = Gender;
random Family Family*Gender;
run;
proc print data=xzmatrix;
run;
/* process by subjects -- both x and z matrices */
proc glimmix data=heights outdesign=xzstackmat nofit;
class Family Gender;
model Height = Gender;
random int Gender/subject=family;
run;
proc print data=xzstackmat;
run;
Operating System and Release Information
SAS System | SAS/STAT | z/OS | 9.2 TS1M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS1M0 | |
Microsoft Windows XP 64-bit Edition | 9.2 TS1M0 | |
Microsoft® Windows® for x64 | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS1M0 | |
Microsoft Windows Server 2003 Standard Edition | 9.2 TS1M0 | |
Microsoft Windows XP Professional | 9.2 TS1M0 | |
Windows Vista | 9.2 TS1M0 | |
Windows Vista for x64 | 9.2 TS1M0 | |
64-bit Enabled AIX | 9.2 TS1M0 | |
64-bit Enabled HP-UX | 9.2 TS1M0 | |
64-bit Enabled Solaris | 9.2 TS1M0 | |
HP-UX IPF | 9.2 TS1M0 | |
Linux | 9.2 TS1M0 | |
Linux for x64 | 9.2 TS1M0 | |
OpenVMS on HP Integrity | 9.2 TS1M0 | |
Solaris for x64 | 9.2 TS1M0 | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.
Saving the design matrix in PROC MIXED or PROC GLIMMIX.
Type: | Usage Note |
Priority: | |
Topic: | Analytics ==> Mixed Models SAS Reference ==> Procedures ==> GLIMMIX SAS Reference ==> Procedures ==> MIXED
|
Date Modified: | 2018-06-22 13:44:39 |
Date Created: | 2010-08-18 20:48:58 |