# Design Matrices with DOSS and DODS

The design matrix is created from the class and variable information in the FSGD file and from the type of design specified when running mri_glmfit (*i.e.*, DODS: different offset different slope; or DOSS: different offset same slope). The design matrix will consist of regressors for intercepts and regressors for slopes. Each class will have an intercept regressor. The intercept regressor is a vector with a 1 for each subject that is a member of the class and 0 otherwise. The slope regressors are handled differently depending upon whether DODS or DOSS is used. For DODS, each class will have a slope regressor for each variable. Like the intercept regressor, the slope regressor for a class will be 0 for subjects not in the class. For subjects in the class, the slope regressor will be the value of the variable. Each variable will have its own set of regressors. For DOSS, each variable will have a single regressor which will be independent of class. This regressor will just be a vector of the variable values listed in the FSGD file. For DODS, the total number of regressors will be Nc*(Nv+1), where Nc is the number of classes and Nv is the number of variables. The first Nc regressors will be the intercepts for each class. The next Nc regressors will be the slopes for each class for the first variable, etc. For DOSS, the total number of regressors will be Nc+Nv. The first Nc regressors will be the intercepts for each class. The next Nv regressors will be the slopes for each variable.

** An example FSGDF and design matrices for DODS and DOSS**

This similar FSGD file has two classes (Nc=2) and three variables (Nv=3):

------------------------- cut here ------------------ GroupDescriptorFile 1 Class Class1 CLASS Class2 Variables Age Weight IQ Input subjid1a Class1 10 100 1000 Input subjid1b Class1 15 150 1500 Input subjid2a Class2 20 200 2000 Input subjid2b Class2 25 250 2500 DefaultVariable Age ------------------------- cut here ------------------

For DODS, the number of regressors is Nc*(Nv+1)=8, and the design matrix would be:

1 0 10 0 100 0 1000 0 1 0 15 0 150 0 1500 0 0 1 0 20 0 200 0 2000 0 1 0 25 0 250 0 2500

For DOSS, the number of regressors is Nc+Nv=5, and the design matrix would be:

1 0 10 100 1000 1 0 15 150 1500 0 1 20 200 2000 0 1 25 250 2500

The design matrix is created for you by mri_glmfit, using your FSGD file and your choice of either DOSS or DODS. You will not have to create this yourself.