Description Usage Arguments Details Value Author(s) Examples

Computes an optimal approximate or exact design under general linear constraints for a model with a one-dimensional parameter.

1 2 |

`F` |
The |

`b, A` |
The real vector of length |

`w0` |
The non-negative vector of length |

`type` |
Specifies whether exact or approximate design is to be computed. |

`kappa` |
A small non-negative perturbation parameter. |

`tab` |
A vector determining the regressor components to be printed with the resulting design.
This argument should be a subvector of |

`graph` |
A vector determining the regressor components to be plotted with the resulting design.
This argument should be a subvector of |

`t.max` |
The time limit for the computation. |

For the case of `m=1`

parameter, the problem of optimal design is much simpler than for `m>=2`

. First, for `m=1`

all standardized information criteria coincide, therefore the D-, A-, and IV-optimal designs are the same,
and we can call them just "optimal". Second, the information matrix is a real number, therefore we can call it just "information".
Under the most common size constraint, the optimal design is any design supported on the set of maxima of `F[1,1]^2,...,F[n,1]^2`

,
which is straightforward to find. Under a non-standard linear constraint, however, the problem becomes a less trivial knapsack problem,
which is here solved by the integer linear programming solver of gurobi.

The model should be non-singular in the sense that there exists an exact design `w`

satisfying the constraints `0<=w0<=w`

and
`A%*%w<=b`

, with a nonzero information. If this requirement is not satisfied, the computation may fail, or produce a deficient design.

If the criterion of IV-optimality is selected, the region `R`

should be chosen such that the associated matrix `L`

(in this case a real number; see the help page of the function od.crit) is non-zero. If this requirement is not satisfied, the
computation may fail, or it may produce a deficient design.

The perturbation parameter `kappa`

can be used to add `n*m`

iid random numbers from the uniform distribution
in `[-kappa,kappa]`

to the elements of `F`

before the optimization is executed. This can be helpful for
increasing the numerical stability of the computation or for generating a random design from the potentially large set of optimal or
nearly-optimal designs.

The performance depends on the problem and on the hardware used, but in most cases the function can compute an optimal exact design for a problem with a thousand design points within seconds of computing time.

A list with the following components:

`method` |
The method used for computing the design |

`w.best` |
the best permissible design found, or |

`Phi.best` |
The value of the criterion of optimality of the design |

`status` |
The status variable of the gurobi optimization procedure; see the gurobi solver documentation for details. |

`t.act` |
The actual time taken by the computation. |

Radoslav Harman, Lenka Filova

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 | ```
if(require("gurobi")){
# We will demonstrate the procedure on a simple randomly generated
# knapsack problem. Here, the squares of elements of F correspond
# to the values of n available items, the elements of the 1 times n
# matrix A correspond to the weights of the n items, and the real
# number b is the upper limit on the total weight of the items that
# can be put into the knapsack.
# The resulting binary "optimal design" determines which of the items
# should we put into the knapsack to steal the highest possible value.
n <- 200 # There are this many items to choose from.
F.square <- matrix(sample(1:10, n, replace=TRUE), ncol=1)
# Generate random prices of items.
A <- matrix(sample(1:10, n, replace=TRUE), nrow=1)
# Generate random weights of items in kgs.
A <- rbind(A, diag(n))
# We assume that there is just one copy of each item.
b <- c(n / 4, rep(1,n))
# The capacity of the knapsack is n/4 kgs.
# Compute the optimal design, which in this case determines how many
# (0 or 1) of each of the n items should we put into the knapsack.
od.m1(sqrt(F.square), b, A)
# Note: one can compare the result with a specialized function
# as follows:
# library(adagio); knapsack(A[1,], F.square[,1], n / 4)
# However, od.m1 is more general than the standard knapsack functions.
# Suppose, for instance, that the uncle asks that we must be sure to
# take the items number 1, 13 and 66. We will compute the most valuable
# selection of items that fit into our knapsack and contain the
# required items.
w0 <- rep(0, n); w0[c(1, 13, 66)] <- 1
od.m1(sqrt(F.square), b, A, w0, t.max=2)
}
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.