Main Content


D-optimal design from candidate set using row exchanges


rlist = candexch(C,nrows)
rlist = candexch(C,nrows,Name,Value)


rlist = candexch(C,nrows) uses a row-exchange algorithm to select a D-optimal design from the candidate set C.

rlist = candexch(C,nrows,Name,Value) generates a D-optimal design with additional options specified by one or more Name,Value pair arguments.

Input Arguments


N-by-P matrix containing the values of P model terms at each of N points.


The desired number of rows in the design.

Name-Value Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.


When 'on', displays iteration number. Disable the display by setting to 'off'.

Default: 'on', except when the UseParallel option is true


nrows-by-P matrix giving an initial design.

Default: A random subset of the rows of C


Maximum number of iterations, a positive integer.

Default: 10


A structure that specifies whether to run in parallel, and specifies the random stream or streams. This option requires Parallel Computing Toolbox™.

Create the options structure with statset. Option fields:

  • UseParallel — Set to true to compute in parallel. Default is false.

  • UseSubstreams — Set to true to compute in parallel in a reproducible fashion. Default is false. To compute reproducibly, set Streams to a type allowing substreams: 'mlfg6331_64' or 'mrg32k3a'.

  • Streams — A RandStream object or cell array of such objects. If you do not specify Streams, candexch uses the default stream or streams. If you choose to specify Streams, use a single object except in the case

    • UseParallel is true

    • UseSubstreams is false

    In that case, use a cell array the same size as the Parallel pool.

Default: []


An nobs-by-p matrix of factor settings, specifying a set of nobs fixed design points to include in the design. candexch finds nrows 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.

Default: []


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.

Default: 1

Output Arguments


Vector of length nrows listing the selected rows.


This example shows how to generate a D-optimal design when there is a restriction on the candidate set, so the rowexch function isn't appropriate.

F = (fullfact([5 5 5])-1)/4; % factor settings in unit cube
T = sum(F,2)<=1.51;         % find rows matching a restriction
F = F(T,:);                 % take only those rows
C = [ones(size(F,1),1) F F.^2]; 
                            % compute model terms including
                            % a constant and all squared terms
R = candexch(C,12);         % find a D-optimal 12-point subset
X = F(R,:);                 % get factor settings


candexch selects a starting design X at random, and uses a row-exchange algorithm to iteratively replace rows of X by rows of C in an attempt to improve the determinant of X'*X.


The rowexch function also generates D-optimal designs using a row-exchange algorithm, but it automatically generates a candidate set that is appropriate for a specified model. The daugment function augments a set of fixed design points using a coordinate-exchange algorithm; the 'start' parameter provides the same functionality using the row exchange algorithm.

Extended Capabilities

Introduced before R2006a