| Statistics Toolbox™ | ![]() |
treatments = candexch(C,nruns)
treatments = candexch(...,param1,val1,param2,val2,...)
treatments = candexch(C,nruns) uses a row-exchange algorithm to select treatments from a candidate design matrix C to produce a D-optimal design with nruns runs. The columns of C represent model terms evaluated at candidate treatments. treatments is a vector of length nruns giving indices of the rows in C used in the D-optimal design. The function selects a starting design at random.
treatments = candexch(...,param1,val1,param2,val2,...) specifies additional parameter/value pairs for the design. Valid parameters and their values are listed in the following table.
| Parameter | Value |
|---|---|
| 'display' | Either 'on' or 'off' to control display of the iteration counter. The default is 'on'. |
| 'init' | Initial design as an nruns-by-p matrix, where p is the number of model terms. The default is a random subset of the rows of C. |
| 'maxiter' | Maximum number of iterations. The default is 10. |
| 'start' | A matrix of treatments as a nobs-by-p matrix, where p is the number of model terms, specifying a set of nobs fixed treatments to include in the design. The default matrix is empty. candexch finds nruns-nobs additional rows to add to the 'start' design. The parameter provides the same functionality as the daugment function, using a row-exchange algorithm rather than a coordinate-exchange algorithm. |
| 'tries' | Number of times to try to generate a design from a new starting point. The algorithm uses random points for each try, except possibly the first. The default is 1. |
Note The rowexch function automatically generates a candidate set using candgen, and then creates a D-optimal design from that candidate set using candexch. Call candexch separately to specify your own candidate set to the row-exchange algorithm. |
The following example uses rowexch to generate a five-run design for a two-factor pure quadratic model using a candidate set that is produced internally:
dRE1 = rowexch(2,5,'purequadratic','tries',10)
dRE1 =
-1 1
0 0
1 -1
1 0
1 1The same thing can be done using candgen and candexch in sequence:
[dC,C] = candgen(2,'purequadratic') % Candidate set
dC =
-1 -1
0 -1
1 -1
-1 0
0 0
1 0
-1 1
0 1
1 1
C =
1 -1 -1 1 1
1 0 -1 0 1
1 1 -1 1 1
1 -1 0 1 0
1 0 0 0 0
1 1 0 1 0
1 -1 1 1 1
1 0 1 0 1
1 1 1 1 1
treatments = candexch(C,5,'tries',10) % D-opt subset
treatments =
2
1
7
3
4
dRE2 = dC(treatments,:) % Display design
dRE2 =
0 -1
-1 -1
-1 1
1 -1
-1 0You can replace C in this example with a design matrix evaluated at your own candidate set. For example, suppose your experiment is constrained so that the two factors cannot have extreme settings simultaneously. The following produces a restricted candidate set:
constraint = sum(abs(dC),2) < 2; % Feasible treatments
my_dC = dC(constraint,:)
my_dC =
0 -1
-1 0
0 0
1 0
0 1Use the x2fx function to convert the candidate set to a design matrix:
my_C = x2fx(my_dC,'purequadratic')
my_C =
1 0 -1 0 1
1 -1 0 1 0
1 0 0 0 0
1 1 0 1 0
1 0 1 0 1Find the required design in the same manner:
my_treatments = candexch(my_C,5,'tries',10) % D-opt subset
my_treatments =
2
4
5
1
3
my_dRE = my_dC(my_treatments,:) % Display design
my_dRE =
-1 0
1 0
0 1
0 -1
0 0candgen, rowexch, cordexch, daugment, x2fx
![]() | boxplot | candgen | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |