dRE = rowexch(nfactors,nruns)
[dRE,X] = rowexch(nfactors,nruns)
[dRE,X] = rowexch(nfactors,nruns,
[dRE,X] = rowexch(...,
dRE = rowexch(nfactors,nruns) uses
a row-exchange algorithm to generate a D-optimal
nruns runs (the
dRE) for a linear additive model with
(the columns of
dRE). The model includes a constant
[dRE,X] = rowexch(nfactors,nruns) also
returns the associated design matrix
X, whose columns
are the model terms evaluated at each treatment (row) of
[dRE,X] = rowexch(nfactors,nruns, uses
the linear regression model specified in
one of the following:
'linear'— Constant and linear terms. This is the default.
'interaction'— Constant, linear, and interaction terms
'quadratic'— Constant, linear, interaction, and squared terms
'purequadratic'— Constant, linear, and squared terms
The order of the columns of
X for a full
quadratic model with n terms is:
The constant term
The linear terms in order 1, 2, ..., n
The interaction terms in order (1, 2), (1, 3), ..., (1, n), (2, 3), ..., (n–1, n)
The squared terms in order 1, 2, ..., n
Other models use a subset of these terms, in the same order.
model can be a matrix
specifying polynomial terms of arbitrary order. In this case,
have one column for each factor and one row for each term in the model.
The entries in any row of
model are powers
for the factors in the columns. For example, if a model has factors
X3, then a row
[0 1 2] in
(X1.^0).*(X2.^1).*(X3.^2). A row of all
model specifies a constant term,
which can be omitted.
[dRE,X] = rowexch(..., specifies
additional parameter/value pairs for the design. Valid parameters
and their values are listed in the following table.
Lower and upper bounds for each factor, specified as
Indices of categorical predictors.
Handle to a function that excludes undesirable runs.
If the function is f, it must support the syntax b = f(S),
where S is a matrix of treatments with
Initial design as an
Vector of number of levels for each factor.
Maximum number of iterations. The default is
A structure that specifies whether to run in parallel, and specifies the random stream
or streams. Create the
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
Suppose you want a design to estimate the parameters in the following three-factor, seven-term interaction model:
rowexch to generate a D-optimal
design with seven runs:
nfactors = 3; nruns = 7; [dRE,X] = rowexch(nfactors,nruns,'interaction','tries',10) dRE = -1 -1 1 1 -1 1 1 -1 -1 1 1 1 -1 -1 -1 -1 1 -1 -1 1 1 X = 1 -1 -1 1 1 -1 -1 1 1 -1 1 -1 1 -1 1 1 -1 -1 -1 -1 1 1 1 1 1 1 1 1 1 -1 -1 -1 1 1 1 1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 -1 1
Columns of the design matrix
X are the model
terms evaluated at each row of the design
The terms appear in order from left to right: constant term, linear
terms (1, 2, 3), interaction terms (12, 13, 23). Use
fit the model, as described in Linear Regression, to response data measured at the design
iterative search algorithms. They operate by incrementally changing
an initial design matrix X to increase D =
at each step. In both algorithms, there is randomness built into the
selection of the initial design and into the choice of the incremental
changes. As a result, both algorithms may return locally, but not
globally, D-optimal designs. Run each algorithm
multiple times and select the best result for your final design. Both
functions have a
'tries' parameter that automates
this repetition and comparison.
At each step, the row-exchange algorithm exchanges an entire
row of X with a row from a design matrix C evaluated
at a candidate set of feasible treatments. The
automatically generates a C appropriate for a specified
model, operating in two steps by calling the
candexch functions in sequence. Provide
your own C by calling
In either case, if C is large, its static presence
in memory can affect computation.
Automatic Parallel Support
Accelerate code by automatically running computation in parallel using Parallel Computing Toolbox™.
To run in parallel, specify the
'Options' name-value argument in the call
to this function and set the
'UseParallel' field of the options
For more information about parallel computing, see Run MATLAB Functions with Automatic Parallel Support (Parallel Computing Toolbox).