| Statistics Toolbox | Search  Help Desk |
| dummyvar | Examples See Also |
Matrix of 0-1 "dummy" variables.
Syntax
D = dummyvar(group)
Description
D = dummyvar(group) generates a matrix, D, of 0-1 columns. D has one column for each unique value in each column of the matrix group. Each column of group contains positive integers that indicate the group membership of an individual row.
Example
Suppose we are studying the effects of two machines and three operators on a process. The first column ofgroup would have the values one or two depending on which machine was used. The second column of group would have the values one, two, or three depending on which operator ran the machine.
group = [1 1;1 2;1 3;2 1;2 2;2 3];
D = dummyvar(group)
D =
1 0 1 0 0
1 0 0 1 0
1 0 0 0 1
0 1 1 0 0
0 1 0 1 0
0 1 0 0 1
See Also
pinv,regress