EenieMeenie
Decides to which experimental group a member of a population should be assigned.
Installation
EenieMeenie is a Ruby gem, and can be installed using gem install eenie_meenie or by adding the following to your application's Gemfile:
gem 'eenie_meenie', '0.1.1'
Usage
Attention! The usage of EeenieMeenie::Assignment changed with the release of version 0.1.0. With the new algorithm you'll be able to:
- Assign a threshold (a
Floatto represent percentage) to each experimental group. - Assign a threshold of "DO NOT CARE" to any group by passing
falseinstead of aFloat - Tell EeenieMeenie which groups can be assigned by the algorithm. Any group with a threshold should be included here.
- Tell it how to scope the member class (tell it which study, if you're using one member class for all studies)
- Specify the population to be used when calculating whether a group's population threshold has been reached.
Example Configurations
eenie_meenie users can specify the population using the :members option, e.g.
EenieMeenie::Assignment.new({
member: @some_member,
members: MemberClass.where(something).joins(another),
groups: ["Experimental", "Control"],
group_rules: {
"Experimental" => { threshold: 0.51 },
"Control" => { threshold: 0.51 }
}
})
Other examples ...
# Control: Do not care (chosen manually, if ever)
# Experimental A: %50 (randomly assign)
# Experimental B: %50 (randomly assign)
EenieMeenie::Assignment.new({
groups: ["Experimental A", "Experimental B"], # EenieMeenie's assignment options
member: @obj, # Member of population
group_rules: {
"Control" => { threshold: false }, # Don't care
"Experimental A" => { threshold: 0.5 }, # No more than 50%
"Experimental B" => { threshold: 0.5 } # No more than 50%
},
class_rules: { organization_id: 1} # Only consider members belonging to Organization 1
}).execute!
# Control: %33.3 (randomly assign)
# Experimental A: %33.3 (randomly assign)
# Experimental B: %33.3 (randomly assign)
EenieMeenie::Assignment.new({
groups: ["Control", "Experimental A", "Experimental B"], # EenieMeenie's assignment options
member: @obj, # Member of population
group_rules: {
"Control" => { threshold: (1.0 / 3.0) }, # No more than one-third
"Experimental A" => { threshold: (1.0 / 3.0) }, # No more than one-third
"Experimental B" => { threshold: (1.0 / 3.0) } # No more than one-third
},
class_rules: { organization_id: 1} # Only consider members belonging to Organization 1
}).execute!
# Control: %50 (randomly assign)
# Experimental: %50 (randomly assign)
# Experimental A: Do not care (manually assign)
# Experimental B: Do not care (manually assign)
# If "Control" is too full, put them in "Experimental" ...
# Later someone will choose whether they're in "Experimental A" ...
# or in "Experimental B"
EenieMeenie::Assignment.new({
groups: ["Control", "Experimental"], # EenieMeenie's assignment options
member: @obj, # Member of population
group_rules: {
"Control" => { threshold: 0.5 }, # No more than one half
"Experimental" => { threshold: 0.5 }, # No more than one half
"Experimental A" => { threshold: false } # Don't care
"Experimental B" => { threshold: false } # Don't care
}
}).execute!
Pull requests/issues
Please submit any useful pull requests through GitHub. Please report any bugs using Github's issue tracker.