Description Usage Arguments Value Author(s) References Examples
View source: R/design_assessment.R
Computes the mean and standard deviation of Target Absolute Standardized Mean Differences (TASMD) of multiple covariates (or transformations thereof) in a treatment group relative to a target population or a target individual for a set of assignments under one or two designs.
1 2 3 4 5 6 7 8 9 10 11 12 |
data_frame |
Data frame containing a column of unit indices (optional) and covariates (or transformations thereof). |
index_col |
if |
alloc1 |
A matrix or vector of treatment assignments. If |
alloc2 |
A (optional) matrix or vector of treatment assignment. If |
treat_lab |
Label of the treatment group in which the TASMD is computed. |
legend |
Legend of the two designs under consideration. |
mean_tar |
A (optional) vector of target profile of the covariates under consideration,
e.g., mean of the covariates in the target population. Applicable only when |
sd_tar |
A optional vector of the standard deviation of the covariates in the target population.
Applicable only when |
denom |
Specifies the denominator for the computation of TASMD. If |
roundoff |
A number indicating the number of decimal places to be used for rounding off the TASMDs. |
A list containing the following items (if alloc1
and alloc2
are matrices)
tasmd_table
: A matrix containing the means (standard deviations in parenthesis) of the TASMDs
for the designs under consideration. If alloc1
or alloc2
is a vector, the
TASMD of the corresponding assignment is returned.
tasmd_mean
: A matrix containing the means of the TASMDs for the designs under consideration.
tasmd_sd
: A matrix containing the standard deviations of the TASMDs for the designs under consideration.
If alloc1
and alloc2
are vectors, tasmd_rand
produces a data frame of the corresponding TASMDs.
Ambarish Chattopadhyay, Carl N. Morris and Jose R. Zubizarreta.
Chattopadhyay, A., Morris, C. N., and Zubizarreta, J. R. (2020), “Randomized and Balanced Allocation
of Units into Treatment Groups Using the Finite Selection Model for R
".
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # Consider the Lalonde dataset.
# Get the full sample size.
N = nrow(Lalonde)
# Get the treatment group sizes.
n1 = floor(N/2)
n2 = N-n1
# Generate an SOM.
som_obs = som(n_treat = 2, treat_sizes = c(n1,n2),include_discard = FALSE,
method = 'SCOMARS', marginal_treat = rep((n2/N),N), control = FALSE)
# Generate a treatment assignment given som_obs.
f = fsm(data_frame = Lalonde, SOM = som_obs, s_function = 'Dopt', eps = 0.0001,
ties = 'random', intercept = TRUE, standardize = TRUE, units_print = FALSE)
# Get assignment vector under the FSM.
Z_fsm_obs = f$data_frame_allocated$Treat
# Draw a random CRD.
Z_crd_obs = crd(data_frame = Lalonde, n_treat = 2, treat_sizes = c(n1, n2),
control = FALSE)$Treat
# Calculate the TASMD.
TASMD = tasmd_rand(data_frame = Lalonde, index_col = TRUE, alloc1 = Z_crd_obs,
alloc2 = Z_fsm_obs, treat_lab = 1, mean_tar = NULL, sd_tar = NULL,
denom = 'target', legend = c('CRD','FSM'), roundoff = 3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.