Description Usage Arguments Details Value Note Author(s) References See Also Examples
Functions implementing the approximate coordinate exchange (ACE) algorithm (Overstall & Woods, 2017) for finding Bayesian optimal experimental designs for generalised linear models (GLMs).
1 2 3 4 5 6 7 8 9  aceglm(formula, start.d, family, prior, B,
criterion = c("D", "A", "E", "SIG", "NSEL", "SIGNorm", "NSELNorm"),
method = c("quadrature", "MC"), Q = 20, N1 = 20, N2 = 100, lower = 1,
upper = 1, progress = FALSE, limits = NULL)
paceglm(formula, start.d, family, prior, B,
criterion = c("D", "A", "E", "SIG", "NSEL", "SIGNorm", "NSELNorm"),
method = c("quadrature", "MC"), Q = 20, N1 = 20, N2 = 100, lower = 1,
upper = 1, limits = NULL, mc.cores = 1, n.assess = 20)

formula 
An object of class 
start.d 
For For 
family 
A description of the error distribution and link function to be used in the model. This can be a character string naming a family function, a family function or the result of a call to a family function. (See 
prior 
An argument specifying the prior distribution. For For 
B 
An optional argument for controlling the approximation to the expected utility. It should be a vector of length two. For For 
criterion 
An optional character argument specifying the utility function. There are currently seven utility functions implemented as follows:
If left unspecified, the default is 
method 
An optional character argument specifying the method of approximating the expected utility function. Current choices are 
Q 
An integer specifying the number of evaluations of the approximate expected utility that are used to fit the Gaussian process emulator. The default value is 
N1 
An integer specifying the number of iterations of Phase I of the ACE algorithm (the coordinate exchange phase).
The default value is 
N2 
An integer specifying the number of iterations of Phase II of the ACE algorithm (the point exchange phase).
The default value is 
lower 
An argument specifying the design space. This argument can either be a scalar or a matrix of the same dimension as the argument 
upper 
An argument specifying the design space. This argument can either be a scalar or a matrix of the same dimension as the argument 
progress 
A logical argument indicating whether the iteration number and other information detailing the progress of the algorithm should be printed. The default value is 
limits 
An argument specifying the grid over which to maximise the Gaussian process emulator for the expected utility function. It should be a function with three arguments: 
mc.cores 
The number of cores to use, i.e. at most how many child processes will be run simultaneously. Must be at least one (the default), and parallelisation requires at least two cores. See 
n.assess 
If 
The aceglm
function implements the ACE algorithm to find designs for the class of generalised linear models (GLMs) for certain cases of utility function meaning the user does not have to write their own utility function.
Two utility functions are implemented.
Shannon information gain (SIG)
The utility function is
U^SIG(d) = f(θy,d)  f(θ),
where f(θy,d) and f(θ) denote the posterior and prior densities of the parameters θ, respectively.
Negative squared error loss (NSEL)
The utility function is
u^NSEL(d) =  (θ  E(θ y,d))^T(θ  E(θ y,d)),
where E(θ  y,d) denotes the posterior mean of θ.
In both cases the utility function is not available in closed form due to the analytical intractability of either the posterior distribution (for SIG) or the posterior mean (for NSEL). The acebayes
package implements two approximations to both utility functions. If criterion = "SIG"
or criterion = "NSEL"
then samplingbased Monte Carlo or importance sampling approximations will be employed. This was the original approach used by Overstall & Woods (2017). If criterion = "SIGNorm"
or criterion = "NSELNorm"
then approximations based on approximate normality of the posterior (Overstall et al., 2017) will be used.
The normal approximation to the posterior can be taken further leading to the approximation by some scalar function of the Fisher information matrix, I (θ;d), which only depends on θ (Chaloner & Verdinelli, 1995). In the case of SIG, the approximate utility is given by
u^D(d) = log  I(θ;d),
and the resulting design is typically called pseudoBayesian Doptimal. For NSEL, the approximate utility is given by
u^A(d) =  tr (I(θ;d)^(1))
with the resulting design termed pseudoBayesian Aoptimal. These designs are often used under the frequentist approach to optimal experimental design and so to complete the usual set, the following utility for finding a pseudoBayesian Eoptimal design is also implemented:
U^E(d) = min(e(I(θ;d))),
where e() denotes the function that calculates the eigenvalues of its argument.
The expected utilities can be approximated using Monte Carlo methods (method = "MC"
for all criteria) or using a deterministic quadrature method (method = "quadrature"
, implemented for the D, A and E criteria). The former approach approximates the expected utility via sampling from the prior. The latter approach uses a radialspherical integration rule (Monahan and Genz, 1997) and B[1]
specifies the number, n_r, of radial abscissas and B[2]
specifies the number, n_q, of random rotations. Larger values of n_r will produce more accurate, but also more computationally expensive, approximations. See Gotwalt et al. (2009) for further details.
Note that the utility functions for SIG and NSEL are currently only implemented for logistic regression, i.e. family = binomial
, or Poisson regression, i.e. family = poisson(link="log")
, whereas the utility functions for pseudoBayesian designs are implemented for generic GLM families.
Similar to all coordinate exchange algorithms, ACE should be repeated from different initial designs. The function
paceglm
will implement this where the initial designs are given by a list via the argument start.d
. On the completion
of the repetitions of ACE, paceglm
will approximate the expected utility for all final designs and return the design (the terminal design) with the
largest approximate expected utility.
For more details on the ACE algorithm, see Overstall & Woods (2017).
The function will return an object of class "ace"
(for aceglm
) or "pace"
(for paceglm
) which is a list with the following components:
utility 
The utility function resulting from the choice of arguments. 
start.d 
The argument 
phase1.d 
The design found from Phase I of the ACE algorithm. 
phase2.d 
The design found from Phase II of the ACE algorithm. 
phase1.trace 
A vector containing the evaluations of the approximate expected utility of the current design at each stage of Phase I of the ACE algorithm. This can be used to assess convergence. 
phase2.trace 
A vector containing the evaluations of the approximate expected utility of the current design at each stage of Phase II of the ACE algorithm. This can be used to assess convergence. 
B 
The argument 
Q 
The argument 
N1 
The argument 
N2 
The argument 
glm 
If the object is a result of a direct call to 
nlm 
This will be 
criterion 
If the object is a result of a direct call to 
method 
If the object is a result of a direct call to 
prior 
If the object is a result of a direct call to 
family 
If the object is a result of a direct call to 
formula 
If the object is a result of a direct call to 
time 
Computational time (in seconds) to run the ACE algorithm. 
binary 
The argument 
d 
The terminal design ( 
eval 
If If 
final.d 
A list of the same length as the argument 
besti 
A scalar indicating which repetition of the ACE algorithm resulted in the terminal design ( 
These are wrapper functions for ace
and pace
.
Antony M. Overstall A.M.Overstall@soton.ac.uk, David C. Woods, Maria Adamou & Damianos Michaelides
Chaloner, K. & Verdinelli, I. (1995). Bayesian experimental design: a review. Statistical Science, 10, 273304.
Gotwalt, C. M., Jones, B. A. & Steinberg, D. M. (2009). Fast computation of designs robust to parameter uncertainty for nonlinear settings. Technometrics, 51, 8895.
Meyer, R. & Nachtsheim, C. (1995). The coordinate exchange algorithm for constructing exact optimal experimental designs. Technometrics, 37, 6069.
Monahan, J. and Genz, A. (1997). Sphericalradial integration rules for Bayesian computation,” Journal of the American Statistical Association, 92, 664–674.
Overstall, A.M. & Woods, D.C. (2017). Bayesian design of experiments using approximate coordinate exchange. Technometrics, 59, 458470.
Overstall, A.M., McGree, J.M. & Drovandi, C.C. (2018). An approach for finding fully Bayesian optimal designs using normalbased approximations to loss functions. Statistics and Computing, 28(2), 343358.
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90  ## This example uses aceglm to find a Bayesian Doptimal design for a
## first order logistic regression model with 6 runs 4 factors. The priors are
## those used by Overstall & Woods (2017), with each of the five
## parameters having a uniform prior. The design space for each coordinate is [1, 1].
set.seed(1)
## Set seed for reproducibility.
n<6
## Specify the sample size (number of runs).
start.d<matrix(2 * randomLHS(n = n,k = 4)  1,nrow = n,ncol = 4,
dimnames = list(as.character(1:n), c("x1", "x2", "x3", "x4")))
## Generate an initial design of appropriate dimension. The initial design is a
## Latin hypercube sample.
low<c(3, 4, 5, 6, 2.5)
upp<c(3, 10, 11, 0, 3.5)
## Lower and upper limits of the uniform prior distributions.
prior<function(B){
t(t(6*matrix(runif(n = 5 * B),ncol = 5)) + low)}
## Create a function which specifies the prior. This function will return a
## B by 5 matrix where each row gives a value generated from the prior
## distribution for the model parameters.
example1<aceglm(formula=~x1+x2+x3+x4, start.d = start.d, family = binomial,
prior = prior, method = "MC", N1 = 1, N2 = 0, B = c(1000, 1000))
## Call the aceglm function which implements the ACE algorithm requesting
## only one iteration of Phase I and zero iterations of Phase II. The Monte
## Carlo sample size for the comparison procedure (B[1]) is set to 100.
example1
## Print out a short summary.
#Generalised Linear Model
#Criterion = Bayesian Doptimality
#Formula: ~x1 + x2 + x3 + x4
#
#Family: binomial
#Link function: logit
#
#Method: MC
#
#B: 1000 1000
#
#Number of runs = 6
#
#Number of factors = 4
#
#Number of Phase I iterations = 1
#
#Number of Phase II iterations = 0
#
#Computer time = 00:00:01
example1$phase2.d
## Look at the final design.
# x1 x2 x3 x4
#1 0.4735783 0.12870470 0.75064318 1.0000000
#2 0.7546841 0.78864527 0.58689270 0.2946728
#3 0.7463834 0.33548985 0.93497463 0.9573198
#4 0.4446617 0.29735212 0.74040030 0.2182800
#5 0.8459424 0.41734194 0.07235575 0.4823212
#6 0.6731941 0.05742842 1.00000000 0.1742566
prior2 < list(support = rbind(low, upp))
## A list specifying the parameters of the uniform prior distribution
example2<aceglm(formula = ~ x1 +x2 + x3 + x4, start.d = start.d, family = binomial,
prior = prior2, N1 = 1, N2 = 0)
## Call the aceglm function with the default method of "quadrature"
example2$phase2.d
## Final design
# x1 x2 x3 x4
#1 0.4647271 0.07880018 0.94648750 1.0000000
#2 0.7102715 0.79827332 0.59848578 0.5564422
#3 0.7645090 0.39778176 0.74342036 1.0000000
#4 0.4514632 0.33687477 0.55066110 0.3994593
#5 0.7913559 0.41856994 0.01321035 0.8848135
#6 0.6337306 0.11578522 1.00000000 1.0000000
mean(example1$utility(d = example1$phase2.d, B = 20000))
#[1] 11.61105
mean(example2$utility(d = example2$phase2.d, B = 20000))
#[1] 11.19737
## Compare the two designs using the Monte Carlo approximation

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.