Documentation |
Candidate set generation
dC = candgen(nfactors,'model')
[dC,C] = candgen(nfactors,'model')
[...] = candgen(nfactors,'model','Name',value)
dC = candgen(nfactors,'model') generates a candidate set dC of treatments appropriate for estimating the parameters in the model with nfactors factors. dC has nfactors columns and one row for each candidate treatment. model is one of the following strings, specified inside single quotes:
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
Alternatively, model can be a matrix specifying polynomial terms of arbitrary order. In this case, model should 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 X1, X2, and X3, then a row [0 1 2] in model specifies the term (X1.^0).*(X2.^1).*(X3.^2). A row of all zeros in model specifies a constant term, which can be omitted.
[dC,C] = candgen(nfactors,'model') also returns the design matrix C evaluated at the treatments in dC. The order of the columns of C 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.
Pass C to candexch to generate a D-optimal design using a coordinate-exchange algorithm.
[...] = candgen(nfactors,'model','Name',value) specifies one or more optional name/value pairs for the design. Valid parameters and their values are listed in the following table. Specify Name inside single quotes.
Name | Value |
---|---|
bounds | Lower and upper bounds for each factor, specified as a 2-by-nfactors matrix. Alternatively, this value can be a cell array containing nfactors elements, each element specifying the vector of allowable values for the corresponding factor. |
categorical | Indices of categorical predictors. |
levels | Vector of number of levels for each factor. |
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 1
The same thing can be done using candgen and candexch in sequence:
[dC,C] = candgen(2,'purequadratic') % Candidate set, C 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) % Find D-opt subset treatments = 2 1 7 3 4 dRE2 = dC(treatments,:) % Display design dRE2 = 0 -1 -1 -1 -1 1 1 -1 -1 0