n.opt {bdpopt} R Documentation

## Optimise A Simple Normal Model

### Description

Find an approximation of the optimal sample size and corresponding expected utility for a simple phase III clinical trial model with a single, normally distributed response and a utility function of a fixed form.

### Usage

```n.opt(nu = 0, tau = 1, sigma = 1, alpha = 0.025,
gain.constant = 1, gain.function = function(X, mu) 0,
fixed.cost = 0, sample.cost = 0.005,
k = 1, n.min = 1, n.max = 50, n.step = 1,
n.iter = 10000, n.burn.in = 1000, n.adapt = 1000,
regression.type = "loess",
plot.results = TRUE, independent.SE = FALSE,
parallel = FALSE, path.to.package = NA)
```

### Arguments

 `nu` The mean of the conjugate normal prior distribution for the unknown population mean. `tau` The standard deviation of the conjugate normal prior distribution for the unknown population mean. `sigma` The known population standard deviation for each individual response in the trial. `alpha` The significance level in the one-sided test used by the regulatory authority to decide upon marketing approval for the new treatment. `gain.constant` A constant utility gain received upon treatment approval. The total gain consists of the sum of `gain.constant` and `gain.function`. `gain.function` A variable utility gain obtained in addition to the constant utility gain upon treatment approval. `fixed.cost` The fixed cost of performing the trial. `sample.cost` The marginal cost per observation for the trial. `k` The number independent, parallel trials. Must be an integer greater than zero. `n.min` Lower limit for the one-dimensional grid for the sample size. `n.max` Upper limit for the one-dimensional grid for the sample size. `n.step` The step size of the grid for the sample size. `n.iter` The number of iterations in the JAGS MCMC simulation. `n.burn.in` The number of burn iterations prior to the JAGS MCMC simulation. `n.adapt` The number of adaptation iterations prior to the burn in and JAGS MCMC simulation. `regression.type` If set to `"loess"`, the default value, then local polynomial regression will be used (via a call to `fit.loess`) to fit the grid simulation results. If set to `"gpr"`, GPR regression will be used instead. For any other value, no regression is performed and the optimisation done will consist of a maximisation over the values corresponding to the grid points. `plot.results` Set to `TRUE` if a plot of the results of the simulation over the grid is to be constructed. `independent.SE` If `TRUE`, then the standard errors of the sample means used to estimate the expected utility will be computed under the assumption of i.i.d. sampling. If `FALSE`, the standard errors are instead computed using the `coda::spectrum0.ar` function. `parallel` Set to `TRUE` if the simulations over the grid should be done in parallel on a multi-core processor. The default value `FALSE` leads to single-core computations. `path.to.package` The search path to the installation directory of bdpopt. For the default value, the function will attempt to find the path using `search`.

### Value

A list with components

 `ns` A numeric, atomic vector containing the sample size grid points. `eus` A numeric, atomic vector containing the sample means of the simulated expected utilities corresponding to the sample size grid points. `opt.arg` The optimal sample size found by maximising the estimated expected utility. `opt.eu` The estimated optimal utility corresponding to the optimal sample size found.

### Author(s)

Sebastian Jobjörnsson jobjorns@chalmers.se

`optimise.eu`