View source: R/utils-simdata-car.R
car_ps | R Documentation |
Generate Pocock-Simon minimization treatment assignments
car_ps(z, treat, ratio, imb_measure, p_bc = 0.8)
z |
The car_strata design matrix |
treat |
A vector of length k (the number of treatment arms), which labels the treatment arms being compared. |
ratio |
A vector of length k (the number of treatment arms), which indicates the allocation ratio, e.g., c(1,1,1) for equal allocation with three treatment arms. |
imb_measure |
What measure of imbalance should be minimzed during randomization – either "Range" or "SD" |
p_bc |
The biased probability, i.e., the probability of assigning each patient to the arm that minimizes the imbalance. Default is 0.8 |
treatment assignment vector
A vector of treatment assignments with labels from the ‘treat' argument, based on Pocock-Simon’s minimization.
Ting Ye Yanyao Yi
# Create car_strata variables
library(fastDummies)
library(dplyr)
x <- runif(100)
z <- cut(x, breaks=c(0, 0.25, 0.5, 0.75, 1.0))
z <- dummy_cols(z)
A <- car_ps(
z=z[, 2:5],
treat=c(0, 1, 2),
ratio=c(1, 1, 1),
imb_measure="Range"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.