Description Usage Arguments Value Author(s) References Examples
View source: R/design_assessment.R
Generates a Love plot of Absolute Standardized Mean Differences (ASMD) or Target Absolute Standardized Differences (TASMD) between two groups under one or two designs.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
data_frame |
Data frame containing a column of unit indices (optional) and covariates (or transformations thereof). |
index_col |
if |
alloc1 |
A vector of treatment assignment. |
alloc2 |
A (optional) vector of treatment assignment. |
imbalance |
Measure of imbalance used. If |
treat_lab |
Label of the treatment group in which the TASMD is computed. Applicable only when |
vline |
A (optional) x-coordinate at which a vertical line is drawn. |
xupper |
Upper limit of the x-axis. |
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 |
legend_text |
Legend of the two designs under consideration. |
legend_position |
= Position of the legend in the plot. The default is |
Love plot of the ASMD/TASMD of the covariates.
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
".
Love, T. (2004), “Graphical display of covariate balance”, Presentation, See http://chrp.org/love/JSM2004RoundTableHandout.pdf, 1364.
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
# Draw Love plot.
love_plot(data_frame = Lalonde, index_col = TRUE, alloc1 = Z_fsm_obs, alloc2 = Z_crd_obs,
imbalance = 'TASMD', treat_lab = 1, mean_tar = NULL, sd_tar = NULL, denom = 'target',
vline = "", legend_text = c("FSM","CRD"), xupper = 0.15, legend_position = 'topright')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.