J. Biomedical Science and Engineering, 2011, 4, 734-739
doi:10.4236/jbise.2011.411090 Published Online November 2011 (http://www.SciRP.org/journal/jbise/
JBiSE
).
Published Online November 2011 in SciRes. http://www.scirp.org/journal/JBiSE
Implementation of an open-source customizable minimization
program for allocation of patients to parallel groups in clinical
trials
Mahmoud Saghaei1, Sara Saghaei2
1Department of Anesthesia, Isfahan University of Medical Sciences, Isfahan, Iran;
2School of Computing Science, Simon Fraser University, Vancouver, Canada.
Email: mahmood.saghaei@gmail.com
Received 23 July 2011; revised 30 August 2011; accepted 10 October 2011.
ABSTRACT
Current minimization programs do not permit full
control over different aspects of minimization algo-
rithm such as distance or probability measures and
may not allow for unequal allocation ratios. This ar-
ticle describes the implementation of “MinimPy” an
open-source minimization program in Python pro-
gramming language, which provides full customize-
tion of minimization features. MinimPy supports na-
ive and biased coin minimization together with vari-
ous new and classic distance measures. Data syncing
is provided to facilitate minimization of multi-center
trial over the network. MinimPy can easily be modi-
fied to fit special needs of clinical trials and in par-
ticular change it to a pure web application, though it
currently supports network syncing of data in multi-
center trials using networ k repositories.
Keywords: Clinical Trial; Allocation Methods; Ran-
domization; Minimization; Unequal Group Allocation;
Biased Coin Minimization; Network Synchronization of
Data
1. INTRODUCTION
According to the last version of Consolidated Standards
of Reporting Trials (CONSORT) [1], the method of sub-
ject allocation to treatment groups in use must be clearly
stated and the details of the sequence generation must be
specified. Different methods of patients allocation have
been advocated, of which the randomization methods
have gained wide acceptance and is used in the majori-
ties of clinical trials due to its relative simplicity and
availability of software programs customizable to dif-
ferent randomization protocols [2]. Randomization meth-
ods although prevent selection bias and ensure the non-
predictability of treatment assignments, may result in
significant imbalances in patients factors specially with
smaller sample sizes [3]. Resulting imbalances may re-
duce the validity of data analysis or necessitate complex
statistical analysis to overcome the factors imbalances.
Different stratification and minimization techniques may
be used to balance levels of prognostic factors among
treatment groups. However minimization methods seem
to provide more acceptable results compared to stratify-
cation [4]. Minimization is based on techniques that
make the imbalance among patients’ factors as low as
possible and make the treatment groups more compara-
ble to one another, with respect to basal patients’ factors.
In pure minimization subject allocations are completely
deterministic and therefore may be predictable by the
research team if the next patient’s factors’ levels are
known, which in turn violates the principle of alloca-
tions’ blindness. To overcome this pitfall, some compo-
nents of randomization have been included in minimize-
tion algorithms, which reduces the chance of prediction,
by giving higher allocation probabilities to interventions
selected in favor of reducing total imbalance. Therefore
the minimization algorithm can be viewed as a dynamic
allocation method in which each allocation is influenced
by the current state of overall treatment balances.
Initial description and methods of minimization were
introduced independently by Taves [5] in 1974 and Po-
cock and Simon [6] in 1975. Subsequent investigators
presented numerous contributions to the original algo-
rithms and described different features of minimization
methods [7-10].
Unfortunately, implementation of minimization algo-
rithms necessitates some relatively difficult computa-
tional work which falls outside the skills and time limits
of a clinical researcher. The complexity increases as the
number of prognostic factors increase. In addition, prog-
nostic factors may have different weights, which increase
the computational complexity of the algorithm specially
M. Saghaei et al. / J. Biomedical Science and Engineering 4 (2011) 734-739 735
in the presence of unequal allocation ratios for different
treatment groups.
In recent years some web based software have been
developed to facilitate the allocation of patients in clini-
cal trials based on minimization methods. The first
minimization program “Minim” a free MS-DOS appli-
cation although allows some control over minimization
aspects, is a command line program; Hence its applica-
tion limited to expert users [11]. Also its source is not
available and there is no documentation of its algorithm.
“MagMin,” a Browser/Server closed source system based
on the method of Pocock and Simon, was developed as a
multi-center system which uses standard deviation as the
distance measure [12]. However, users of this programs
have limited choice over different aspects of minimiza-
tion model such as distance or probability measures. It
may also not allow for unequal allocation ratios. This
article describes the implementation of “MinimPy” an
open-source desktop minimization program written in
python programming language with complete customi-
zation of minimization features.
2. DEVELOPMENT
2.1. Allocation Probability
The first subject is allocated randomly to one of treat-
ment groups. Allocation of subsequent patients involves
hypothetical stepwise allocation of each subject to every
treatment group and computation of the imbalance score
corresponding to each allocation. Produced imbalance
scores will be compared and subject will be allocated to
the group corresponding to the least imbalance score
(preferred treatment). To include an element of ran-
domization, usually the subject is allocated to the pre-
ferred treatment with a higher probability denoted as PH,
and to other groups (non-preferred treatment) with lower
probabilities referred to as PL. Depending on the method
of minimization PH and PL may or may not be affected
by the allocation ratios (i.e. unequal group sizes). In the
simple form (naive minimization) the probabilities are
not affected by allocation ratios and the same PH is used
for all treatment groups when they are selected as the
preferred treatments. Probabilities of the non-preferred
treatments are estimated equal to one another as P
L =
(1 – PH)/(n – 1), and the allocation ratios are only used to
correct counts of factor levels during calculation of im-
balance scores. However, it sounds logical to assign
higher probabilities to treatments with higher allocation
ratios, which is the method proposed by Han and co-
workers [13], known as the biased-coin minimization. A
base PH (PHb) is used for the group with the lowest allo-
cation ratio when that group is selected as the preferred
treatment. The PH for other groups (PHi) when selected
as the preferred treatments are calculated as a function of
PH and allocation ratios (r1, r2,, rn) [13]:


