# Class "PocockSimonRandomizer"

### Description

An encapsulation of the minimization randomization detailed by Pocock and Simon (1975)

### Objects from the Class

Objects can be created by calls of the form
```
new("PocockSimonRandomizer", expt, seed, stateTable, tr.ratios,
d.func, g.func, p.func)
```

. Arguments include a ClinicalExperiment
object, a random number seed, (optionally) a state table of marginal
counts if the randomization is to begin at a particular point in time,
the ratio of treatment counts, a function to use for computing
imbalance for each treatment, a function to compute the overall
imbalance, and a function that provides the probability allocation.

### Slots

`expt`

:Object of class

`"ClinicalExperiment"`

Defines the clinical experiment context for this randomizer`seed`

:Object of class

`"integer"`

An integer used for seeding the random number generator for reproducibility`stateTable`

:Object of class

`"matrix"`

A matrix of counts indicating the marginal distribution of each factor level per treatment; see example below`tr.assignments`

:Object of class

`"data.frame"`

The treatment assignments so far`tr.ratios`

:Object of class

`"integer"`

The ratio of treatment counts, example 2:1 in a two treatment experiment`d.func`

:Object of class

`"function"`

A function that computes the imbalance; see example below`g.func`

:Object of class

`"function"`

A function that computes the overall imbalance to be minimized; see example below`p.func`

:Object of class

`"function"`

A function that computes the probability vector of treatment assignments; see example below

### Methods

- computeImbalances
`signature(object = "PocockSimonRandomizer", factor.values = "list")`

: Given a set of factor values associated with a subject, compute imbalances that occur if each of the treatments in turn is assigned to the subject- computeOverallImbalance
`signature(object = "PocockSimonRandomizer", imbalances = "matrix")`

: Given a vector of imbalances resulting from assigning each of the treatments in turn, compute the overall imbalance- initialize
`signature(.Object = "PocockSimonRandomizer")`

: Create an instance of this object- lastRandomization
`signature(object = "PocockSimonRandomizer")`

: Return the details of the last randomization that was done- randomize
`signature(object = "PocockSimonRandomizer", subject.id = "character", factor.values = "character")`

: Given a subject id and a set of factor values, randomize the subject to one of the treatments- stateTable<-
`signature(x = "PocockSimonRandomizer")`

: Set the`stateTable`

slot- tr.assignments<-
`signature(x = "PocockSimonRandomizer")`

: Set the tr.assignments

slot

### Author(s)

Balasubramanian Narasimhan

### References

This implementation is based directly on the paper
*Sequential Treatment Assigment with Balancing for Prognostic
Factors in the Controlled Clinical Trial*, by S.~J.~Pocock and
R.~Simon, Biometrics, 31, 103-115

### See Also

`ClinicalExperiment`

,
`ClinicalExperiment`

class

### Examples

1 2 3 4 5 6 7 8 9 10 | ```
showClass("PocockSimonRandomizer")
##
## Create a simple PocockSimonRandomizer class
##
expt <- ClinicalExperiment(number.of.factors = 2,
number.of.factor.levels = c(2, 2))
randomizer <- new("PocockSimonRandomizer", expt, as.integer(12345))
randomizer <- randomize(randomizer, "Subject 1", c("1", "2"))
randomizer <- randomize(randomizer, "Subject 2", c("2", "1"))
randomizer
``` |