knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "80%"
)

optedr

CRAN status Lifecycle: stable

Overview

The package optedr is an optimal experimental design suite for calculating optimal designs, D-augmenting designs and efficiently rounding approximate design. Among its capabilities are:

Installation

You can install the released version of optedr from CRAN with:

install.packages("optedr")

You can install the latest version of the package from GitHub with:

devtools::install_github("kezrael/optedr")

Functions

The user available functions are:

The optdes object generated by opt_des() has its own implementation of print(), summary() and plot().

Usage

library(optedr)
library(optedr)

The calculation of an optimal design requires a to specify the Criterion, the model, the parameters and their initial values and the design_space.

resArr.D <- opt_des(Criterion = "D-Optimality",
                    model = y ~ a*exp(-b/x),
                    parameters = c("a", "b"),
                    par_values = c(1, 1500),
                    design_space = c(212, 422))

resArr.D$optdes
resArr.D$sens
resArr.D$convergence

After calculating the D-optimal design, the user might want to add points to the design to fit their needs:

mockery::stub(augment_design, "readline", mockery::mock(0.8, 260, 0.15, 380, 0.15, "f"))
aug_arr <- augment_design(resArr.D$optdes, 0.3, y ~ a * exp(-b/x),
               parameters = c("a", "b"),
               par_values = c(1, 1500),
               design_space = c(212, 422),
               F)
aug_arr

This new design can be rounded to the desired number of points:

(exact_design <- efficient_round(aug_arr, 20))

And its efficiency compared against the optimum:

aprox_design <- exact_design
aprox_design$Weight <- aprox_design$Weight /sum(aprox_design$Weight)

design_efficiency(resArr.D, aprox_design)


Kezrael/optedr documentation built on Oct. 12, 2024, 8:40 p.m.