# Best Model Discrimination (MD) Follow-Up Experiments

### Description

Best follow-up experiments based on the MD criterion are suggested to discriminate between competing models.

### Usage

1 2 |

### Arguments

`X` |
matrix. Design matrix of the initial experiment. |

`y` |
vector. Response vector of the initial experiment. |

`nFac` |
integer. Number of factors in the initial experiment. |

`nBlk` |
integer >=1. The number of blocking factors in the initial experiment.
They are accommodated in the first columns of matrix |

`mInt` |
integer. Maximum order of the interactions in the models. |

`g` |
vector. Variance inflation factor for main effects ( |

`nMod` |
integer. Number of competing models. |

`p` |
vector. Posterior probabilities of the competing models. |

`s2` |
vector. Competing model variances. |

`nf` |
vector. Factors considered in each of the models. |

`facs` |
matrix. Matrix [ |

`nFDes` |
integer. Number of runs to consider in the follow-up experiment. |

`Xcand` |
matrix. Candidate runs to be chosen for the follow-up design. |

`mIter` |
integer. If 0, then user-entered designs |

`nStart` |
integer. Number of starting designs. |

`startDes` |
matrix. Matrix |

`top` |
integer. Highest MD follow-up designs recorded. |

`eps` |
numeric. A small number (1e-5 by default) used for computations. |

### Details

The MD criterion, proposed by Meyer, Steinberg and Box is used to discriminate
among competing models. Random starting runs chosen from `Xcand`

are used
for the Wynn search of best MD follow-up designs. `nStart`

starting points are
tried in the search limited to `mIter`

iterations. If `mIter=0`

then
`startDes`

user-provided designs are used. Posterior probabilities and
variances of the competing models are obtained from `BsProb`

.
The function calls the FORTRAN subroutine ‘md’ and captures
summary results.

### Value

A list with all input and output parameters of the FORTRAN
subroutine `MD`

. Most of the variable names kept to match FORTRAN code.

`NSTART` |
Number of starting designs. |

`NRUNS` |
Number of runs used in follow-up designs. |

`ITMAX` |
Maximum number of iterations for each Wynn search. |

`INITDES` |
Number of starting points. |

`NO` |
Numbers of runs already completed before follow-up. |

`IND` |
Indicator; 0 indicates the user supplied starting designs. |

`X` |
Matrix for initial data ( |

`Y` |
Response values from initial experiment ( |

`GAMMA` |
Variance inflation factor. |

`GAM2` |
If |

`BL` |
Number of blocks (>=1) accommodated in first columns of |

.

`COLS` |
Number of factors. |

`N` |
Number of candidate runs. |

`Xcand` |
Matrix of candidate runs. ( |

`NM` |
Number of models considered. |

`P` |
Models posterior probability. |

`SIGMA2` |
Models variances. |

`NF` |
Number of factors per model. |

`MNF` |
Maximum number of factor in models. ( |

`JFAC` |
Matrix with the factor numbers for each of the models. |

`CUT` |
Maximum interaction order considered. |

`MBEST` |
If |

`NTOP` |
Number of the top best designs. |

`TOPD` |
The D value for the best |

`TOPDES` |
Top |

`ESP` |
"Small number" provided to the ‘md’ FORTRAN subroutine. 1e-5 by default. |

`flag` |
Indicator = 1, if the ‘md’ subroutine finished properly, -1 otherwise. |

### Note

The function is a wrapper to call the FORTAN subroutine ‘md’, modification of Daniel Meyer's original program, ‘MD.f’, part of the mdopt bundle for Bayesian model discrimination of multifactor experiments.

### Author(s)

R. Daniel Meyer. Adapted for **R** by Ernesto Barrios.

### References

Meyer, R. D., Steinberg, D. M. and Box, G. E. P. (1996). "Follow-Up Designs
to Resolve Confounding in Multifactor Experiments (with discussion)".
*Technometrics*, Vol. 38, No. 4, pp. 303–332.

Box, G. E. P and R. D. Meyer (1993). "Finding the Active Factors
in Fractionated Screening Experiments".
*Journal of Quality Technology.* Vol. 25. No. 2. pp. 94–105.

### See Also

`print.MD`

, `BsProb`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | ```
### Injection Molding Experiment. Meyer et al. 1996, example 2.
library(BsMD)
data(BM93.e3.data,package="BsMD")
X <- as.matrix(BM93.e3.data[1:16,c(1,2,4,6,9)])
y <- BM93.e3.data[1:16,10]
p <- c(0.2356,0.2356,0.2356,0.2356,0.0566)
s2 <- c(0.5815,0.5815,0.5815,0.5815,0.4412)
nf <- c(3,3,3,3,4)
facs <- matrix(c(2,1,1,1,1,3,3,2,2,2,4,4,3,4,3,0,0,0,0,4),nrow=5,
dimnames=list(1:5,c("f1","f2","f3","f4")))
nFDes <- 4
Xcand <- matrix(c(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,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),
nrow=16,dimnames=list(1:16,c("blk","f1","f2","f3","f4"))
)
injectionMolding.MD <- MD(X = X, y = y, nFac = 4, nBlk = 1, mInt = 3,
g = 2, nMod = 5, p = p, s2 = s2, nf = nf, facs = facs,
nFDes = 4, Xcand = Xcand, mIter = 20, nStart = 25, top = 10)
summary(injectionMolding.MD)
### Reactor Experiment. Meyer et al. 1996, example 3.
par(mfrow=c(1,2),pty="s")
data(Reactor.data,package="BsMD")
# Posterior probabilities based on first 8 runs
X <- as.matrix(cbind(blk = rep(-1,8), Reactor.data[c(25,2,19,12,13,22,7,32), 1:5]))
y <- Reactor.data[c(25,2,19,12,13,22,7,32), 6]
reactor8.BsProb <- BsProb(X = X, y = y, blk = 1, mFac = 5, mInt = 3,
p =0.25, g =0.40, ng = 1, nMod = 32)
plot(reactor8.BsProb,prt=TRUE,,main="(8 runs)")
# MD optimal 4-run design
p <- reactor8.BsProb$ptop
s2 <- reactor8.BsProb$sigtop
nf <- reactor8.BsProb$nftop
facs <- reactor8.BsProb$jtop
nFDes <- 4
Xcand <- as.matrix(cbind(blk = rep(+1,32), Reactor.data[,1:5]))
reactor.MD <- MD(X = X, y = y, nFac = 5, nBlk = 1, mInt = 3, g =0.40, nMod = 32,
p = p,s2 = s2, nf = nf, facs = facs, nFDes = 4, Xcand = Xcand,
mIter = 20, nStart = 25, top = 5)
summary(reactor.MD)
# Posterior probabilities based on all 12 runs
X <- rbind(X, Xcand[c(4,10,11,26), ])
y <- c(y, Reactor.data[c(4,10,11,26),6])
reactor12.BsProb <- BsProb(X = X, y = y, blk = 1, mFac = 5, mInt = 3,
p = 0.25, g =1.20,ng = 1, nMod = 5)
plot(reactor12.BsProb,prt=TRUE,main="(12 runs)")
``` |