1
1
11
n
k
H
iH
n
k
rk i
PP
rk b
 
b
(1)
PL for the non-preferred group, i, when group j is the
preferred treatment (Pli{j=H}) and i j is calculated as
[13]:


1
1
i
H
j
Li jHn
k
r
PP
rk j
(2)
2.2. Imbalance Score
At each round of allocation, imbalance scores are calcu-
lated as a function of current allocations after the new
case is hypothetically allocated to each treatment group.
Different distance measures including range, variance,
standard deviation have been used for calculation of im-
balance scores [6]. Marginal balance proposed by Han
and co-workers [13] tend to minimize more accurately
when treatment groups are not equal in size. For each
factor level marginal balance is calculated as a function
of the adjusted number of patients at that level for each
treatment group:

1
11
1
1
nn
ij
iji
Mn
i
aa
b
na


(3)
Other distance measures are implemented in the pro-
gram as documented previously and used widely in other
applications too. At the start of the trial user can choose
from among different methods as explained in the im-
plementation section.
2.3. Program Interface
Python [14] programming language was used to imple-
ment the model and the interface of the minimization
program. A simple model structure was defined to hold
different features of a minimization instance. These in-
clude:
Allocations: Current state of trial allocations;
Probability measure: simple probability assignment or
biased coin minimization;
Distance measure: Range, SD, variance or marginal
balance used to calculate imbalance scores;
PHb: High probability for the group with the lowest
allocation ratio when selected as the preferred treat-
ment;
Variables weight: The weight assigned to each prog-
nostic factor;
Allocation ratio: A series of integer values, one for
C
opyright © 2011 SciRes. JBiSE
M. Saghaei et al. / J. Biomedical Science and Engineering 4 (2011) 734-739
Copyright © 2011 SciRes.
736
each group, denoting the share of each group in the
total sample size.
A minimization class was implemented to integrate
different calculations of minimization algorithm. This
class uses the model structure defined above for instant-
tiation. Various features of minimization algorithm were
calculated in this class including:
JBiSE
Calculation of probability assignments: a table of high
and low probabilities were constructed as a function
of allocation ratios, taking into account the value of
PHb. Formula (1) and (2) are used for this purpose, in
the case of the biased coin minimization;
Calculation of the distance measures for the selected
minimization model;
Functions for handling tie conditions (when groups’
imbalance scores are tied).
The program uses Python’s random module to provide
randomization component of minimization model which
uses Mersenne Twister [15] as its core generator. How-
ever the user can select alternate random number gen-
erator provided by the operating system (/dev/urandom
on Unix or CryptGenRandom on Windows). Subversion
(SVN) protocol [16] with its Python binding [17] is used
for synchronization of data among trial centers using
various plain and encrypted authenticated connection
protocols (http, https, svn, svn + ssh, etc.).
3. APPLICATION
After launching MinimPy the main program window
will appear (Figure 1). This window is composed of the
following tabs:
Settings: Different aspects of trial and minimization
model are configured here.
Groups: An interface to define each group. For each
group a label and an allocation ratio is specified.
Variables: Different prognostic factors and their levels
are specified here.
Allocations: A menu driven interface for selecting
levels of different prognostic factors, to minimize the
subject into trial. A table shows all currently allocated
of the trial (Figure 2). Export and import functional-
ities are provided using plain text files with optional
subjects. A unique random numerical identifier is as-
signed to each allocated subject to facilitate blinding
export of SPSS syntax file to generate the data in
SPSS program.
Table: A frequency table displaying counts, at each level
of the prognostic factors for each group (Figure 3).
Balance: A table showing measures of group, level or
total balance for the current state of the trial (Figure 4).
There are buttons for adding and deleting groups and
variables, and their settings can be modified directly
in the displayed table. Frequency table of allocations
also can be modified and saved as a pre-load of mini-
mization at the time of initialization. This is particu-
larly useful when importing allocations between dif-
ferent minimization systems.
The program flows in two phases.
3.1. Setup Phase
In this phase different trial settings can be set. These
include trial title and description, sample size, method of
probability assignment, imbalance score, groups, vari-
ables and extra trial settings. This phase terminates when
the trial is saved or a previously saved one is loaded,
which leads to the trial lock and start of the allocation
phase. No further changes in trial settings is possible
hereafter. Depending on the nature of the trial, the pro-
gram may be used in either pure desktop mode or as a
desktop application with network synchronization of
data among trial centers. Registration with an SVN com-
patible central repository is necessary for using network
Figure 1. Main window of minimization program showing Settings tab.
M. Saghaei et al. / J. Biomedical Science and Engineering 4 (2011) 734-739 737
Figure 2. Allocations tab showing subjects allocated.
synchronization mode. There are many free and pay-
perservice SVN repositories available on the Internet.
3.2. Allocation Phase
In this phase subjects are allocated to treatment groups
using the selected minimization model. No aspects of
trial settings can be changed in this phase except for the
title, the description and the extra properties. Last allo-
cated patient can be deallocated if any error happened in
setting factor levels. If no patient is allocated, trial can
be unlocked and returned to setup phase. To facilitate
close examination of the minimization results produced
by MinimPy, an optional research mode can be enabled
to provided mass production and minimization of simu-
lated cases.
4. DISCUSSION
Minimization methods for allocation of subjects to
treatments in a trial involves intense calculations which
are hardly carried out without the use of computer pro-
grams. Non-predictability features of novel minimization
algorithms are comparable to those seen in randomiza-
tion methods with the extra advantage of balancing dif-
ferent prognostic factors across treatment groups. So-
phisticated calculation may be used to account for con-
ditions of unequal groups. Classic minimization methods
only account for allocation ratios when calculating im-
balance score. The minimization program presented in
this article has the option of the biased coin minimize-
tion as described by Han and co-workers [13]. Computa-
tional complexities of advanced minimization algorithms
necessitates close inspection and optimization of pro-
gram code by developers with statistical background.
Open-source development provides an environment which
enables developers to examine the code and contribute to
the development of an ideal and efficient minimization
program. Using Python programming language which
has an easy to read syntax through formated code blocks,
further enhances the transparency of program logic.
MinimPy has straight forward interface functions which
make it easy for an ordinary user to use. All calculations
were performed using python programming languages
which is very strong for statistical and mathematical
application. It is an interpreted language and easy to
learn by non-technicals as well. Since the python can be
used for both desktop and web applications, MinimPy
code can easily be modified to a pure web service appli-
cation suitable for multi-center trials. However MinimPy
provides network synchronization of data as needed in a
typical multi-center clinical trial. Although MinimPy
feathers network synchronization over free or proprie-
tary repositories, the task is not easy enough to be un-
dertaken by non-technical users. Therefore usage of
MinimPy for multi-center trials necessitates the avail-
ability of technical supports for setting a public/private
repository to be used by the users of the program in dif-
ferent centers.
5. AVAILABILITY AND REQUIREMENT
5.1. Public Access
MinimPy is distributed under the GNU GPL v3, full
C
opyright © 2011 SciRes. JBiSE
M. Saghaei et al. / J. Biomedical Science and Engineering 4 (2011) 734-739
738
Figure 3. Table tab showing counts of factors levels across different groups.
Figure 4. Balance tab showing current trial balance as four different measures for
each variable, level and for the whole trial.
terms at: http://www.gnu.org/co pyleft/gpl.html Latest
stable version can be downloaded from sourceforge at:
http://minimpy.sourceforge.net The latest developmental
version can be checked out from the code repository as:
svn export https://minimpy.svn.sourceforge.net/svnroo t/
minimpy minimpy or downloaded as: http:// minimpy.
svn.sourceforge.net/v iewvc/minimpy/?v iew=tar
5.2. Programing Language
Python 2.6 or 2.7 (http://python.org/download/) Higher
versions are not compatible with PyGTK. PyGTK 2.x.
The version must be matched against the installed py-
thon version.
5.3. Other Requirements
Windows users need to install GTK+ libraries and GTK
binding for python.as listed below:
GTK+: http://www.gtk.org/index.php
PyGTK 2.x: http://www.pygtk.org/
PyCairo: http://ftp.gnome.org/pub/GNOME/binaries/
win32/pycairo/
PyGObject: http://ftp.gnome.org/pub/GNOME/binaries/
win32/pygo bject/
Subversion http://subversion.tigris.org/
PySVN, Python binding for subversion http://pysvn.
tigris.org/
To facilitate the installation of these requirements for
Windows users it is recommended to install python 2.7
(http://python.org/ftp/python/2.7.1/python-2.7.1.msi) first,
and then the so called all-in-one package for PyGTK and
the related libraries. The latter can be downloaded from:
http://ftp.gno me.org/pub/GNOME/binaries/win3 2/pygtk/
C
opyright © 2011 SciRes. JBiSE
M. Saghaei et al. / J. Biomedical Science and Engineering 4 (2011) 734-739 739
2.22/pygtk-all-in-one-2.22.5.win32-py2.7.msi
Finally download and install SVN and PySVN which
is needed for network synchronization of data. Under
Windows and MAC OS X, installation of PySVN will
install SVN too, so users of these operating systems do
not need separate SVN package installation.
Generally Linux users do not need these libraries and
bindings, because they are already included in most
Linux distributions. For other platforms please consult
the related documentation regarding downloading, in-
stallation and running of python and GTK application.
After installation of these requirements (Windows) sim-
ply download MinimPy as a compressed file and extract
it in you hard drive. Under windows you can run the
application by double clicking the “minimpy.pyw” file in
the extracted folder. You can make a desktop shortcut for
this file for convenience.
REFERENCES
[1] Schulz, K.F., Altman, D.G. and Moher, D. (2010) CON-
SORT 2010 Statement: Updated guidelines for reporting
parallel group randomized trials. Annals of Internal
Medicine, 152, 1-8.
[2] Directory of randomization software and service. (2011).
http://www-users.york.ac.uk/~mb55/guide/randsery.htm.
[3] Lachin, J.M. (1988) Statistical properties of randomiza-
tion in clinical trials. Controlled Clinical Trials, 9, 289-
311. doi:10.1016/0197-2456(88)90045-1
[4] Kernan, W.N., Viscoli, C.M., Makuch, R.W., Brass, L.M.
and Horwitz, R.I. (1999) Stratified randomization for
clinical trials. Journal of Clinical Epidemiology, 52, 19-
26. doi:10.1016/S0895-4356(98)00138-3
[5] Taves, D.R. (1974) Minimization: A new method of as-
signing patients to treatment and control groups. Clinical
Pharmacology & Therapeutics , 15, 443-453.
[6] Pocock, S.J. and Simon, R. (1975) Sequential treatment
assignment with balancing for prognostic factors in the
controlled clinical trial. Biometrics, 31, 103-115.
doi:10.2307/2529712
[7] Scott, N.W., McPherson, G.C., Ramsay, C.R., Campbell
MK. (2002) The method of minimization for allocation
to clinical trials: A review. Controlled Clinical Trials, 23,
662-674. doi:10.1016/S0197-2456(02)00242-8
[8] McEntegart, D.J. (2003) The pursuit of balance using
stratified and dynamic randomization techniques: An
overview. Drug Information Journal, 37, 293-308.
[9] Halpern, J. and Brown, B.W.Jr. (1986) Sequential treat-
ment allocation procedures in clinical trials with particu-
lar attention to the analysis of results for the biased coin
design. Statistics in Medicine, 5, 211-229.
doi:10.1002/sim.4780050303
[10] Lachin, J.M., Matts, J.P. and Wei, L.J. (1988) Randomi-
zation in clinical trials: Conclusions and recommenda-
tions. Controlled Clinical Trials, 9, 365-374.
doi:10.1016/0197-2456(88)90049-9
[11] Minim: Allocation by minimisation in clinical trials,
2004.
http://www-users.york.ac.uk/~mb55/guide/minim.htm.
[12] Cai, H.W., Xia, J.L., Gao, D.H. and Cao, X.M. (2010)
Implementation and experience of a web-based alloca-
tion system with Pocock and Simon’s minimization me-
thods. Contemporary Clinical Trials, Vol. 31, No. 6, 2010,
pp. 510-513. doi:10.1016/j.cct.2010.07.009
[13] Han, B., Enas, N.H. and McEntegart, D.J. (2009) Ran-
domization by minimization for unbalanced treatment
allocation. Statistics in Medicine, 28, 3329-3346.
doi:10.1002/sim.3710
[14] Python Programming Language Official Website. (2011).
http://www.python.org/.
[15] Matsumoto, M. and Nishimura, T. (1998) Mersenne
twister: A 623-dimensionally equidistributed uniform
pseudo- random number generator. ACM Transactions on
Modeling and Computer Simulation, 8, 3-30.
doi:10.1145/272991.272995
[16] Subversion.tigris.org. (2011).
http://subversion.tigris.org/
[17] Pysvn.tigris.org. (2011). http://pysvn.tigris.org/
Abbreviations and Acronyms
PH = preferred treatment;
PL = non-preferred treatment;
PHb = base PH used for the group with the lowest alloca-
tion ratio as the preferred treatment;
PHi = PH for groups with higher allocation ratios as the
preferred treatment;
r1, r2,, rn = Allocation ratios for groups 1 to n;
bM = Marginal balance;
ai = adjusted number of patients present in a factor level
for each treatment group.
C
opyright © 2011 SciRes. JBiSE