Skip to contents

alloc.simple independently randomises each unit to a group (i.e., flips a coin for each unit) so that the observed allocation probabilities may be far from the target ones. This strategy is often considered to be a poor choice.

Usage

alloc.simple(m, prob)

Arguments

m

the 'BATSS' ingredient 'm', a scalar corresponding to the number of participants to be allocated.

prob

the 'BATSS' ingredient 'prob', a named vector of allocation ratios or probabilities.

Value

alloc.simple returns an object of class factor of length 'm' with levels matching the names of the vector 'prob'.

See also

alloc.balanced(), another group allocation function.

Examples

alloc.simple(100, prob = c(A=.4,B=.6))
#>   [1] B A A B B B B B A A A B B B B B B B B A B A A B A A B B A A B B B A B B A
#>  [38] A B B A B A A B A A A A B B B B B B A B A B B A B B B B B A B B B B B B B
#>  [75] B B B B A B B A B B B A B B A B A B B A A B B A B B
#> Levels: A B
table(alloc.simple(100, prob = c(A=.4,B=.6)))
#> 
#>  A  B 
#> 50 50 
table(alloc.simple(100, prob = c(A=.4,B=.6)))
#> 
#>  A  B 
#> 46 54