utilities {acebayes} | R Documentation |
Approximate expected utility function for generalised linear models and non-linear regression models
Description
Generates an approximate utility function for generalised linear models and non-linear regression models.
Usage
utilityglm(formula, family, prior,
criterion = c("D", "A", "E", "SIG", "NSEL", "SIG-Norm", "NSEL-Norm"),
method = c("quadrature", "MC"), nrq)
utilitynlm(formula, prior, desvars, criterion = c("D", "A", "E", "SIG", "NSEL"),
method = c("quadrature", "MC"), nrq)
Arguments
formula |
An argument providing a symbolic description of the model. For For |
family |
For |
prior |
An argument specifying the prior distribution. For For |
desvars |
For |
criterion |
An optional character argument specifying the utility function. There are currently seven utility functions implemented as follows:
The default value is |
method |
An optional character argument specifying the method of approximating the expected utility function. Current choices are |
nrq |
For |
Details
Two utility functions are implemented.
-
Shannon information gain (SIG)
The utility function is
u^{SIG}(d) = \pi(\theta|y,d) - \pi(\theta),
where
\pi(\theta|y,d)
and\pi(\theta)
denote the posterior and prior densities of the parameters\theta
, respectively. -
Negative squared error loss (NSEL)
The utility function is
u^{NSEL}(d) = - \left(\theta - E(\theta |y,d)\right)^T \left(\theta - E(\theta |y,d)\right),
where
E(\theta | y,d)
denotes the posterior mean of\theta
.
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 sampling-based Monte Carlo or importance sampling approximations will be employed. This was the original approach used by Overstall & Woods (2017). If criterion = "SIG-Norm"
or criterion = "NSEL-Norm"
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, \mathcal{I} (\theta;d)
, which only depends on \theta
(Chaloner & Verdinelli, 1995). In the case of SIG, the approximate utility is given by
u^{D}(d) = \log \vert \mathcal{I} (\theta;d) \vert,
and the resulting design is typically called pseudo-Bayesian D-optimal. For NSEL, the approximate utility is given by
u^A(d) = - \mathrm{tr} \left\{ \mathcal{I} (\theta;d)^{-1} \right\}
with the resulting design termed pseudo-Bayesian A-optimal. 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 pseudo-Bayesian E-optimal design is also implemented:
u^E(d) = \mathrm{min} \mbox{ } e\left(\mathcal{I} (\theta;d) \right),
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 radial-spherical 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.
For utilityglm
, 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 pseudo-Bayesian designs are implemented for generic GLM families.
For more details on the ACE algorithm, see Overstall & Woods (2017).
Value
The function will return a list with the following components:
utility |
The utility function resulting from the choice of arguments. |
Author(s)
Antony M. Overstall A.M.Overstall@soton.ac.uk, David C. Woods, Maria Adamou & Damianos Michaelides
References
Chaloner, K. & Verdinelli, I. (1995). Bayesian experimental design: a review. Statistical Science, 10, 273-304.
Gotwalt, C. M., Jones, B. A. & Steinberg, D. M. (2009). Fast computation of designs robust to parameter uncertainty for nonlinear settings. Technometrics, 51, 88-95.
Monahan, J. and Genz, A. (1997). Spherical-radial 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, 458-470.
See Also
aceglm
, acenlm
, paceglm
, pacenlm
.
Examples
## 1. This example uses utilityglm to generate the pseudo-Bayesian D-optimality
## approximate expected utility function using a Monte Carlo approximation.
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.
ex <- utilityglm(formula = ~x1+x2+x3+x4, family = binomial, prior = prior, method = "MC")
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.
ex$utility(d = start.d, B = 10)
## Evaluate resulting approximate utility. Should get:
#[1] -13.98143 -17.07772 -19.88988 -22.40720 -15.27411 -15.02717 -16.17253 -18.66600 -13.75118
#[10] -21.83820
## 2. This example uses utilitynlm to generate the psuedo-Bayesian A-optimality expected utility
## function using a quadrature approximation
low<-c(0.01884, 0.298, 21.8)
upp<-c(0.09884, 8.298, 21.8)
## Lower and upper limits of the uniform prior distributions. Note that the prior
## for the third element is a point mass.
prior2 <- list(support = cbind(rbind(low, upp)))
colnames(prior2$support) <- c("a", "b", "c")
## Specify a uniform prior with ranges given by low and upp
ex2 <- utilitynlm(formula = ~ c * (exp( - a * t) - exp( - b *t)), prior = prior2,
desvars = "t")
n <- 6
start.d <- matrix(24 * randomLHS(n = n, k = 1), nrow = n)
colnames(start.d) <- "t"
ex2$utility(d = start.d)
## -13.17817