Title: | Optimal Weight Exchange Algorithm for Optimal Designs for Three Models |
---|---|
Description: | An implementation of optimal weight exchange algorithm Yang(2013) <doi:10.1080/01621459.2013.806268> for three models. They are Crossover model with subject dropout, crossover model with proportional first order residual effects and interference model. You can use it to find either A-opt or D-opt approximate designs. Exact designs can be automatically rounded from approximate designs and relative efficiency is provided as well. |
Authors: | Shuai Hao [aut, cre], Min Yang [aut], Wei Zheng [aut] |
Maintainer: | Shuai Hao <[email protected]> |
License: | GPL-3 |
Version: | 0.1.2 |
Built: | 2024-11-10 04:45:15 UTC |
Source: | https://github.com/shuaih0303/owea |
Construct optimal approximate designs as well as efficient exact designs for crossover model with subject dropout, crossover model with proportional residual effect, and interference model.
design( model = c("dropout", "proportional", "interference"), n, opt, t, p, ..., max_iter = 40 )
design( model = c("dropout", "proportional", "interference"), n, opt, t, p, ..., max_iter = 40 )
model |
an model indicator, must be one of 'dropout', 'proportional', or 'interference'. |
n |
Positive Integer, total number of observations needed. |
opt |
Integer. optimal criterion indicator, opt = 0 means D-opt, opt = 1 means A-opt |
t |
Positive interger,number or levels of treatment, the default coding is integer from 1 to t |
p |
Numeric, number of periods for crossover model or number of blocks for intereference model |
... |
other necessary control parameters required by specific model
For crossover with dropout, |
max_iter |
a positive integer. Controls maximum iteration time of exchange. Default is 40. |
A S3 object of one of classes 'dropout', 'proportional' or 'interference'.
model |
the model name |
n |
total number of observations of exact design |
opt |
optimal criterion |
t |
number of levels of treaments |
p |
number of periods or plots in a block |
... |
other inputs |
initial_design |
a randomly chosen design as a starting point for newton's method |
exact_design |
an exact design rounded from approximate design |
approx_design |
optimal approximate design |
verify_equivalence |
result of general equivalence theorem, the last entry is the value of directional derivative |
time |
computing time for approximate design |
# NOTE: max_iter is usually set to 40. # Here max_iter = 5 is for demenstration only. # crossover dropout model ## D-optimal example1 <- design('dropout',10,0,3,3,drop=c(0,0,0.5), max_iter = 5) summary(example1) eff(example1) # efficiency from rounding effLB(example1) # obtain lower bound of efficiency ## A-optimal design('dropout',10,1,3,3,drop=c(0,0,0.5), max_iter = 5) # proportional model ## D-optimal design('proportional',10,0,3,3, sigma = diag(1,3),tau = matrix(sqrt(1+3), nrow=3, ncol=1),lambda = 0.2, max_iter = 5) ## A-optimal design('proportional',10,1,3,3, sigma = diag(1,3), tau = matrix(sqrt(1+3), nrow=3, ncol=1),lambda = 0.2, max_iter = 5) # interference model ## D-optimal design('interference',10,0,3,3, sigma = diag(1,3), max_iter = 5) ## A-optimal design('interference',10,1,3,3, sigma = diag(1,3), max_iter = 5)
# NOTE: max_iter is usually set to 40. # Here max_iter = 5 is for demenstration only. # crossover dropout model ## D-optimal example1 <- design('dropout',10,0,3,3,drop=c(0,0,0.5), max_iter = 5) summary(example1) eff(example1) # efficiency from rounding effLB(example1) # obtain lower bound of efficiency ## A-optimal design('dropout',10,1,3,3,drop=c(0,0,0.5), max_iter = 5) # proportional model ## D-optimal design('proportional',10,0,3,3, sigma = diag(1,3),tau = matrix(sqrt(1+3), nrow=3, ncol=1),lambda = 0.2, max_iter = 5) ## A-optimal design('proportional',10,1,3,3, sigma = diag(1,3), tau = matrix(sqrt(1+3), nrow=3, ncol=1),lambda = 0.2, max_iter = 5) # interference model ## D-optimal design('interference',10,0,3,3, sigma = diag(1,3), max_iter = 5) ## A-optimal design('interference',10,1,3,3, sigma = diag(1,3), max_iter = 5)
design
functionA function to launch graphical interface to design
function.
design_app()
design_app()
## Not run: design_app() # lauching the app. ## End(Not run)
## Not run: design_app() # lauching the app. ## End(Not run)
A generic function that returns the effciency for either exact designs to approximate designs or exact design to a given design
eff(exact_design, ex = NULL) ## Default S3 method: eff(exact_design, ex = NULL) ## S3 method for class 'dropout' eff(exact_design, ex = NULL) ## S3 method for class 'proportional' eff(exact_design, ex = NULL) ## S3 method for class 'interference' eff(exact_design, ex = NULL)
eff(exact_design, ex = NULL) ## Default S3 method: eff(exact_design, ex = NULL) ## S3 method for class 'dropout' eff(exact_design, ex = NULL) ## S3 method for class 'proportional' eff(exact_design, ex = NULL) ## S3 method for class 'interference' eff(exact_design, ex = NULL)
exact_design |
A S3 object returned by |
ex |
Matrix. Design to be compared to. Default is |
Numeric. Relatve Efficiency.
If ex is given |
return relative effciency by
|
If ex is missing |
return relative efficiency by
|
see examples in design
.
The function take S3 object of class 'dropout' as input and return its lower bound of efficiency of exact design.
effLB(exact_design)
effLB(exact_design)
exact_design |
A object of class returned by design function. |
A list of relavent numerics.
optimal |
Optimal Criterion |
lower.bound |
Lower Bound of the exact design |
optimal.value |
The value of objective function at optimal approxiamte design |
see examples in design
.
Returns a information matrix for a given design
infor_design(design, t, ...) ## Default S3 method: infor_design(design, t) ## S3 method for class 'dropout' infor_design(design, t, ...) ## S3 method for class 'interference' infor_design(design, t, ...) ## S3 method for class 'proportional' infor_design(design, t, ...)
infor_design(design, t, ...) ## Default S3 method: infor_design(design, t) ## S3 method for class 'dropout' infor_design(design, t, ...) ## S3 method for class 'interference' infor_design(design, t, ...) ## S3 method for class 'proportional' infor_design(design, t, ...)
design |
Matrix. A design, each row is a design point with weight or repetition on the last entry. |
t |
Numeric. Number of levels of treatments. |
... |
Other control parameter to be passed to methods |
An information matrix.
The OWEA package provides relizations for three models: crossover with subject dropout, crossover with proportional first order residual, and interference model
design
, design_app
, eff
, effLB
,
summary
Return summary info for S3 object return by design
function.
## S3 method for class 'dropout' summary(object, ...) ## S3 method for class 'proportional' summary(object, ...) ## S3 method for class 'interference' summary(object, ...)
## S3 method for class 'dropout' summary(object, ...) ## S3 method for class 'proportional' summary(object, ...) ## S3 method for class 'interference' summary(object, ...)
object |
A S3 object of class 'dropout', 'proportional', or 'interference'. |
... |
other control parameters, but usually not necessary. |
A list of key info.
exact_design |
exact design and its repetitions |
approximate_design |
approximate design and its weights |
computing_time |
computing time for approximate design |
see examples in design
.