Title: | Greedy Experimental Design Construction |
---|---|
Description: | Computes experimental designs for a two-arm experiment with covariates via a number of methods: (0) complete randomization and randomization with forced-balance, (1) Greedily optimizing a balance objective function via pairwise switching. This optimization provides lower variance for the treatment effect estimator (and higher power) while preserving a design that is close to complete randomization. We return all iterations of the designs for use in a permutation test, (2) The second is via numerical optimization (via 'gurobi' which must be installed, see <https://www.gurobi.com/documentation/9.1/quickstart_windows/r_ins_the_r_package.html>) a la Bertsimas and Kallus, (3) rerandomization, (4) Karp's method for one covariate, (5) exhaustive enumeration to find the optimal solution (only for small sample sizes), (6) Binary pair matching using the 'nbpMatching' library, (7) Binary pair matching plus design number (1) to further optimize balance, (8) Binary pair matching plus design number (3) to further optimize balance, (9) Hadamard designs, (10) Simultaneous Multiple Kernels. In (1-9) we allow for three objective functions: Mahalanobis distance, Sum of absolute differences standardized and Kernel distances via the 'kernlab' library. This package is the result of a stream of research that can be found in Krieger, A, Azriel, D and Kapelner, A "Nearly Random Designs with Greatly Improved Balance" (2016) <arXiv:1612.02315>, Krieger, A, Azriel, D and Kapelner, A "Better Experimental Design by Hybridizing Binary Matching with Imbalance Optimization" (2021) <arXiv:2012.03330>. |
Authors: | Adam Kapelner [aut, cre] , David Azriel [aut], Abba Krieger [aut] |
Maintainer: | Adam Kapelner <[email protected]> |
License: | GPL-3 |
Version: | 1.5.6.1 |
Built: | 2024-11-25 06:30:28 UTC |
Source: | CRAN |
The automobile
data frame has 201 rows and 25 columns and
concerns automobiles in the 1985 Auto Imports Database. The response
variable, price
, is the log selling price of the automobile. There
are 7 categorical predictors and 17 continuous / integer predictors which
are features of the automobiles. 41 automobiles have missing data in one
or more of the feature entries. This dataset is true to the original except
with a few of the predictors dropped.
data(automobile)
data(automobile)
K Bache and M Lichman. UCI machine learning repository, 2013. http://archive.ics.uci.edu/ml/datasets/Automobile
For debugging, you can use set.seed
to be assured of deterministic output.
complete_randomization(n, r, form = "one_zero")
complete_randomization(n, r, form = "one_zero")
n |
number of observations |
r |
number of randomized designs you would like |
form |
Which form should it be in? The default is |
a matrix where each column is one of the r
designs
Adam Kapelner
For debugging, you can use set.seed
to be assured of deterministic output.
complete_randomization_with_forced_balanced(n, r, form = "one_zero")
complete_randomization_with_forced_balanced(n, r, form = "one_zero")
n |
number of observations |
r |
number of randomized designs you would like |
form |
Which form should it be in? The default is |
a matrix where each column is one of the r
designs
Adam Kapelner
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.
compute_gram_matrix(X, kernel_type, params = c())
compute_gram_matrix(X, kernel_type, params = c())
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 |
The n x n
gram matrix for the given kernel on the given data.
Adam Kapelner
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).
compute_objective_val(X, indic_T, objective = "abs_sum_diff", inv_cov_X = NULL)
compute_objective_val(X, indic_T, objective = "abs_sum_diff", inv_cov_X = NULL)
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. |
Adam Kapelner
Computes Randomization Metrics (explained in paper) about a design algorithm
compute_randomization_metrics(designs)
compute_randomization_metrics(designs)
designs |
A matrix where each column is one design. |
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)
Adam Kapelner
This method creates an object of type binary_match_structure and will compute pairs. You can then
use the functions initBinaryMatchExperimentalDesignSearch
and resultsBinaryMatchSearch
to create randomized allocation vectors. For one column in X, we just sort to find the pairs trivially.
computeBinaryMatchStructure( X, mahal_match = FALSE, compute_dist_matrix = NULL, D = NULL )
computeBinaryMatchStructure( X, mahal_match = FALSE, compute_dist_matrix = NULL, D = NULL )
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 |
An object of type binary_experimental_design
which can be further operated upon.
Adam Kapelner
This function is useful for debugging.
generate_stdzied_design_matrix(n = 50, p = 1, covariate_gen = rnorm, ...)
generate_stdzied_design_matrix(n = 50, p = 1, covariate_gen = rnorm, ...)
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 |
THe design matrix
Adam Kapelner
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.
greedy_orthogonalization_curation(W, Rmin = 2, verbose = FALSE)
greedy_orthogonalization_curation(W, Rmin = 2, verbose = FALSE)
W |
A matrix in $-1, 1^R x n$ which have R allocation vectors for an experiment of sample size n. |
Rmin |
The minimum number of vectors to consider in a design. The default is the true bottom, two. |
verbose |
Default is |
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.
Adam Kapelner
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.
greedy_orthogonalization_curation2(W, R0 = 100, verbose = FALSE)
greedy_orthogonalization_curation2(W, R0 = 100, verbose = FALSE)
W |
A matrix in $-1, 1^R x n$ which have R allocation vectors for an experiment of sample size n. |
R0 |
The minimum number of vectors to consider in a design. The default is the true bottom, two. |
verbose |
Default is |
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.
Adam Kapelner
A tool to find many types of a priori experimental designs
Adam Kapelner [email protected]
Kapelner, A
This method returns unique designs according to a Hadamard matrix. For debugging, you can use set.seed
to be assured of deterministic output.
hadamardExperimentalDesign(X, strict = TRUE, form = "zero_one")
hadamardExperimentalDesign(X, strict = TRUE, form = "zero_one")
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 |
An matrix of dimension $R$ x $n$ where $R$ is the number of Hadamard allocations.
Adam Kapelner
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
imbalanced_block_designs(n, prop_T, B, r, form = "one_zero")
imbalanced_block_designs(n, prop_T, B, r, form = "one_zero")
n |
number of observations |
prop_T |
the proportion of treatments needed |
B |
the number of blocks |
r |
number of randomized designs you would like |
form |
Which form should it be in? The default is |
a matrix where each column is one of the r
designs
Adam Kapelner
For debugging, you can use set.seed
to be assured of deterministic output.
imbalanced_complete_randomization(n, prop_T, r, form = "one_zero")
imbalanced_complete_randomization(n, prop_T, r, form = "one_zero")
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 |
a matrix where each column is one of the r
designs
Adam Kapelner
This method creates an object of type pairwise_matching_experimental_design_search and will immediately initiate
a search through $1_T$ 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.
initBinaryMatchExperimentalDesignSearch( binary_match_structure, max_designs = 1000, wait = FALSE, start = TRUE, num_cores = 1, seed = NULL, prop_flips = 1 )
initBinaryMatchExperimentalDesignSearch( binary_match_structure, max_designs = 1000, wait = FALSE, start = TRUE, num_cores = 1, seed = NULL, prop_flips = 1 )
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). |
Adam Kapelner
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.
initBinaryMatchFollowedByGreedyExperimentalDesignSearch( X, diff_method = FALSE, compute_dist_matrix = NULL, ... )
initBinaryMatchFollowedByGreedyExperimentalDesignSearch( X, diff_method = FALSE, compute_dist_matrix = NULL, ... )
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 |
... |
Arguments passed to |
An object of type binary_experimental_design
which can be further operated upon.
Adam Kapelner
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.
initBinaryMatchFollowedByRerandomizationDesignSearch( X, compute_dist_matrix = NULL, ... )
initBinaryMatchFollowedByRerandomizationDesignSearch( X, compute_dist_matrix = NULL, ... )
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 |
... |
Arguments passed to |
An object of type binary_experimental_design
which can be further operated upon.
Adam Kapelner
This method creates an object of type greedy_experimental_design and will immediately initiate
a search through $1_T$ space for forced balance designs. For debugging, you can use set the seed
parameter and num_cores = 1
to be assured of deterministic output.
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 )
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 )
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 |
An object of type greedy_experimental_design_search
which can be further operated upon
Adam Kapelner
## Not run: library(MASS) data(Boston) #pretend the Boston data was an experiment setting #first pull out the covariates X = Boston[, 1 : 13] #begin the greedy design search ged = initGreedyExperimentalDesignObject(X, max_designs = 1000, num_cores = 3, objective = "abs_sum_diff") #wait ged ## End(Not run)
## Not run: library(MASS) data(Boston) #pretend the Boston data was an experiment setting #first pull out the covariates X = Boston[, 1 : 13] #begin the greedy design search ged = initGreedyExperimentalDesignObject(X, max_designs = 1000, num_cores = 3, objective = "abs_sum_diff") #wait ged ## End(Not run)
This method creates an object of type greedy_multiple_kernel_experimental_design and will immediately initiate
a search through $1_T$ space for forced balance designs. For debugging, you can use set the seed
parameter and num_cores = 1
to be assured of deterministic output.
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 )
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 )
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 |
An object of type greedy_experimental_design_search
which can be further operated upon
Adam Kapelner
## Not run: library(MASS) data(Boston) #pretend the Boston data was an experiment setting #first pull out the covariates X = Boston[, 1 : 13] #begin the greedy design search ged = initGreedyMultipleKernelExperimentalDesignObject(X, max_designs = 1000, num_cores = 3, kernel_names = c("mahalanobis", "gaussian")) #wait ged ## End(Not run)
## Not run: library(MASS) data(Boston) #pretend the Boston data was an experiment setting #first pull out the covariates X = Boston[, 1 : 13] #begin the greedy design search ged = initGreedyMultipleKernelExperimentalDesignObject(X, max_designs = 1000, num_cores = 3, kernel_names = c("mahalanobis", "gaussian")) #wait ged ## End(Not run)
This method creates an object of type karp_experimental_design and will immediately initiate a search through $1_T$ space. Note that the Karp search only works for one covariate (i.e. $p=1$) and the objective "abs_sum_diff".
initKarpExperimentalDesignObject( X, wait = FALSE, balanced = TRUE, start = TRUE )
initKarpExperimentalDesignObject( X, wait = FALSE, balanced = TRUE, start = TRUE )
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 |
An object of type karp_experimental_design_search
which can be further operated upon
Adam Kapelner
This method creates an object of type optimal_experimental_design and will immediately initiate
a search through $1_T$ 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.
initOptimalExperimentalDesignObject( X = NULL, objective = "mahal_dist", Kgram = NULL, wait = FALSE, start = TRUE, num_cores = 1 )
initOptimalExperimentalDesignObject( X = NULL, objective = "mahal_dist", Kgram = NULL, wait = FALSE, start = TRUE, num_cores = 1 )
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 |
An object of type optimal_experimental_design_search
which can be further operated upon
Adam Kapelner
This method creates an object of type rerandomization_experimental_design and will immediately initiate
a search through $1_T$ space for forced-balance designs. For debugging, you can use set the seed
parameter and num_cores = 1
to be assured of deterministic output.
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 )
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 )
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 |
An object of type rerandomization_experimental_design_search
which can be further operated upon.
Adam Kapelner
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.
optimize_asymmetric_treatment_assignment( c_treatment = NULL, c_control = NULL, c_total_max = NULL, n = NULL )
optimize_asymmetric_treatment_assignment( c_treatment = NULL, c_control = NULL, c_total_max = NULL, n = NULL )
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 |
A list with three keys: n, nT, nC plus specified arguments
Adam Kapelner
## Not run: optimize_asymmetric_treatment_assignment(n = 100) #nT = nC = 50 optimize_asymmetric_treatment_assignment(n = 100, c_treatment = 2, c_control = 1) #nT = 66, nC = 34 optimize_asymmetric_treatment_assignment(c_total_max = 50, c_treatment = 2, c_control = 1) ## End(Not run)
## Not run: optimize_asymmetric_treatment_assignment(n = 100) #nT = nC = 50 optimize_asymmetric_treatment_assignment(n = 100, c_treatment = 2, c_control = 1) #nT = 66, nC = 34 optimize_asymmetric_treatment_assignment(c_total_max = 50, c_treatment = 2, c_control = 1) ## End(Not run)
Plots the objective value by iteration
plot_obj_val_by_iter(res, runs = NULL)
plot_obj_val_by_iter(res, runs = NULL)
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) |
Adam Kapelner
Plots an order statistic of the object value as a function of number of searches
plot_obj_val_order_statistic( obj, order_stat = 1, skip_every = 5, type = "o", ... )
plot_obj_val_order_statistic( obj, order_stat = 1, skip_every = 5, type = "o", ... )
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. |
An array of order statistics as a list element
Adam Kapelner
Plots a summary of a greedy search object object
## S3 method for class 'greedy_experimental_design_search' plot(x, ...)
## S3 method for class 'greedy_experimental_design_search' plot(x, ...)
x |
The greedy search object object to be summarized in the plot |
... |
Other parameters to pass to the default plot function |
An array of order statistics from plot_obj_val_order_statistic as a list element
Adam Kapelner
greedy_multiple_kernel_experimental_design
objectPlots a summary of a greedy_multiple_kernel_experimental_design
object
## S3 method for class 'greedy_multiple_kernel_experimental_design' plot(x, ...)
## S3 method for class 'greedy_multiple_kernel_experimental_design' plot(x, ...)
x |
The |
... |
Other parameters to pass to the default plot function |
An array of order statistics from plot_obj_val_order_statistic as a list element
Adam Kapelner
binary_match_structure
objectPrints a summary of a binary_match_structure
object
## S3 method for class 'binary_match_structure' print(x, ...)
## S3 method for class 'binary_match_structure' print(x, ...)
x |
The |
... |
Other parameters to pass to the default print function |
Adam Kapelner
binary_then_greedy_experimental_design
objectPrints a summary of a binary_then_greedy_experimental_design
object
## S3 method for class 'binary_then_greedy_experimental_design' print(x, ...)
## S3 method for class 'binary_then_greedy_experimental_design' print(x, ...)
x |
The |
... |
Other parameters to pass to the default print function |
Adam Kapelner
binary_then_rerandomization_experimental_design
objectPrints a summary of a binary_then_rerandomization_experimental_design
object
## S3 method for class 'binary_then_rerandomization_experimental_design' print(x, ...)
## S3 method for class 'binary_then_rerandomization_experimental_design' print(x, ...)
x |
The |
... |
Other parameters to pass to the default print function |
Adam Kapelner
greedy_experimental_design_search
objectPrints a summary of a greedy_experimental_design_search
object
## S3 method for class 'greedy_experimental_design_search' print(x, ...)
## S3 method for class 'greedy_experimental_design_search' print(x, ...)
x |
The |
... |
Other parameters to pass to the default print function |
Adam Kapelner
greedy_multiple_kernel_experimental_design
objectPrints a summary of a greedy_multiple_kernel_experimental_design
object
## S3 method for class 'greedy_multiple_kernel_experimental_design' print(x, ...)
## S3 method for class 'greedy_multiple_kernel_experimental_design' print(x, ...)
x |
The |
... |
Other parameters to pass to the default print function |
Adam Kapelner
karp_experimental_design_search
objectPrints a summary of a karp_experimental_design_search
object
## S3 method for class 'karp_experimental_design_search' print(x, ...)
## S3 method for class 'karp_experimental_design_search' print(x, ...)
x |
The |
... |
Other parameters to pass to the default print function |
Adam Kapelner
optimal_experimental_design_search
objectPrints a summary of a optimal_experimental_design_search
object
## S3 method for class 'optimal_experimental_design_search' print(x, ...)
## S3 method for class 'optimal_experimental_design_search' print(x, ...)
x |
The |
... |
Other parameters to pass to the default print function |
Adam Kapelner
pairwise_matching_experimental_design_search
objectPrints a summary of a pairwise_matching_experimental_design_search
object
## S3 method for class 'pairwise_matching_experimental_design_search' print(x, ...)
## S3 method for class 'pairwise_matching_experimental_design_search' print(x, ...)
x |
The |
... |
Other parameters to pass to the default print function |
Adam Kapelner
rerandomization_experimental_design_search
objectPrints a summary of a rerandomization_experimental_design_search
object
## S3 method for class 'rerandomization_experimental_design_search' print(x, ...)
## S3 method for class 'rerandomization_experimental_design_search' print(x, ...)
x |
The |
... |
Other parameters to pass to the default print function |
Adam Kapelner
Returns the results (thus far) of the binary pair match design search
resultsBinaryMatchSearch(obj, form = "one_zero")
resultsBinaryMatchSearch(obj, form = "one_zero")
obj |
The |
form |
Which form should the assignments be in? The default is |
Adam Kapelner
Returns unique allocation vectors that are binary matched
resultsBinaryMatchThenGreedySearch( obj, num_vectors = NULL, compute_obj_vals = FALSE, form = "zero_one" )
resultsBinaryMatchThenGreedySearch( obj, num_vectors = NULL, compute_obj_vals = FALSE, form = "zero_one" )
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 |
Adam Kapelner
Returns unique allocation vectors that are binary matched
resultsBinaryMatchThenRerandomizationSearch( obj, num_vectors = NULL, compute_obj_vals = FALSE, form = "zero_one" )
resultsBinaryMatchThenRerandomizationSearch( obj, num_vectors = NULL, compute_obj_vals = FALSE, form = "zero_one" )
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 |
Adam Kapelner
Returns the results (thus far) of the greedy design search
resultsGreedySearch(obj, max_vectors = 9, form = "one_zero")
resultsGreedySearch(obj, max_vectors = 9, form = "one_zero")
obj |
The |
max_vectors |
The number of design vectors you wish to return. |
form |
Which form should it be in? The default is |
Adam Kapelner
## Not run: library(MASS) data(Boston) #pretend the Boston data was an experiment setting #first pull out the covariates X = Boston[, 1 : 13] #begin the greedy design search ged = initGreedyExperimentalDesignObject(X, max_designs = 1000, num_cores = 2, objective = "abs_sum_diff") #wait res = resultsGreedySearch(ged, max_vectors = 2) design = res$ending_indicTs[, 1] #ordered already by best-->worst design #what is the balance on this vector? res$obj_vals[1] #compute balance explicitly in R to double check compute_objective_val(X, design) #same as above #how far have we come? ged #we can cut it here stopSearch(ged) ## End(Not run)
## Not run: library(MASS) data(Boston) #pretend the Boston data was an experiment setting #first pull out the covariates X = Boston[, 1 : 13] #begin the greedy design search ged = initGreedyExperimentalDesignObject(X, max_designs = 1000, num_cores = 2, objective = "abs_sum_diff") #wait res = resultsGreedySearch(ged, max_vectors = 2) design = res$ending_indicTs[, 1] #ordered already by best-->worst design #what is the balance on this vector? res$obj_vals[1] #compute balance explicitly in R to double check compute_objective_val(X, design) #same as above #how far have we come? ged #we can cut it here stopSearch(ged) ## End(Not run)
Returns the results (thus far) of the karp design search
resultsKarpSearch(obj)
resultsKarpSearch(obj)
obj |
The |
Adam Kapelner
Returns the results (thus far) of the greedy design search for multiple kernels
resultsMultipleKernelGreedySearch(obj, max_vectors = 9, form = "one_zero")
resultsMultipleKernelGreedySearch(obj, max_vectors = 9, form = "one_zero")
obj |
The |
max_vectors |
The number of design vectors you wish to return. |
form |
Which form should it be in? The default is |
Adam Kapelner
## Not run: library(MASS) data(Boston) #pretend the Boston data was an experiment setting #first pull out the covariates X = Boston[, 1 : 13] #begin the greedy design search ged = initGreedyMultipleKernelExperimentalDesignObject(X, max_designs = 1000, num_cores = 3, kernel_names = c("mahalanobis", "gaussian")) #wait res = resultsMultipleKernelGreedySearch(ged, max_vectors = 2) design = res$ending_indicTs[, 1] #ordered already by best-->worst design #how far have we come of the 1000 we set out to do? ged #we can cut it here stopSearch(ged) ## End(Not run)
## Not run: library(MASS) data(Boston) #pretend the Boston data was an experiment setting #first pull out the covariates X = Boston[, 1 : 13] #begin the greedy design search ged = initGreedyMultipleKernelExperimentalDesignObject(X, max_designs = 1000, num_cores = 3, kernel_names = c("mahalanobis", "gaussian")) #wait res = resultsMultipleKernelGreedySearch(ged, max_vectors = 2) design = res$ending_indicTs[, 1] #ordered already by best-->worst design #how far have we come of the 1000 we set out to do? ged #we can cut it here stopSearch(ged) ## End(Not run)
Returns the results (thus far) of the optimal design search
resultsOptimalSearch(obj, num_vectors = 2, form = "one_zero")
resultsOptimalSearch(obj, num_vectors = 2, form = "one_zero")
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 |
Adam Kapelner
Returns the results (thus far) of the rerandomization design search
resultsRerandomizationSearch( obj, include_assignments = FALSE, form = "one_zero" )
resultsRerandomizationSearch( obj, include_assignments = FALSE, form = "one_zero" )
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 |
Adam Kapelner
Returns the amount of time elapsed
searchTimeElapsed(obj)
searchTimeElapsed(obj)
obj |
The |
Adam Kapelner
Standardizes the columns of a data matrix.
standardize_data_matrix(X)
standardize_data_matrix(X)
X |
The n x p design matrix |
The n x p design matrix with columns standardized
Adam Kapelner
Once begun, this function cannot be run again.
startSearch(obj)
startSearch(obj)
obj |
The |
Adam Kapelner
Once stopped, it cannot be restarted.
stopSearch(obj)
stopSearch(obj)
obj |
The |
Adam Kapelner
binary_match_structure
objectPrints a summary of a binary_match_structure
object
## S3 method for class 'binary_match_structure' summary(object, ...)
## S3 method for class 'binary_match_structure' summary(object, ...)
object |
The |
... |
Other parameters to pass to the default summary function |
Adam Kapelner
binary_then_greedy_experimental_design
objectPrints a summary of a binary_then_greedy_experimental_design
object
## S3 method for class 'binary_then_greedy_experimental_design' summary(object, ...)
## S3 method for class 'binary_then_greedy_experimental_design' summary(object, ...)
object |
The |
... |
Other parameters to pass to the default summary function |
Adam Kapelner
binary_then_rerandomization_experimental_design
objectPrints a summary of a binary_then_rerandomization_experimental_design
object
## S3 method for class 'binary_then_rerandomization_experimental_design' summary(object, ...)
## S3 method for class 'binary_then_rerandomization_experimental_design' summary(object, ...)
object |
The |
... |
Other parameters to pass to the default summary function |
Adam Kapelner
greedy_experimental_design_search
objectPrints a summary of a greedy_experimental_design_search
object
## S3 method for class 'greedy_experimental_design_search' summary(object, ...)
## S3 method for class 'greedy_experimental_design_search' summary(object, ...)
object |
The |
... |
Other parameters to pass to the default summary function |
Adam Kapelner
greedy_multiple_kernel_experimental_design
objectPrints a summary of a greedy_multiple_kernel_experimental_design
object
## S3 method for class 'greedy_multiple_kernel_experimental_design' summary(object, ...)
## S3 method for class 'greedy_multiple_kernel_experimental_design' summary(object, ...)
object |
The |
... |
Other parameters to pass to the default summary function |
Adam Kapelner
karp_experimental_design_search
objectPrints a summary of a karp_experimental_design_search
object
## S3 method for class 'karp_experimental_design_search' summary(object, ...)
## S3 method for class 'karp_experimental_design_search' summary(object, ...)
object |
The |
... |
Other parameters to pass to the default summary function |
Adam Kapelner
optimal_experimental_design_search
objectPrints a summary of a optimal_experimental_design_search
object
## S3 method for class 'optimal_experimental_design_search' summary(object, ...)
## S3 method for class 'optimal_experimental_design_search' summary(object, ...)
object |
The |
... |
Other parameters to pass to the default summary function |
Adam Kapelner
pairwise_matching_experimental_design_search
objectPrints a summary of a pairwise_matching_experimental_design_search
object
## S3 method for class 'pairwise_matching_experimental_design_search' summary(object, ...)
## S3 method for class 'pairwise_matching_experimental_design_search' summary(object, ...)
object |
The |
... |
Other parameters to pass to the default summary function |
Adam Kapelner
rerandomization_experimental_design_search
objectPrints a summary of a rerandomization_experimental_design_search
object
## S3 method for class 'rerandomization_experimental_design_search' summary(object, ...)
## S3 method for class 'rerandomization_experimental_design_search' summary(object, ...)
object |
The |
... |
Other parameters to pass to the default summary function |
Adam Kapelner