Description Usage Arguments Value Author(s) References Examples
Performs the sequential allocation for the covariate-adjusted randomization (CAR) method of allocating observations in a randomized experiment.
1 | caralloc(xmat, carwt, p, tol)
|
xmat |
matrix or data frame of covariates for prospective enrollees in the experiment. |
carwt |
vector of weights |
p |
probability the next unit should be allocated to the experiment arm that currently has fewer observations. For CAR, use 0.5 < p < 1. |
tol |
tolerance for deviation from equal allocation. For CAR, set tol to be a small value, say 0.01. For CAIM, set tol to be the imbalance tolerance (d). |
Vector with the allocation to treatment (denoted by 1) and control (denoted by 0)
Xiaoshu Zhu xiaoshuzhu@westat.com and Sharon Lohr
Lohr, S. and X. Zhu (2015). Randomized Sequential Individual Assignment in Social Experiments: Evaluating the Design Options Prospectively. Sociological Methods and Research. [Advance online publication: December 27, 2015] doi: 10.1177/0049124115621332.
Pocock, S. J. and R. Simon (1975). Sequential Treatment Assignment with Balancing for Prognostic Factors in A Controlled Clinical Trial. Biometrics 31: 103-115.
1 2 3 4 5 6 7 8 9 10 11 12 | sampsize <- 200
percent <- c(0.5,0.8,0.2,0.4)
carwt <- c(.4,.3,.2,.1)
set.seed(5798)
xmat <- matrix(rbinom(sampsize*length(percent),1,rep(percent,sampsize)),
nrow=sampsize,ncol=length(percent),byrow=TRUE)
colnames(xmat) = c("C1","C2","C3","C4")
strat_factor = xmat[,1]*4 + xmat[,2]*2 + xmat[,4] + 1
caralloc(xmat,carwt,1,3)
|
[1] 1 0 0 0 1 1 1 0 1 1 1 1 0 0 0 1 1 0 0 1 0 1 0 0 0 1 0 0 1 0 0 1 1 1 0 1 0
[38] 1 0 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 1 1 1 0 0 1 1 0 0 1 0 0 1 1 0 1 0 1 0 1
[75] 1 1 0 0 0 0 0 1 1 0 1 0 1 0 0 1 1 1 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 0 0 0 1
[112] 1 1 0 1 0 0 1 0 1 0 0 1 0 0 1 1 0 1 1 0 1 1 0 1 0 1 0 0 1 0 1 0 1 1 0 0 1
[149] 1 0 1 1 0 0 1 0 0 0 0 0 1 1 1 1 0 1 1 1 0 1 1 1 0 1 0 0 1 0 0 1 1 1 0 0 0
[186] 1 0 0 1 0 1 0 0 1 0 0 1 1 1 1
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.