nikitos

nikitos / optimaldesign / 0.11.0

README.md

Create a D-efficient experimental design using the Federov exchange mechanism. The algorithm works in a similar fashion to the R function optFederov (AlgDesign package), but can handle much larger designs using a brute force approach where optFederov fails.

Input: a JSON-serialised model matrix (data frame or matrix), such as:

​   variable1 variable2 variable3 variable4
1 -1 -1 -1 -1
2 1 -1 -1 -1
3 -1 1 -1 -1
4 1 1 -1 -1
5 -1 -1 1 -1
6 1 -1 1 -1
7 -1 1 1 -1
8 1 1 1 -1
9 -1 -1 -1 1
10 1 -1 -1 1
11 -1 1 -1 1
12 1 1 -1 1
13 -1 -1 1 1
14 1 -1 1 1
15 -1 1 1 1
16 1 1 1 1

Example usage:

library(jsonlite)
ModelMatrix=expand.grid(list(variable1=c(-1,1),
                             variable2=c(-1,1),
                             variable3=c(-1,1),
                             variable4=c(-1,1)))
input <- serializeJSON((ModelMatrix))
client <- getAlgorithmiaClient() # INSERT YOUR API KEY HERE
algo <- client$algo("nikitos/optimaldesign/0.11.0")
result <- algo$pipe(input)$result
print(unserializeJSON(result))

Output is provided as a JSON-serialised list:

$rows
 [1] 1 4 5 7 8 9 10 11 14 15

$D
[1] 0.9703219

$method
[1] "optFederov"

$timeLapsedInSeconds
[1] 0.00191188

  • rows: rows on the model matrix that are selected to be part of the design
  • D: D-efficiency
  • method: "optFederov" if the Federov exchange mechanism succeeded or "bruteForce" if the Federov mechanism failed and instead a brute force approach was used
  • timeLapsedInSeconds: how long it took to run the algorithm