Statistics Toolbox | ![]() ![]() |
Matrix of 0-1 "dummy" variables
Syntax
Description
generates a matrix, D = dummyvar(group)
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 of group
would have the values 1
or 2
depending on which machine was used. The second column of group
would have the values 1
, 2
, or 3
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
![]() | disttool | ecdf | ![]() |