Class: Laboratory::Experiment::AnalysisSummary
- Inherits:
-
Object
- Object
- Laboratory::Experiment::AnalysisSummary
- Defined in:
- lib/laboratory/experiment/analysis_summary.rb
Instance Attribute Summary collapse
-
#event_id ⇒ Object
readonly
Returns the value of attribute event_id.
-
#experiment ⇒ Object
readonly
Returns the value of attribute experiment.
Instance Method Summary collapse
- #confidence_level_in_performance_delta ⇒ Object
- #highest_performing_variant ⇒ Object
-
#initialize(experiment, event_id) ⇒ AnalysisSummary
constructor
A new instance of AnalysisSummary.
- #lowest_performing_variant ⇒ Object
- #performance_delta_between_highest_and_lowest ⇒ Object
Constructor Details
#initialize(experiment, event_id) ⇒ AnalysisSummary
Returns a new instance of AnalysisSummary.
6 7 8 9 |
# File 'lib/laboratory/experiment/analysis_summary.rb', line 6 def initialize(experiment, event_id) @experiment = experiment @event_id = event_id end |
Instance Attribute Details
#event_id ⇒ Object (readonly)
Returns the value of attribute event_id.
4 5 6 |
# File 'lib/laboratory/experiment/analysis_summary.rb', line 4 def event_id @event_id end |
#experiment ⇒ Object (readonly)
Returns the value of attribute experiment.
4 5 6 |
# File 'lib/laboratory/experiment/analysis_summary.rb', line 4 def experiment @experiment end |
Instance Method Details
#confidence_level_in_performance_delta ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/laboratory/experiment/analysis_summary.rb', line 27 def confidence_level_in_performance_delta Laboratory::Calculations::ConfidenceLevel.calculate( n1: participant_count_for_variant(lowest_performing_variant), p1: event_total_count_for_variant(lowest_performing_variant), n2: participant_count_for_variant(highest_performing_variant), p2: event_total_count_for_variant(highest_performing_variant) ) end |
#highest_performing_variant ⇒ Object
11 12 13 |
# File 'lib/laboratory/experiment/analysis_summary.rb', line 11 def highest_performing_variant sorted_variants.first end |
#lowest_performing_variant ⇒ Object
15 16 17 |
# File 'lib/laboratory/experiment/analysis_summary.rb', line 15 def lowest_performing_variant sorted_variants.last end |
#performance_delta_between_highest_and_lowest ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/laboratory/experiment/analysis_summary.rb', line 19 def performance_delta_between_highest_and_lowest numerator = (conversion_rate_for_variant(highest_performing_variant) - conversion_rate_for_variant(lowest_performing_variant)) denominator = conversion_rate_for_variant(lowest_performing_variant) numerator.fdiv(denominator).round(2) end |