Description Usage Arguments Details Value Examples
use the Pocock-Simon or Taves algorithm for computing covariate-adaptive 'minimization' allocations for a clinical trial
1 2 | minimizePocSim(df, features, trtvec, obsdf, trttab, f = function(x, y) sum(abs(x + 1 - y)))
minimizeTaves(df, features, trtvec, obsdf, trttab)
|
df |
a data frame with columns corresponding to covariates rows corresponding to subjects |
features |
character vector of covariates to use |
trtvec |
vector of assignments made so far |
obsdf |
data frame for incoming observation, with values for
all components enumerated in |
trttab |
table of treatment ratios |
f |
score that determines impending allocation |
These functions are generally not called directly. See the vignette; if supplied as the method slot of a MinimizationDesc object the appropriate data are assembled as arguments to these functions.
a treatment code
1 2 | new("MinimizationDesc", treatments=c(A=1L, B=1L), method=minimizePocSim,
type="Minimization", featuresInUse="sex")
|
An object of class "MinimizationDesc"
Slot "method":
function (df, features, trtvec, obsdf, trttab, f = function(x,
y) sum(abs(x + 1 - y)))
{
picks = factorCounts(df, features, trtvec, obsdf)
if (length(picks) > 2)
stop("only works for two-arm studies")
if (length(picks) < 2) {
return(sample(rep(names(trttab), times = trttab), size = 1))
}
sco1 = f(picks[[1]], picks[[2]])
if (length(sco1) != 1 || !is.numeric(sco1))
stop("f must return numeric scalar")
sco2 = f(picks[[2]], picks[[1]])
ans = names(picks)
ifelse(sco1 > sco2, ans[2], ans[1])
}
<environment: namespace:randPack>
Slot "featuresInUse":
[1] "sex"
Slot "treatments":
A B
1 1
Slot "type":
[1] "Minimization"
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.