| Type: | Package |
| Title: | Greedy Experimental Design Construction |
| Version: | 1.6 |
| Date: | 2026-1-1 |
| Author: | Adam Kapelner [aut, cre] (ORCID: 0000-0001-5985-6792), David Azriel [aut], Abba Krieger [aut] |
| Maintainer: | Adam Kapelner <kapelner@qc.cuny.edu> |
| Description: | Computes experimental designs for two-arm experiments with covariates using multiple methods, including: (0) complete randomization and randomization with forced-balance; (1) greedy optimization of a balance objective function via pairwise switching; (2) numerical optimization via 'gurobi'; (3) rerandomization; (4) Karp's method for one covariate; (5) exhaustive enumeration for small sample sizes; (6) binary pair matching using 'nbpMatching'; (7) binary pair matching plus method (1) to further optimize balance; (8) binary pair matching plus method (3) to further optimize balance; (9) Hadamard designs; and (10) simultaneous multiple kernels. For the greedy, rerandomization, and related methods, three objective functions are supported: Mahalanobis distance, standardized sums of absolute differences, and kernel distances via the 'kernlab' library. This package is the result of a stream of research that can be found in Krieger, A. M., Azriel, D. A., and Kapelner, A. (2019). "Nearly Random Designs with Greatly Improved Balance." Biometrika 106(3), 695-701 <doi:10.1093/biomet/asz026>. Krieger, A. M., Azriel, D. A., and Kapelner, A. (2023). "Better experimental design by hybridizing binary matching with imbalance optimization." Canadian Journal of Statistics, 51(1), 275-292 <doi:10.1002/cjs.11685>. |
| License: | GPL-3 |
| Encoding: | UTF-8 |
| Depends: | R (≥ 4.1.0), rJava (≥ 0.9-6) |
| SystemRequirements: | Java (>= 7.0) |
| LinkingTo: | Rcpp |
| Imports: | Rcpp, checkmate, nbpMatching, rlist, stringr, stringi, kernlab, ggplot2, graphics, grDevices, stats |
| Suggests: | testthat (≥ 3.0.0), pkgload, R6 |
| Config/testthat/edition: | 3 |
| URL: | https://github.com/kapelner/GreedyExperimentalDesign |
| RoxygenNote: | 7.3.3 |
| NeedsCompilation: | yes |
| Packaged: | 2026-01-08 15:15:08 UTC; kapelner |
| Repository: | CRAN |
| Date/Publication: | 2026-01-09 09:31:18 UTC |
Greedy Experimental Design Search
Description
A tool to find many types of a priori experimental designs
Author(s)
Adam Kapelner kapelner@qc.cuny.edu
References
Kapelner, A
Tests if a vector has all elements the same
Description
Tests if a vector has all elements the same
Usage
all_elements_same_cpp_wrap(w)
Arguments
w |
The vector to be queried |
Value
A boolean if it has all same elements
Author(s)
Adam Kapelner
Examples
## Not run:
all_elements_same_cpp_wrap(c(1, 1, 1))
all_elements_same_cpp_wrap(c(1, 2, 1))
## End(Not run)
Implements complete randomization (without forced balance)
Description
For debugging, you can use set.seed
to be assured of deterministic output.
Usage
complete_randomization(n, r, form = "one_zero")
Arguments
n |
number of observations |
r |
number of randomized designs you would like |
form |
Which form should it be in? The default is |
Value
a matrix where each column is one of the r designs
Author(s)
Adam Kapelner
Examples
## Not run:
complete_randomization(n = 6, r = 2)
## End(Not run)
Implements forced balanced randomization
Description
For debugging, you can use set.seed
to be assured of deterministic output.
Usage
complete_randomization_with_forced_balanced(
n,
r,
form = "one_zero",
seed = NULL
)
Arguments
n |
number of observations |
r |
number of randomized designs you would like |
form |
Which form should it be in? The default is |
seed |
An integer which is the seed to be set within C++. Default is |
Value
a matrix where each column is one of the r designs
Author(s)
Adam Kapelner
Examples
## Not run:
complete_randomization_with_forced_balanced(n = 6, r = 2, seed = 1)
## End(Not run)
Compute Binary Matching Strcuture
Description
This method creates an object of type binary_match_structure and will compute pairs. You can then
use the functions initBinaryMatchExperimentalDesignSearchObject and resultsBinaryMatchSearch
to create randomized allocation vectors. For one column in X, we just sort to find the pairs trivially.
Usage
computeBinaryMatchStructure(
X,
mahal_match = FALSE,
compute_dist_matrix = NULL,
D = NULL,
symmetry_tol = 1e-12,
use_safe_inverse = FALSE
)
Arguments
X |
The design matrix with $n$ rows (one for each subject) and $p$ columns (one for each measurement on the subject). This is the design matrix you wish to search for a more optimal design. |
mahal_match |
Match using Mahalanobis distance. Default is |
compute_dist_matrix |
The function that computes the distance matrix between every two observations in |
D |
A distance matrix precomputed. The default is |
symmetry_tol |
Tolerance for symmetry check on |
use_safe_inverse |
Should a regularized inverse be used for the Mahalanobis objective?
Default is |
Value
An object of type binary_experimental_design which can be further operated upon.
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(16), nrow = 8)
bms = computeBinaryMatchStructure(X)
bms$indicies_pairs
## End(Not run)
Computes a Euclidean-squared distance matrix rapidly
Description
Computes a Euclidean-squared distance matrix rapidly
Usage
compute_distance_matrix_cpp_wrap(X)
Arguments
X |
A numeric matrix with n rows representing each subject and p columns which are measurements on each subject |
Value
The n x n Euclidean distances squared
Author(s)
Adam Kapelner
Examples
## Not run:
X = matrix(c(0, 1, 2, 3), nrow = 2)
compute_distance_matrix_cpp_wrap(X)
## End(Not run)
Gram Matrix Computation
Description
Computes the Gram Matrix for a user-specified kernel using the library kernlab. Note that
this function automatically standardizes the columns of the data entered.
Usage
compute_gram_matrix(X, kernel_type, params = c())
Arguments
X |
The design matrix with $n$ rows (one for each subject) and $p$ columns (one for each measurement on the subject). This is the design matrix you wish to search for a more optimal design. |
kernel_type |
One of the following: "vanilla", "rbf", "poly", "tanh", "bessel", "laplace", "anova" or "spline". |
params |
A vector of numeric parameters. Each |
Value
The n x n gram matrix for the given kernel on the given data.
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(12), nrow = 6)
K = compute_gram_matrix(X, kernel_type = "rbf", params = 0.5)
dim(K)
## End(Not run)
Computes Objective Value From Allocation Vector
Description
Returns the objective value given a design vector as well an an objective function. This is sometimes duplicated in Java. However, within Java, tricks are played to make optimization go faster so Java's objective values may not always be the same as the true objective function (e.g. logs or constants dropped).
Usage
compute_objective_val(
X,
indic_T,
objective = "abs_sum_diff",
inv_cov_X = NULL,
use_safe_inverse = FALSE
)
Arguments
X |
The n x p design matrix |
indic_T |
The n-length binary allocation vector |
objective |
The objective function to use. Default is |
inv_cov_X |
Optional: the inverse sample variance covariance matrix. Use this argument if you will be doing many calculations since passing this in will cache this data. |
use_safe_inverse |
Should a regularized inverse be used for the Mahalanobis objective?
Default is |
Author(s)
Adam Kapelner
Examples
## Not run:
X = matrix(rnorm(12), nrow = 6)
indic_T = c(1, 0, 1, 0, 1, 0)
compute_objective_val(X, indic_T, objective = "abs_sum_diff")
## End(Not run)
Computes Randomization Metrics (explained in paper) about a design algorithm
Description
Computes Randomization Metrics (explained in paper) about a design algorithm
Usage
compute_randomization_metrics(designs)
Arguments
designs |
A matrix where each column is one design. |
Value
A list of resulting data: the probability estimates for each pair in the design of randomness where estmates close to ~0.5 represent random assignment, then the entropy metric the distance metric, the maximum eigenvalue of the allocation var-cov matrix (operator norm) and the squared Frobenius norm (the sum of the squared eigenvalues)
Author(s)
Adam Kapelner
Examples
## Not run:
designs = matrix(c(1, 0, 1, 0, 0, 1, 0, 1), nrow = 4, ncol = 2)
compute_randomization_metrics(designs)
## End(Not run)
Create all binary Y's convenience function using a randomized design
Description
Create all binary Y's convenience function using a randomized design
Usage
create_all_ys_cpp_wrap(pCs, pTs, W, two_n, nY)
Arguments
pCs |
Control-group success probabilities (length |
pTs |
Treatment-group success probabilities (length |
W |
Assignment matrix with |
two_n |
Total number of units |
nY |
Number of Y vectors to generate |
Value
A matrix of boolean Y's
Author(s)
Adam Kapelner
Examples
## Not run:
pCs = rep(0.2, 4)
pTs = rep(0.8, 4)
W = matrix(c(1, 0, 1, 0, 0, 1, 0, 1), nrow = 2, byrow = TRUE)
create_all_ys_cpp_wrap(pCs, pTs, W, two_n = 4, nY = 2)
## End(Not run)
Create PM designs
Description
Create PM designs
Usage
gen_pm_designs_cpp_wrap(indicies_pairs, n, r)
Arguments
indicies_pairs |
A matrix of n x 2 indicies where each row is a pair of subjects' indicies |
n |
Half the number of subjects i.e. the number of pairs |
r |
The number of assignments to generate |
Value
A matrix of r x 2n PM designs of +1/-1 assignments
Author(s)
Adam Kapelner
Examples
## Not run:
indicies_pairs = matrix(c(1, 2, 3, 4), ncol = 2, byrow = TRUE)
gen_pm_designs_cpp_wrap(indicies_pairs, n = 2, r = 3)
## End(Not run)
Computes varcov matrix for block designs
Description
The varcov matrix for block designs consists of a block- diagonal matrix with B blocks (the number of blocks in the design) with off-diagonal entries = -1 / (n/B - 1) where n is the number of subjected in the study.
Usage
gen_var_cov_matrix_block_designs(n, prop_T, B, use_cache = TRUE)
Arguments
n |
number of observations |
prop_T |
the proportion of treatments allocated |
B |
the number of blocks |
use_cache |
Cache results for repeated calls with identical inputs. Default is |
Value
varcov matrix for the specific block design
Author(s)
Adam Kapelner
Examples
## Not run:
gen_var_cov_matrix_block_designs(n = 12, prop_T = 0.5, B = 3)
## End(Not run)
Generates homogeneous block design allocations rapidly
Description
Generates homogeneous block design allocations rapidly
Usage
generate_block_design_cpp_wrap(B, nR, dummy_block)
Arguments
B |
The number of blocks in the design |
nR |
The number of allocation vectors |
dummy_block |
The subvector of allocations in each block that will be permuted |
Value
A matrix with rows being the nR random block allocation of sample size B x length(dummy_block).
Author(s)
Adam Kapelner
Examples
## Not run:
generate_block_design_cpp_wrap(B = 2, nR = 3, dummy_block = c(1, 0))
## End(Not run)
Generates a design matrix with standardized predictors.
Description
This function is useful for debugging.
Usage
generate_stdzied_design_matrix(n = 50, p = 1, covariate_gen = rnorm, ...)
Arguments
n |
Number of rows in the design matrix |
p |
Number of columns in the design matrix |
covariate_gen |
The function to use to draw the covariate realizations (assumed to be iid).
This defaults to |
... |
Optional arguments to be passed to the |
Value
THe design matrix
Author(s)
Adam Kapelner
Examples
## Not run:
X = generate_stdzied_design_matrix(n = 6, p = 2)
colMeans(X)
## End(Not run)
Curate More Orthogonal Vectors Greedily
Description
This function takes a set of allocation vectors and pares them down one-by-one by eliminating the vector that can result in the largest reduction in Avg[ |r_ij| ]. It is recommended to begin with a set of unmirrored vectors for speed. Then add the mirrors later for whichever subset you wish.
Usage
greedy_orthogonalization_curation(W, Rmin = 2, verbose = FALSE)
Arguments
W |
A matrix in in the set |
Rmin |
The minimum number of vectors to consider in a design. The default is the true bottom, two. |
verbose |
Default is |
Value
A list with two elements: (1) avg_abs_rij_by_R which is a data frame with R - Rmin + 1 rows and
columns R and average absolute r_ij and (2) Wsorted which provides the collection of vectors in
sorted by best average absolute r_ij in row order from best to worst.
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
W = matrix(sample(c(-1, 1), 6 * 8, replace = TRUE), nrow = 6)
res = greedy_orthogonalization_curation(W, Rmin = 3, verbose = FALSE)
res$avg_abs_rij_by_R
## End(Not run)
Curate More Orthogonal Vectors Greedily
Description
This function takes a set of allocation vectors and pares them down one-by-one by eliminating the vector that can result in the largest reduction in Avg[ |r_ij| ]. It is recommended to begin with a set of unmirrored vectors for speed. Then add the mirrors later for whichever subset you wish.
Usage
greedy_orthogonalization_curation2(W, R0 = 100, verbose = FALSE)
Arguments
W |
A matrix in |
R0 |
The minimum number of vectors to consider in a design. The default is the true bottom, two. |
verbose |
Default is |
Value
A list with two elements: (1) avg_abs_rij_by_R which is a data frame with R - Rmin + 1 rows and
columns R and average absolute r_ij and (2) Wsorted which provides the collection of vectors in
sorted by best average absolute r_ij in row order from best to worst.
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
W = matrix(sample(c(-1, 1), 6 * 8, replace = TRUE), nrow = 6)
W2 = greedy_orthogonalization_curation2(W, R0 = 4, verbose = FALSE)
dim(W2)
## End(Not run)
Create a Hadamard Design
Description
This method returns unique designs according to a Hadamard matrix. For debugging, you can use set.seed
to be assured of deterministic output.
Usage
hadamardExperimentalDesign(X, strict = TRUE, form = "one_zero")
Arguments
X |
The design matrix with $n$ rows (one for each subject) and $p$ columns (one for each measurement on the subject). The measurements aren't used to compute the Hadamard designs, only the number of rows. |
strict |
Hadamard matrices are not available for all $n$. |
form |
Which form should it be in? The default is |
Value
An matrix of dimension $R$ x $n$ where $R$ is the number of Hadamard allocations.
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(16), nrow = 8)
W = hadamardExperimentalDesign(X, strict = TRUE, form = "one_zero")
dim(W)
## End(Not run)
Implements unequally allocated block designs
Description
For debugging, you can use set.seed
to be assured of deterministic output. The following quantities
in this design must be integer valued or an error will be thrown:
n_B := n / B and n_B * prop_T
Usage
imbalanced_block_designs(n, prop_T, B, r, form = "one_zero", seed = NULL)
Arguments
n |
number of observations |
prop_T |
the proportion of treatments allocated |
B |
the number of blocks |
r |
number of randomized designs you would like |
form |
Which form should it be in? The default is |
seed |
An integer which is the seed to be set within C++. Default is |
Value
a matrix where each column is one of the r designs
Author(s)
Adam Kapelner
Examples
## Not run:
imbalanced_block_designs(n = 12, prop_T = 0.5, B = 3, r = 2, seed = 1)
## End(Not run)
Implements unequally allocated complete randomization
Description
For debugging, you can use set.seed
to be assured of deterministic output.
Usage
imbalanced_complete_randomization(n, prop_T, r, form = "one_zero", seed = NULL)
Arguments
n |
number of observations |
prop_T |
the proportion of treatments needed |
r |
number of randomized designs you would like |
form |
Which form should it be in? The default is |
seed |
An integer which is the seed to be set within C++. Default is |
Value
a matrix where each column is one of the r designs
Author(s)
Adam Kapelner
Examples
## Not run:
imbalanced_complete_randomization(n = 10, prop_T = 0.3, r = 2, seed = 1)
## End(Not run)
Begin a Binary Match Search
Description
This method creates an object of type pairwise_matching_experimental_design_search and will immediately initiate
a search through allocation space for pairwise match designs based on the structure computed in the function computeBinaryMatchStructure.
For debugging, you can use set the seed parameter and num_cores = 1 to be assured of deterministic output.
Usage
initBinaryMatchExperimentalDesignSearchObject(
binary_match_structure,
max_designs = 1000,
wait = FALSE,
start = TRUE,
num_cores = 1,
seed = NULL,
prop_flips = 1,
verbose = TRUE
)
Arguments
binary_match_structure |
The |
max_designs |
How many random allocation vectors you wish to return. The default is 1000. |
wait |
Should the |
start |
Should we start searching immediately (default is |
num_cores |
The number of CPU cores you wish to use during the search. The default is |
seed |
The set to set for deterministic output. This should only be set if |
prop_flips |
Proportion of flips. Default is all. Lower for more correlated assignments (useful for research only). |
verbose |
Should the algorithm emit progress output? Default is |
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(16), nrow = 8)
bms = computeBinaryMatchStructure(X)
bm = initBinaryMatchExperimentalDesignSearchObject(
bms,
max_designs = 4,
num_cores = 1,
start = TRUE,
wait = TRUE,
seed = 1,
verbose = FALSE
)
bm
## End(Not run)
Begin a Search for Binary Matching Followed by Greedy Switch Designs
Description
This method creates an object of type binary_then_greedy_experimental_design and will find optimal matched pairs which
are then greedily switched in order to further minimize a balance metric. You can then
use the function resultsBinaryMatchThenGreedySearch to obtain the randomized allocation vectors. For one column
in X, the matching just sorts the values to find the pairs trivially.
Usage
initBinaryMatchFollowedByGreedyExperimentalDesignSearchObject(
X,
diff_method = FALSE,
compute_dist_matrix = NULL,
verbose = TRUE,
...
)
Arguments
X |
The design matrix with $n$ rows (one for each subject) and $p$ columns (one for each measurement on the subject). This is the design matrix you wish to search for a more optimal design. |
diff_method |
Once the subjects (i.e. row vectors) are paired, do we create a set of $n$/2 difference
vectors and feed that into greedy? If |
compute_dist_matrix |
The function that computes the distance matrix between every two observations in |
verbose |
Should the algorithm emit progress output? Default is |
... |
Arguments passed to |
Value
An object of type binary_experimental_design which can be further operated upon.
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(16), nrow = 8)
obj = initBinaryMatchFollowedByGreedyExperimentalDesignSearchObject(
X,
max_designs = 4,
num_cores = 1,
objective = "abs_sum_diff",
start = TRUE,
wait = TRUE,
verbose = FALSE
)
obj
## End(Not run)
Begin a Search for Binary Matching Followed by Rerandomization
Description
This method creates an object of type binary_then_rerandomization_experimental_design and will find optimal matched pairs which
are then rerandomized in order to further minimize a balance metric. You can then
use the function resultsBinaryMatchThenRerandomizationSearch to obtain the randomized allocation vectors. For one column
in X, the matching just sorts the values to find the pairs trivially.
Usage
initBinaryMatchFollowedByRerandomizationDesignSearchObject(
X,
compute_dist_matrix = NULL,
verbose = TRUE,
...
)
Arguments
X |
The design matrix with $n$ rows (one for each subject) and $p$ columns (one for each measurement on the subject). This is the design matrix you wish to search for a more optimal design. |
compute_dist_matrix |
The function that computes the distance matrix between every two observations in |
verbose |
Should the algorithm emit progress output? Default is |
... |
Arguments passed to |
Value
An object of type binary_experimental_design which can be further operated upon.
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(16), nrow = 8)
obj = initBinaryMatchFollowedByRerandomizationDesignSearchObject(
X,
max_designs = 4,
num_cores = 1,
objective = "abs_sum_diff",
obj_val_cutoff_to_include = Inf,
start = TRUE,
wait = TRUE,
verbose = FALSE
)
obj
## End(Not run)
Begin A Greedy Pair Switching Search
Description
This method creates an object of type greedy_experimental_design and will immediately initiate
a search through allocation space for forced balance designs. For debugging, you can use set the seed
parameter and num_cores = 1 to be assured of deterministic output.
Usage
initGreedyExperimentalDesignObject(
X = NULL,
nT = NULL,
max_designs = 10000,
objective = "mahal_dist",
indicies_pairs = NULL,
Kgram = NULL,
wait = FALSE,
start = TRUE,
max_iters = Inf,
semigreedy = FALSE,
diagnostics = FALSE,
num_cores = 1,
seed = NULL,
verbose = TRUE,
use_safe_inverse = FALSE
)
Arguments
X |
The design matrix with $n$ rows (one for each subject) and $p$ columns
(one for each measurement on the subject). This is the design matrix you wish
to search for a more optimal design. This parameter must be specified unless you
choose objective type |
nT |
The number of treatments to assign. Default is |
max_designs |
The maximum number of designs to be returned. Default is 10,000. Make this large
so you can search however long you wish as the search can be stopped at any time by
using the |
objective |
The objective function to use when searching design space. This is a string
with valid values " |
indicies_pairs |
A matrix of size $n/2$ times 2 whose rows are indicies pairs. The values of the entire matrix
must enumerate all indicies $1, ..., n$. The default is |
Kgram |
If the |
wait |
Should the |
start |
Should we start searching immediately (default is |
max_iters |
Should we impose a maximum number of greedy switches? The default is |
semigreedy |
Should we use a fully greedy approach or the quicker semi-greedy approach? The default is
|
diagnostics |
Returns diagnostic information about the iterations including (a) the initial starting
vectors, (b) the switches at every iteration and (c) information about the objective function
at every iteration (default is |
num_cores |
The number of CPU cores you wish to use during the search. The default is |
seed |
The set to set for deterministic output. This should only be set if |
verbose |
Should the algorithm emit progress output? Default is |
use_safe_inverse |
Should a regularized inverse be used for the Mahalanobis objective?
Default is |
Value
An object of type greedy_experimental_design_search which can be further operated upon
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(20), nrow = 10)
ged = initGreedyExperimentalDesignObject(
X,
max_designs = 5,
num_cores = 1,
objective = "abs_sum_diff",
start = TRUE,
wait = TRUE,
verbose = FALSE
)
ged
## End(Not run)
Begin A Greedy Pair Multiple Kernel Switching Search
Description
This method creates an object of type greedy_multiple_kernel_experimental_design and will immediately initiate
a search through allocation space for forced balance designs. For debugging, you can use set the seed
parameter and num_cores = 1 to be assured of deterministic output.
Usage
initGreedyMultipleKernelExperimentalDesignObject(
X = NULL,
max_designs = 10000,
objective = "added_pct_reduction",
kernel_pre_num_designs = 2000,
kernel_names = NULL,
Kgrams = NULL,
maximum_gain_scaling = 1.1,
kernel_weights = NULL,
wait = FALSE,
start = TRUE,
max_iters = Inf,
semigreedy = FALSE,
diagnostics = FALSE,
num_cores = 1,
seed = NULL,
verbose = TRUE,
use_safe_inverse = FALSE
)
Arguments
X |
The design matrix with $n$ rows (one for each subject) and $p$ columns (one for each measurement on the subject). This is the design matrix you wish to search for a more optimal design. We will standardize this matrix by column internally. |
max_designs |
The maximum number of designs to be returned. Default is 10,000. Make this large
so you can search however long you wish as the search can be stopped at any time by
using the |
objective |
The method used to aggregate the kernel objective functions together. Default is "added_pct_reduction". |
kernel_pre_num_designs |
How many designs per kernel to run to explore the space of kernel objective values. Default is 2000. |
kernel_names |
An array with the kernels to compute with default parameters. Must have elements in the following set:
"mahalanobis", "poly_s" where the "s" is a natural number 1 or greater,
"exponential", "laplacian", "inv_mult_quad", "gaussian". Default is |
Kgrams |
A list of M >= 1 elements where each is a |
maximum_gain_scaling |
This controls how much the percentage of possible improvement on a kernel objective function
should be scaled by. The minimum is 1 which allows for designs that could potentially have >=100
improvement over original. We recommend 1.1 which means that a design that was found to be the best
of the |
kernel_weights |
A vector with positive weights (need not be normalized) where each element represents the weight of
each kernel. The default is |
wait |
Should the |
start |
Should we start searching immediately (default is |
max_iters |
Should we impose a maximum number of greedy switches? The default is |
semigreedy |
Should we use a fully greedy approach or the quicker semi-greedy approach? The default is
|
diagnostics |
Returns diagnostic information about the iterations including (a) the initial starting
vectors, (b) the switches at every iteration and (c) information about the objective function
at every iteration (default is |
num_cores |
The number of CPU cores you wish to use during the search. The default is |
seed |
The set to set for deterministic output. This should only be set if |
verbose |
Should the algorithm emit progress output? Default is |
use_safe_inverse |
Should a regularized inverse be used for the Mahalanobis objective?
Default is |
Value
An object of type greedy_experimental_design_search which can be further operated upon
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(20), nrow = 10)
mk = initGreedyMultipleKernelExperimentalDesignObject(
X,
max_designs = 4,
kernel_pre_num_designs = 4,
num_cores = 1,
kernel_names = c("mahalanobis", "gaussian"),
start = TRUE,
wait = TRUE,
verbose = FALSE
)
mk
## End(Not run)
Begin Gurobi Optimized Search
Description
This method creates an object of type optimal_experimental_design and will immediately initiate
a search through allocation space for forced balance designs. Make sure you setup Gurobi properly first. This means
applying for a license, downloading, installing, registering it on your computer using the grbgetkey command
with the license file in the default directory. Then, in R, install the package from the file in your gurobi directory.
Usage
initGurobiNumericalOptimizationExperimentalDesignObject(
X = NULL,
objective = "mahal_dist",
Kgram = NULL,
num_cores = 2,
w_0 = NULL,
initial_time_limit_sec = 5 * 60,
restart_time_limit_sec = 60,
max_number_of_restarts = 0,
max_no_good_cuts = 0,
verbose = TRUE,
gurobi_params = list(),
use_safe_inverse = FALSE,
r,
pool_solutions = NULL,
pool_gap = 0.2,
pool_gap_abs = NULL,
pool_search_mode = 2,
mip_gap = 1e-04,
mip_gap_abs = 1e-10,
mip_focus = 1,
heuristics = 0.2,
cuts = 2,
presolve = 2
)
Arguments
X |
The design matrix with $n$ rows (one for each subject) and $p$ columns (one for each measurement on the subject). This is the design matrix you wish to search for a more optimal design. |
objective |
The objective function to use when searching design space. This is a string
with valid values " |
Kgram |
If the |
num_cores |
Number of cores to use during search. Default is |
w_0 |
The initial starting location (optional). |
initial_time_limit_sec |
The maximum amount of time the optimizer can run for in seconds. The default is |
restart_time_limit_sec |
The maximum amount of time each restart can run for in seconds. The default is |
max_number_of_restarts |
The maximum number of restarts to attempt if too few unique solutions are returned.
Default is |
max_no_good_cuts |
The maximum number of no-good cuts to attempt. Default is |
verbose |
Should Gurobi log to console? Default is |
gurobi_params |
A list of optional parameters to be passed to Gurobi (see their documentation online). |
use_safe_inverse |
Should a regularized inverse be used for the Mahalanobis objective?
Default is |
r |
Number of solution vectors to request from the Gurobi pool. |
pool_solutions |
Number of solutions to request from the Gurobi pool. Defaults to |
pool_gap |
Relative optimality gap for the pool. Default is |
pool_gap_abs |
Absolute optimality gap for the pool. Default is |
pool_search_mode |
Solution pool search mode. Default is |
mip_gap |
Relative MIP gap target (stops when |
mip_gap_abs |
Absolute MIP gap target (stops when |
mip_focus |
Search focus: |
heuristics |
Heuristics effort in |
cuts |
Cut aggressiveness: |
presolve |
Presolve aggressiveness: |
Details
Currently, this method does not return multiple vectors. This will be improved in a later
version. If you want this functionality now, use the hacked-up method gurobi_multiple_designs.
Value
A list object which houses the results from Gurobi. Depending on the gurobi_parms,
the data within will be different. The most relevant tags are x for the best found solution and objval
for the object
Author(s)
Adam Kapelner
Examples
## Not run:
if ("gurobi" %in% loadedNamespaces()) {
set.seed(1)
X = matrix(rnorm(12), nrow = 6)
gobj = initGurobiNumericalOptimizationExperimentalDesignObject(
X,
r = 2,
num_cores = 1,
initial_time_limit_sec = 5,
verbose = FALSE
)
gobj$n
}
## End(Not run)
Begin Karp Search
Description
This method creates an object of type karp_experimental_design and will immediately initiate a search through allocation space. Note that the Karp search only works for one covariate (i.e. $p=1$) and the objective "abs_sum_diff".
Usage
initKarpExperimentalDesignObject(
X,
wait = FALSE,
balanced = TRUE,
start = TRUE,
verbose = TRUE
)
Arguments
X |
The design matrix with $n$ rows (one for each subject) and $p$ columns (one for each measurement on the subject). This is the design matrix you wish to search for a more karp design. |
wait |
Should the |
balanced |
Should the final vector be balanced? Default and recommended is |
start |
Should we start searching immediately (default is |
verbose |
Should the algorithm emit progress output? Default is |
Value
An object of type karp_experimental_design_search which can be further operated upon
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(10), nrow = 10)
kobj = initKarpExperimentalDesignObject(
X,
start = TRUE,
wait = TRUE,
balanced = TRUE,
verbose = FALSE
)
kobj
## End(Not run)
Begin a Search for the Optimal Solution
Description
This method creates an object of type optimal_experimental_design and will immediately initiate
a search through allocation space. Since this search takes exponential time, for most machines,
this method is futile beyond 28 samples. You've been warned! For debugging, you can use set
num_cores = 1 to be assured of deterministic output.
Usage
initOptimalExperimentalDesignObject(
X = NULL,
objective = "mahal_dist",
Kgram = NULL,
wait = FALSE,
start = TRUE,
num_cores = 1,
verbose = TRUE,
use_safe_inverse = FALSE
)
Arguments
X |
The design matrix with $n$ rows (one for each subject) and $p$ columns (one for each measurement on the subject). This is the design matrix you wish to search for a more optimal design. |
objective |
The objective function to use when searching design space. This is a string
with valid values " |
Kgram |
If the |
wait |
Should the |
start |
Should we start searching immediately (default is |
num_cores |
The number of CPU cores you wish to use during the search. The default is |
verbose |
Should the algorithm emit progress output? Default is |
use_safe_inverse |
Should a regularized inverse be used for the Mahalanobis objective?
Default is |
Value
An object of type optimal_experimental_design_search which can be further operated upon
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(12), nrow = 6)
obj = initOptimalExperimentalDesignObject(
X,
objective = "abs_sum_diff",
num_cores = 1,
start = TRUE,
wait = TRUE,
verbose = FALSE
)
obj
## End(Not run)
Begin a Rerandomization Search
Description
This method creates an object of type rerandomization_experimental_design and will immediately initiate
a search through allocation space for forced-balance designs. For debugging, you can use set the seed
parameter and num_cores = 1 to be assured of deterministic output.
Usage
initRerandomizationExperimentalDesignObject(
X = NULL,
obj_val_cutoff_to_include,
max_designs = 1000,
objective = "mahal_dist",
Kgram = NULL,
wait = FALSE,
start = TRUE,
num_cores = 1,
seed = NULL,
verbose = TRUE,
use_safe_inverse = FALSE
)
Arguments
X |
The design matrix with $n$ rows (one for each subject) and $p$ columns (one for each measurement on the subject). This is the design matrix you wish to search for a more optimal design. |
obj_val_cutoff_to_include |
Only allocation vectors with objective values lower than this threshold will be returned.
If the cutoff is infinity, you are doing BCRD and you should use the |
max_designs |
The maximum number of designs to be returned. Default is 10,000. Make this large
so you can search however long you wish as the search can be stopped at any time by
using the |
objective |
The objective function to use when searching design space. This is a string
with valid values " |
Kgram |
If the |
wait |
Should the |
start |
Should we start searching immediately (default is |
num_cores |
The number of CPU cores you wish to use during the search. The default is |
seed |
The set to set for deterministic output. This should only be set if |
verbose |
Should the algorithm emit progress output? Default is |
use_safe_inverse |
Should a regularized inverse be used for the Mahalanobis objective?
Default is |
Value
An object of type rerandomization_experimental_design_search which can be further operated upon.
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(20), nrow = 10)
obj = initRerandomizationExperimentalDesignObject(
X,
max_designs = 5,
num_cores = 1,
objective = "abs_sum_diff",
obj_val_cutoff_to_include = Inf,
start = TRUE,
wait = TRUE,
verbose = FALSE
)
obj
## End(Not run)
Compute Optimal Number of Treatments/Controls
Description
Given a total budget and asymmetric treatment and control costs, calculate the number of treatments and controls that optimize the variance of the estimator. The number of treatments is rounded up by default.
Usage
optimize_asymmetric_treatment_assignment(
c_treatment = NULL,
c_control = NULL,
c_total_max = NULL,
n = NULL
)
Arguments
c_treatment |
The cost of a treatment assignment. Default is |
c_control |
The cost of a control assignment. Default is |
c_total_max |
The total cost constraint of any allocation. Either this or |
n |
The total cost constraint as specified by the total number of subjects. Either this or |
Value
A list with three keys: n, nT, nC plus specified arguments
Author(s)
Adam Kapelner
Examples
## Not run:
optimize_asymmetric_treatment_assignment(n = 100)
optimize_asymmetric_treatment_assignment(n = 100, c_treatment = 2, c_control = 1)
optimize_asymmetric_treatment_assignment(c_total_max = 50, c_treatment = 2, c_control = 1)
## End(Not run)
Plots a summary of a greedy search object object
Description
Plots a summary of a greedy search object object
Usage
## S3 method for class 'greedy_experimental_design_search'
plot(x, ...)
Arguments
x |
The greedy search object object to be summarized in the plot |
... |
Other parameters to pass to the default plot function |
Value
An array of order statistics from plot_obj_val_order_statistic as a list element
Author(s)
Adam Kapelner
Plots a summary of a greedy_multiple_kernel_experimental_design object
Description
Plots a summary of a greedy_multiple_kernel_experimental_design object
Usage
## S3 method for class 'greedy_multiple_kernel_experimental_design'
plot(x, ...)
Arguments
x |
The |
... |
Other parameters to pass to the default plot function |
Value
An array of order statistics from plot_obj_val_order_statistic as a list element
Author(s)
Adam Kapelner
Plots the objective value by iteration
Description
Plots the objective value by iteration
Usage
plot_obj_val_by_iter(res, runs = NULL)
Arguments
res |
Results from a greedy search object |
runs |
A vector of run indices you would like to see plotted (default is to plot the first up to 9) |
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(20), nrow = 10)
ged = initGreedyExperimentalDesignObject(
X,
max_designs = 5,
num_cores = 1,
diagnostics = TRUE,
objective = "abs_sum_diff",
start = TRUE,
wait = TRUE,
verbose = FALSE
)
res = resultsGreedySearch(ged, max_vectors = 2)
plot_obj_val_by_iter(res)
## End(Not run)
Plots an order statistic of the object value as a function of number of searches
Description
Plots an order statistic of the object value as a function of number of searches
Usage
plot_obj_val_order_statistic(
obj,
order_stat = 1,
skip_every = 5,
type = "o",
...
)
Arguments
obj |
The greedy search object object whose search history is to be visualized |
order_stat |
The order statistic that you wish to plot. The default is |
skip_every |
Plot every nth point. This makes the plot generate much more quickly. The default is |
type |
The type parameter for plot. |
... |
Other arguments to be passed to the plot function. |
Value
An array of order statistics as a list element
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(20), nrow = 10)
ged = initGreedyExperimentalDesignObject(
X,
max_designs = 5,
num_cores = 1,
objective = "abs_sum_diff",
start = TRUE,
wait = TRUE,
verbose = FALSE
)
plot_obj_val_order_statistic(ged, order_stat = 1, skip_every = 1)
## End(Not run)
Prints a summary of a binary_match_structure object
Description
Prints a summary of a binary_match_structure object
Usage
## S3 method for class 'binary_match_structure'
print(x, ...)
Arguments
x |
The |
... |
Other parameters to pass to the default print function |
Author(s)
Adam Kapelner
Prints a summary of a binary_then_greedy_experimental_design object
Description
Prints a summary of a binary_then_greedy_experimental_design object
Usage
## S3 method for class 'binary_then_greedy_experimental_design'
print(x, ...)
Arguments
x |
The |
... |
Other parameters to pass to the default print function |
Author(s)
Adam Kapelner
Prints a summary of a binary_then_rerandomization_experimental_design object
Description
Prints a summary of a binary_then_rerandomization_experimental_design object
Usage
## S3 method for class 'binary_then_rerandomization_experimental_design'
print(x, ...)
Arguments
x |
The |
... |
Other parameters to pass to the default print function |
Author(s)
Adam Kapelner
Prints a summary of a greedy_experimental_design_search object
Description
Prints a summary of a greedy_experimental_design_search object
Usage
## S3 method for class 'greedy_experimental_design_search'
print(x, ...)
Arguments
x |
The |
... |
Other parameters to pass to the default print function |
Author(s)
Adam Kapelner
Prints a summary of a greedy_multiple_kernel_experimental_design object
Description
Prints a summary of a greedy_multiple_kernel_experimental_design object
Usage
## S3 method for class 'greedy_multiple_kernel_experimental_design'
print(x, ...)
Arguments
x |
The |
... |
Other parameters to pass to the default print function |
Author(s)
Adam Kapelner
Prints a summary of a karp_experimental_design_search object
Description
Prints a summary of a karp_experimental_design_search object
Usage
## S3 method for class 'karp_experimental_design_search'
print(x, ...)
Arguments
x |
The |
... |
Other parameters to pass to the default print function |
Author(s)
Adam Kapelner
Prints a summary of a optimal_experimental_design_search object
Description
Prints a summary of a optimal_experimental_design_search object
Usage
## S3 method for class 'optimal_experimental_design_search'
print(x, ...)
Arguments
x |
The |
... |
Other parameters to pass to the default print function |
Author(s)
Adam Kapelner
Prints a summary of a pairwise_matching_experimental_design_search object
Description
Prints a summary of a pairwise_matching_experimental_design_search object
Usage
## S3 method for class 'pairwise_matching_experimental_design_search'
print(x, ...)
Arguments
x |
The |
... |
Other parameters to pass to the default print function |
Author(s)
Adam Kapelner
Prints a summary of a rerandomization_experimental_design_search object
Description
Prints a summary of a rerandomization_experimental_design_search object
Usage
## S3 method for class 'rerandomization_experimental_design_search'
print(x, ...)
Arguments
x |
The |
... |
Other parameters to pass to the default print function |
Author(s)
Adam Kapelner
Binary Pair Match Search
Description
Returns the results (thus far) of the binary pair match design search
Usage
resultsBinaryMatchSearch(obj, form = "one_zero")
Arguments
obj |
The |
form |
Which form should the assignments be in? The default is |
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(16), nrow = 8)
bms = computeBinaryMatchStructure(X)
bm = initBinaryMatchExperimentalDesignSearchObject(
bms,
max_designs = 4,
num_cores = 1,
start = TRUE,
wait = TRUE,
seed = 1,
verbose = FALSE
)
res = resultsBinaryMatchSearch(bm, form = "one_zero")
dim(res)
## End(Not run)
Returns unique allocation vectors that are binary matched
Description
Returns unique allocation vectors that are binary matched
Usage
resultsBinaryMatchThenGreedySearch(
obj,
num_vectors = NULL,
compute_obj_vals = FALSE,
form = "one_zero",
use_safe_inverse = FALSE
)
Arguments
obj |
The |
num_vectors |
How many random allocation vectors you wish to return. The default is |
compute_obj_vals |
Should we compute all the objective values for each allocation? Default is |
form |
Which form should it be in? The default is |
use_safe_inverse |
Should a regularized inverse be used for the Mahalanobis objective?
Default is |
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(16), nrow = 8)
obj = initBinaryMatchFollowedByGreedyExperimentalDesignSearchObject(
X,
max_designs = 4,
num_cores = 1,
objective = "abs_sum_diff",
start = TRUE,
wait = TRUE,
verbose = FALSE
)
res = resultsBinaryMatchThenGreedySearch(obj, num_vectors = 3, form = "one_zero")
dim(res$indicTs)
## End(Not run)
Returns unique allocation vectors that are binary matched
Description
Returns unique allocation vectors that are binary matched
Usage
resultsBinaryMatchThenRerandomizationSearch(
obj,
num_vectors = NULL,
compute_obj_vals = FALSE,
form = "one_zero",
use_safe_inverse = FALSE
)
Arguments
obj |
The |
num_vectors |
How many random allocation vectors you wish to return. The default is |
compute_obj_vals |
Should we compute all the objective values for each allocation? Default is |
form |
Which form should it be in? The default is |
use_safe_inverse |
Should a regularized inverse be used for the Mahalanobis objective?
Default is |
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(16), nrow = 8)
obj = initBinaryMatchFollowedByRerandomizationDesignSearchObject(
X,
max_designs = 4,
num_cores = 1,
objective = "abs_sum_diff",
obj_val_cutoff_to_include = Inf,
start = TRUE,
wait = TRUE,
verbose = FALSE
)
res = resultsBinaryMatchThenRerandomizationSearch(obj, num_vectors = 3, form = "one_zero")
dim(res$indicTs)
## End(Not run)
Returns the results (thus far) of the greedy design search
Description
Returns the results (thus far) of the greedy design search
Usage
resultsGreedySearch(obj, max_vectors = 9, form = "one_zero")
Arguments
obj |
The |
max_vectors |
The number of design vectors you wish to return. |
form |
Which form should it be in? The default is |
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(20), nrow = 10)
ged = initGreedyExperimentalDesignObject(
X,
max_designs = 5,
num_cores = 1,
objective = "abs_sum_diff",
start = TRUE,
wait = TRUE,
verbose = FALSE
)
res = resultsGreedySearch(ged, max_vectors = 2)
res$obj_vals
## End(Not run)
Query the Gurobi Results
Description
Returns the results (thus far) of the Gurobi numerical optimization design search
Usage
resultsGurobiNumericalOptimizeSearch(obj)
Arguments
obj |
The |
Author(s)
Adam Kapelner
Examples
## Not run:
if ("gurobi" %in% loadedNamespaces()) {
set.seed(1)
X = matrix(rnorm(12), nrow = 6)
gobj = initGurobiNumericalOptimizationExperimentalDesignObject(
X,
r = 2,
num_cores = 1,
initial_time_limit_sec = 5,
verbose = FALSE
)
res = resultsGurobiNumericalOptimizeSearch(gobj)
res$obj_vals
}
## End(Not run)
Returns the results (thus far) of the karp design search
Description
Returns the results (thus far) of the karp design search
Usage
resultsKarpSearch(obj)
Arguments
obj |
The |
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(10), nrow = 10)
kobj = initKarpExperimentalDesignObject(
X,
start = TRUE,
wait = TRUE,
balanced = TRUE,
verbose = FALSE
)
res = resultsKarpSearch(kobj)
res$obj_val
## End(Not run)
Returns the results (thus far) of the greedy design search for multiple kernels
Description
Returns the results (thus far) of the greedy design search for multiple kernels
Usage
resultsMultipleKernelGreedySearch(obj, max_vectors = 9, form = "one_zero")
Arguments
obj |
The |
max_vectors |
The number of design vectors you wish to return. |
form |
Which form should it be in? The default is |
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(20), nrow = 10)
mk = initGreedyMultipleKernelExperimentalDesignObject(
X,
max_designs = 4,
kernel_pre_num_designs = 4,
num_cores = 1,
kernel_names = c("mahalanobis", "gaussian"),
start = TRUE,
wait = TRUE,
verbose = FALSE
)
res = resultsMultipleKernelGreedySearch(mk, max_vectors = 2, form = "one_zero")
res$obj_vals
## End(Not run)
Returns the results (thus far) of the optimal design search
Description
Returns the results (thus far) of the optimal design search
Usage
resultsOptimalSearch(obj, num_vectors = 2, form = "one_zero")
Arguments
obj |
The |
num_vectors |
How many allocation vectors you wish to return. The default is 1 meaning the best vector. If |
form |
Which form should it be in? The default is |
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(12), nrow = 6)
obj = initOptimalExperimentalDesignObject(
X,
objective = "abs_sum_diff",
num_cores = 1,
start = TRUE,
wait = TRUE,
verbose = FALSE
)
res = resultsOptimalSearch(obj, num_vectors = 2, form = "one_zero")
res$opt_obj_val
## End(Not run)
Returns the results (thus far) of the rerandomization design search
Description
Returns the results (thus far) of the rerandomization design search
Usage
resultsRerandomizationSearch(
obj,
include_assignments = FALSE,
form = "one_zero"
)
Arguments
obj |
The |
include_assignments |
Do we include the assignments (takes time) and default is |
form |
Which form should the assignments be in? The default is |
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(20), nrow = 10)
obj = initRerandomizationExperimentalDesignObject(
X,
max_designs = 5,
num_cores = 1,
objective = "abs_sum_diff",
obj_val_cutoff_to_include = Inf,
start = TRUE,
wait = TRUE,
verbose = FALSE
)
res = resultsRerandomizationSearch(obj, include_assignments = TRUE, form = "one_zero")
dim(res$ending_indicTs)
## End(Not run)
Computes a numerically stable inverse of a covariance matrix
Description
Computes a numerically stable inverse of a covariance matrix
Usage
safe_cov_inverse(X, ridge = 1e-08, max_ridge_steps = 6)
Arguments
X |
The n x p design matrix |
ridge |
Initial ridge penalty added to the diagonal |
max_ridge_steps |
Maximum number of ridge escalation attempts |
Value
The inverse covariance matrix
Author(s)
Adam Kapelner
Examples
## Not run:
X = matrix(rnorm(20), nrow = 10)
Sinv = safe_cov_inverse(X)
dim(Sinv)
## End(Not run)
Returns the amount of time elapsed
Description
Returns the amount of time elapsed
Usage
searchTimeElapsed(obj)
Arguments
obj |
The |
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(20), nrow = 10)
ged = initGreedyExperimentalDesignObject(
X,
max_designs = 1,
num_cores = 1,
start = TRUE,
wait = TRUE,
objective = "abs_sum_diff",
verbose = FALSE
)
searchTimeElapsed(ged)
## End(Not run)
Shuffles a vector rapidly
Description
Shuffles a vector rapidly
Usage
shuffle_cpp_wrap(w, seed = NA_integer_)
Arguments
w |
The vector to be shuffled |
seed |
Optional integer seed; use NA to draw from the system clock |
Value
The vector with elements shuffled
Author(s)
Adam Kapelner
Examples
## Not run:
shuffle_cpp_wrap(1:5, seed = 1)
## End(Not run)
Standardizes the columns of a data matrix.
Description
Standardizes the columns of a data matrix.
Usage
standardize_data_matrix(X)
Arguments
X |
The n x p design matrix |
Value
The n x p design matrix with columns standardized
Author(s)
Adam Kapelner
Examples
## Not run:
X = matrix(rnorm(12), nrow = 6)
Xstd = standardize_data_matrix(X)
colMeans(Xstd)
## End(Not run)
Starts the parallelized greedy design search.
Description
Once begun, this function cannot be run again.
Usage
startSearch(obj)
Arguments
obj |
The |
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(20), nrow = 10)
ged = initGreedyExperimentalDesignObject(
X,
max_designs = 3,
num_cores = 1,
start = FALSE,
wait = FALSE,
objective = "abs_sum_diff",
verbose = FALSE
)
startSearch(ged)
stopSearch(ged)
## End(Not run)
Stops the parallelized greedy design search.
Description
Once stopped, it cannot be restarted.
Usage
stopSearch(obj)
Arguments
obj |
The |
Author(s)
Adam Kapelner
Examples
## Not run:
set.seed(1)
X = matrix(rnorm(20), nrow = 10)
ged = initGreedyExperimentalDesignObject(
X,
max_designs = 3,
num_cores = 1,
start = TRUE,
wait = FALSE,
objective = "abs_sum_diff",
verbose = FALSE
)
stopSearch(ged)
## End(Not run)
Prints a summary of a binary_match_structure object
Description
Prints a summary of a binary_match_structure object
Usage
## S3 method for class 'binary_match_structure'
summary(object, ...)
Arguments
object |
The |
... |
Other parameters to pass to the default summary function |
Author(s)
Adam Kapelner
Prints a summary of a binary_then_greedy_experimental_design object
Description
Prints a summary of a binary_then_greedy_experimental_design object
Usage
## S3 method for class 'binary_then_greedy_experimental_design'
summary(object, ...)
Arguments
object |
The |
... |
Other parameters to pass to the default summary function |
Author(s)
Adam Kapelner
Prints a summary of a binary_then_rerandomization_experimental_design object
Description
Prints a summary of a binary_then_rerandomization_experimental_design object
Usage
## S3 method for class 'binary_then_rerandomization_experimental_design'
summary(object, ...)
Arguments
object |
The |
... |
Other parameters to pass to the default summary function |
Author(s)
Adam Kapelner
Prints a summary of a greedy_experimental_design_search object
Description
Prints a summary of a greedy_experimental_design_search object
Usage
## S3 method for class 'greedy_experimental_design_search'
summary(object, ...)
Arguments
object |
The |
... |
Other parameters to pass to the default summary function |
Author(s)
Adam Kapelner
Prints a summary of a greedy_multiple_kernel_experimental_design object
Description
Prints a summary of a greedy_multiple_kernel_experimental_design object
Usage
## S3 method for class 'greedy_multiple_kernel_experimental_design'
summary(object, ...)
Arguments
object |
The |
... |
Other parameters to pass to the default summary function |
Author(s)
Adam Kapelner
Prints a summary of a karp_experimental_design_search object
Description
Prints a summary of a karp_experimental_design_search object
Usage
## S3 method for class 'karp_experimental_design_search'
summary(object, ...)
Arguments
object |
The |
... |
Other parameters to pass to the default summary function |
Author(s)
Adam Kapelner
Prints a summary of a optimal_experimental_design_search object
Description
Prints a summary of a optimal_experimental_design_search object
Usage
## S3 method for class 'optimal_experimental_design_search'
summary(object, ...)
Arguments
object |
The |
... |
Other parameters to pass to the default summary function |
Author(s)
Adam Kapelner
Prints a summary of a pairwise_matching_experimental_design_search object
Description
Prints a summary of a pairwise_matching_experimental_design_search object
Usage
## S3 method for class 'pairwise_matching_experimental_design_search'
summary(object, ...)
Arguments
object |
The |
... |
Other parameters to pass to the default summary function |
Author(s)
Adam Kapelner
Prints a summary of a rerandomization_experimental_design_search object
Description
Prints a summary of a rerandomization_experimental_design_search object
Usage
## S3 method for class 'rerandomization_experimental_design_search'
summary(object, ...)
Arguments
object |
The |
... |
Other parameters to pass to the default summary function |
Author(s)
Adam Kapelner