| Statistics Toolbox | ![]() |
Including Categorical Factors
Another example where it is useful to call candexch directly is to generate a design that includes categorical factors. For these designs you create a candidate set containing dummy variables for the categorical factors. The dummyvar function is useful to create such a candidate set.
This example contains three categorical factors, each taking three levels. You create a candidate set F containing all 27 combinations of these factor levels. Then you create a matrix C containing dummy variables for the factors, and remove enough columns to make the resulting matrix full rank. (You remove one column for each factor except the first factor.) Finally, you use the candexch function to generate a nine-run design. The resulting design has the property that for each pair of factors, each of the 9nine possible combinations of levels appears exactly once.
F = fullfact([3 3 3]); C = dummyvar(F); C(:,[4 7]) = []; rows = candexch(C,9); D = F(rows,:) D = 3 1 3 1 3 2 3 3 1 1 2 3 2 2 1 2 1 2 3 2 2 2 3 3 1 1 1
| Controlling Candidate Points | Hidden Markov Models | ![]() |
Learn more about the latest releases of MathWorks products: |
| © 1994-2009 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |