Operational characteristics
Several measures of imbalance and randomness have been implemented in the package:
Measures of imbalance
Let us consider the following quantity as a measure of imbalance:
\[D(j) = N_E(j)-N_C(j), \: \text{for two-arm trial and 1:1 randomization}, \: j = 1, 2, \ldots, n;\]
and
\[D(j) = \sqrt{\sum\limits_{k=1}^K \left(N_k(j)-j\rho_k\right)^2}, \: \text{otherwise}, \: j = 1, 2, \ldots, n,\]
where the latter is the Euclidean distance between the observed and the targeted allocation.
The following measures of imbalance are available in the package.
Final imbalance
$D(n)$ – final imbalance/distance (between the observed and targeted sample sizes) after all treatment assignments made.
Incertus.calc_final_imb
— MethodFunction calculates final imbalance
Call
calc_final_imb(sr)
Arguments
sr::SimulatedRandomization
: an instance ofSimulatedRandomization
, an object, representing simulation output.
Result
- A
Vector
of final imbalance values obtained via simulations.
Incertus.calc_final_imb
— MethodFunction calculates final imbalance
Call
calc_final_imb(sr)
Arguments
sr::Vector{SimulatedRandomization}
: a vector of instances ofSimulatedRandomization
, representing simulation output.
Result
- A
DataFrame
of simulated final imbalances' values obtained via simulations.
Expected absolute imbalance
$\mathbf{E}\left[|D(j)|\right]$ – expected absolute imbalance/distance (between the observed and targeted sample sizes) at the $j^\text{th}$ allocation step.
Incertus.calc_expected_abs_imb
— MethodFunction calculates expected absolute imbalance vs. allocation step.
Call
calc_expected_abs_imb(sr)
Arguments
sr::SimulatedRandomization
: an instance ofSimulatedRandomization
, an object, representing simulation output.
Result
- A
Vector
of expected absolute imbalance values summarized via simulations.
Incertus.calc_expected_abs_imb
— MethodFunction calculates expected absolute imbalance vs. allocation step.
Call
calc_expected_abs_imb(sr)
Arguments
sr::Vector{SimulatedRandomization}
: a vector of instances ofSimulatedRandomization
, representing simulation output.
Result
- A
DataFrame
of expected absolute imbalances' values summarized via simulations.
Variance of imbalance
$\mathbf{E}\left[|D(j)|^2\right]=\mathbf{var}\left[N_E(j)-N_C(j)\right]$ or $=\sum_{k=1}^K\mathbf{var}\left[N_k(j)\right]$ – variance of imbalance/total variance of the treatment sample sizes at the $j^\text{th}$ allocation step.
Incertus.calc_variance_of_imb
— MethodFunction calculates variance of imbalance vs. allocation step.
Call
calc_variance_of_imb(sr)
Arguments
sr::SimulatedRandomization
: an instance ofSimulatedRandomization
, an object, representing simulation output.
Result
- A
Vector
of variance of imbalance values summarized via simulations.
Incertus.calc_variance_of_imb
— MethodFunction calculates variance of imbalance vs. allocation step.
Call
calc_variance_of_imb(sr)
Arguments
sr::Vector{SimulatedRandomization}
: a vector of instances ofSimulatedRandomization
, representing simulation output.
Result
- A
DataFrame
of variances' of imbalance values summarized via simulations.
Expected maximum imbalance over first allocation steps
$\mathbf{E}\left[\max\limits_{1\leq m \leq j}|D(m)|\right]$ – expected maximum imbalance/distance (between the observed and the targeted treatment sample sizes) over the first $j$ allocation steps.
Incertus.calc_expected_max_abs_imb
— MethodFunction calculates expected maximum absolute imbalance over first allocations vs. allocation step.
Call
calc_expected_max_abs_imb(sr)
Arguments
sr::SimulatedRandomization
: an instance ofSimulatedRandomization
, an object, representing simulation output.
Result
- A
Vector
of expected maximum absolute imbalance over firat allocations values summarized via simulations.
Incertus.calc_expected_max_abs_imb
— MethodFunction calculates expected maximum absolute imbalance over first allocations vs. allocation step.
Call
calc_expected_max_abs_imb(sr)
Arguments
sr::Vector{SimulatedRandomization}
: a vector of instances ofSimulatedRandomization
, representing simulation output.
Result
- A
DataFrame
of expected maximum absolute imbalances' values (over first allocations) summarized via simulations.
A cumulative average loss over the first allocation steps
$Imb(j) = \frac{1}{j}\sum\limits_{m=1}^j\frac{\mathbf{E}\left[|D(m)|^2\right]}{m}$ – a cumulative average loss at the $j^\text{th}$ allocation step.
Incertus.calc_cummean_loss
— MethodFunction calculates cumulative average loss vs. allocation step.
Call
calc_cummean_loss(sr)
Arguments
sr::SimulatedRandomization
: an instance ofSimulatedRandomization
, an object, representing simulation output.
Result
- A
Vector
of cumulative average loss' values summarized via simulations.
Incertus.calc_cummean_loss
— MethodFunction calculates cumulative average loss vs. allocation step.
Call
calc_cummean_loss(sr)
Arguments
sr::Vector{SimulatedRandomization}
: a vector of instances ofSimulatedRandomization
, representing simulation output.
Result
- A
DataFrame
of cumulative average losses' values summarized via simulations.
Measures of randomness
Cumulative average of expected proportions of correct guesses over first allocation steps under two different guessing strategies
$EPCG_{conv}(j)$ – cumulative average of expected proportions of correct guesses over first ($j$) allocation steps under the convergence guessing strategy.
- For a two-arm trial with $1:1$ target allocation, it is defined as
\[\begin{aligned} EPCG_{conv}(j) &= \frac{1}{j}\sum\limits_{m=1}^j\mathbf{E}\left[G_m = \delta_m\right], \: j = 1, 2, \ldots, n, \\ \text{where }G_m &= \left\{ \begin{array}{rl} 1, & D(m-1) < 0; \\ \sim Bernoulli(0.5), & D(m-1) = 0; \\ 0, & D(m-1) > 0. \end{array} \right. \end{aligned} \]
- For a multu-arm trial, it is defined as
\[\begin{aligned} EPCG_{conv}(j) &= \frac{1}{j}\sum\limits_{m=1}^j\mathbf{E}\left[\mathbf{G}_m = \boldsymbol{\delta}_m\right], \: j = 1, 2, \ldots, n, \\ \text{where }G_m &\sim Multinomial\left(1, \mathbf{P}\right), \\ \text{where }\mathbf{P} &= \left(\frac{\left\{\Delta_1 = \min\limits_{1\leq i \leq K}\Delta_i\right\}}{\sum_{k=1}^K\left\{\Delta_k = \min\limits_{1\leq i \leq K}\Delta_i\right\}}, \ldots, \frac{\left\{\Delta_K = \min\limits_{1\leq i \leq K}\Delta_i\right\}}{\sum_{k=1}^K\left\{\Delta_k = \min\limits_{1\leq i \leq K}\Delta_i\right\}}\right), \\ \text{where }\Delta_i &= \frac{N_i(m)}{m}-\rho_i, \: i = 1, 2, \ldots, K. \end{aligned} \]
$G_m$ (or $\mathbf{G}_m$) is a random variable taking values based on the investigator's guess; if $G_m = \delta_m$ ($\mathbf{G}_m = \boldsymbol{\delta_m}$), the guess is correct at the $m^\text{th}$ allocation step.
$EPCG_{max}(j)$ – cumulative average of expected proportions of correct guesses over first ($j$) allocation steps under the maximum probability guessing strategy.
- For a two-arm trial with $1:1$ target allocation, it is defined as
\[\begin{aligned} EPCG_{max}(j) &= \frac{1}{j}\sum\limits_{m=1}^j\mathbf{E}\left[\widetilde{G}_m = \delta_m\right], \\ \text{where }\widetilde{G}_m &= \left\{ \begin{array}{rl} 1, & \phi_m > 0.5; \\ \sim Bernoulli(0.5), & \phi_m = 0.5; \\ 0, & \phi_m < 0.5. \end{array} \right. \end{aligned}\]
- For a multu-arm trial, it is defined as
\[\begin{aligned} EPCG_{max}(j) &= \frac{1}{j}\sum\limits_{m=1}^j\mathbf{E}\left[\widetilde{\mathbf{G}}_m = \boldsymbol{\delta}_m\right], \: j = 1, 2, \ldots, n, \\ \text{where }G_m &\sim Multinomial\left(1, \mathbf{P}\right), \\ \text{where }\mathbf{P} &= \left(\frac{\left\{P_1(m) = \max\limits_{1\leq i \leq K}P_i(m)\right\}}{\sum_{k=1}^K\left\{P_k(m) = \max\limits_{1\leq i \leq K}P_k(m)\right\}}, \ldots, \frac{\left\{P_K(m) = \max\limits_{1\leq i \leq K}P_i(m)\right\}}{\sum_{k=1}^K\left\{P_k(m) = \max\limits_{1\leq i \leq K}P_i(m)\right\}}\right). \end{aligned} \]
$\widetilde{G}_m$ (or $\widetilde{\mathbf{G}}_m$) is a random variable taking values based on the investigator's guess; if $\widetilde{G}_m = \delta_m$ ($\widetilde{\mathbf{G}}_m = \boldsymbol{\delta_m}$), the guess is correct at the $m^\text{th}$ allocation step.
Incertus.calc_cummean_epcg
— MethodFunction calculates cumulative averages of expected proportions of correct guesses vs. allocation step.
Call
calc_cummean_epcg(sr, gs)
Arguments
sr::SimulatedRandomization
: an instance ofSimulatedRandomization
, an object, representing simulation output.gs::String
: guessing strategy; accepts two values:"C"
(corresponds to the convergence guessing strategy) of"MP"
(corresponds to the maximum probability guessing strategy).
Result
- A
Vector
of cumulative averages of the expected proportions of correct guesses summarized via simulations.
Incertus.calc_cummean_epcg
— MethodFunction calculates cumulative averages of expected proportions of correct guesses vs. allocation step.
Call
calc_cummean_epcg(sr, gs)
Arguments
sr::Vector{SimulatedRandomization}
: a vector of instances ofSimulatedRandomization
, representing simulation output.gs::String
: guessing strategy; accepts two values:"C"
(corresponds to the convergence guessing strategy) of"MP"
(corresponds to the maximum probability guessing strategy).
Result
- A vector of cumulative averages of the expected proportions of correct guesses summarized via simulations.
Cumulative average of expected proportions of deterministic assignments over first allocation steps
$PD(j)$ – cumulative average of expected proportions of deterministic assignments over first ($j$) allocation steps.
- For a two-arm trial with $1:1$ target allocation, it is defined as
\[PD(j) = \frac{1}{j}\sum\limits_{m=1}^j\Pr(\phi_m\in\{0, 1\})\]
- For a multu-arm trial, it is defined as
\[\begin{aligned} PD(j) &= \frac{1}{j}\sum\limits_{m=1}^j\Pr(\mathbf{P}(m)\in\{\mathbf{e}_1, \mathbf{e}_2, \ldots, \mathbf{e}_K\}), \\ \text{where }\mathbf{e}_k &= (0, \ldots, \underbrace{1}_{k^\text{th}\:\text{element}}, \ldots, 0), \: k = 1, 2, \ldots, K. \end{aligned}\]
Incertus.calc_cummean_pda
— MethodFunction calculates cumulative averages of the proportions of deterministic assignments vs. allocation step.
Call
calc_cummean_pda(sr)
Arguments
sr::SimulatedRandomization
: an instance ofSimulatedRandomization
, an object, representing simulation output.
Result
- A vector of the cumulative averages of the proportions of deterministic assignmnets values summarized via simulations.
Incertus.calc_cummean_pda
— MethodFunction calculates cumulative averages of the proportions of deterministic assignments vs. allocation step.
Call
calc_cummean_pda(sr)
Arguments
sr::Vector{SimulatedRandomization}
: a vector of instances ofSimulatedRandomization
, representing simulation output.
Result
- A
DataFrame
of the cumulative averages of the proportions of deterministic assignmnets summarized via simulations.
Forcing index
$FI(j)$ – forcing index, which takes values on a scale 0–1.
- For a two-arm trial with $1:1$ target allocation, it is defined as
\[FI(j) = \frac{4}{j}\sum\limits_{m=1}^j\mathbf{E}\left[|\phi_m-0.5|\right].\]
Note that $FI(j) = 0, \forall j$ for CRD and $FI(j) = 1$ for PBD with a block size $bs=2$, assuming $j$ is even (most balanced design).
- For a multu-arm trial, it is defined as
\[FI(j) = \frac{1}{j}\sum\limits_{m=1}^j\mathbf{E}\left[\sqrt{\sum\limits_{k=1}^K\left(P_k(m)-\rho_k\right)^2}\:\right].\]
Note that $FI(j) = 0, \forall j$ for CRD.
Incertus.calc_fi
— MethodFunction calculates forcing index vs. allocation step.
Call
calc_fi(sr)
Arguments
sr::SimulatedRandomization
: an instance ofSimulatedRandomization
, an object, representing simulation output.
Result
- A
Vector
of the forcing index values summarized via simulations.
Incertus.calc_fi
— MethodFunction calculates forcing index vs. allocation step.
Call
calc_fi(sr)
Arguments
sr::Vector{SimulatedRandomization}
: a vector of instances ofSimulatedRandomization
, representing simulation output.
Result
- A
DataFrame
of the forcing index values summarized via simulations.
Balance-randomness trade-off
$G(j) = \sqrt{\left\{Imb(j)\right\}^2 + \left\{FI(j)\right\}^2}$ represents a balance-randomness trade-off at the $j^\text{th}$ allocation step. Lower values of $G(j)$ indicate better balance–randomness trade-off.
The following functions are available to deal with the characteristic.
Incertus.calc_brt
— MethodFunction calculates balance-randomness trade-off vs. allocation step.
Call
calc_brt(sr)
Arguments
sr::SimulatedRandomization
: an instance ofSimulatedRandomization
, an object,
representing simulation output.
Result
- A
Vector
of balance-randomness trade-off measurement values summarized via simulations.
Incertus.calc_brt
— MethodFunction calculates balance-randomness trade-off vs. allocation step.
Call
calc_brt(sr)
Arguments
sr::Vector{SimulatedRandomization}
: a vector of instances ofSimulatedRandomization
, representing simulation output.
Result
- A
DataFrame
of balance-randomness trade-off measurements' values summarized via simulations.
Allocation ratio preserving property
A procedure has an ARP property if
\[\mathbf{E}\left[P_k(j)\right] = \rho_k, \: k = 1, 2, \ldots, K; \: j = 1, 2, \ldots, n,\]
where $P_k(j)$ is the conditional randomization probability for the $k^\text{th}$ treatment group at the $j^\text{th}$ allocation step, and $\rho_k$ is a target allocation proportion for the $k^\text{th}$ tretament.
The following functionality is avalable to evaluate ARP property:
Incertus.ARP
— TypeA data structure to deal with Allocation Ratio Preserving (ARP) property.
It has the following fields:
label::String
: a label for a randomization procedure that has been simulated.ρ::Vector{Float64}
: a vector of target allocation proportions.expected_prb::Matrix{Float64}
: expected values of $P_k(j)$ evaluated via simulations.
Incertus.eval_arp
— MethodFunction evaluates allocation ratio preserving (ARP) property, i.e., calculates unconditional allocation probabilities. A procedure has an ARP property if
Call
eval_arp(sr)
Arguments
sr::SimulatedRandomization
: an instance ofSimulatedRandomization
, an object, representing simulation output.
Result
- An instance of
ARP
type, summarizing the expected values of $P_k(j)$ via simulations.
Incertus.eval_arp
— MethodFunction evaluates allocation ratio preserving (ARP) property, i.e., calculates unconditional allocation probabilities.
Call
eval_arp(sr)
Arguments
sr::Vector{SimulatedRandomization}
: a vector of instances ofSimulatedRandomization
, representing simulation output.
Result
- A
Vector{ARP}
object – a vector of instances ofARP
, each summarizing expected values of $P_k(j)$ via simulations.