Class: ABVariant
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ABVariant
- Defined in:
- lib/a_b/model/a_b_variant.rb
Instance Method Summary collapse
- #confidence ⇒ Object
- #confidence_ok? ⇒ Boolean
- #conversion_rate ⇒ Object
- #conversion_rate_ok? ⇒ Boolean
- #pretty_confidence ⇒ Object
- #pretty_conversion_rate ⇒ Object
- #suggested_visitors ⇒ Object
- #suggested_visitors_ok? ⇒ Boolean
- #suggested_visitors_with_commas ⇒ Object
- #visitors_with_commas ⇒ Object
Instance Method Details
#confidence ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/a_b/model/a_b_variant.rb', line 10 def confidence if compute_confidence? cumulative_normal_distribution(z_score(self.test.control)) else 'n/a' end end |
#confidence_ok? ⇒ Boolean
18 19 20 |
# File 'lib/a_b/model/a_b_variant.rb', line 18 def confidence_ok? cumulative_normal_distribution(z_score(self.test.control)) >= 0.95 end |
#conversion_rate ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/a_b/model/a_b_variant.rb', line 22 def conversion_rate if conversions > 0 1.0 * conversions / visitors else 0.0 end end |
#conversion_rate_ok? ⇒ Boolean
30 31 32 |
# File 'lib/a_b/model/a_b_variant.rb', line 30 def conversion_rate_ok? conversion_rate > self.test.control.conversion_rate end |
#pretty_confidence ⇒ Object
34 35 36 |
# File 'lib/a_b/model/a_b_variant.rb', line 34 def pretty_confidence pretty confidence end |
#pretty_conversion_rate ⇒ Object
38 39 40 |
# File 'lib/a_b/model/a_b_variant.rb', line 38 def pretty_conversion_rate pretty conversion_rate end |
#suggested_visitors ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/a_b/model/a_b_variant.rb', line 42 def suggested_visitors size = sample_size(self.test.control) if conversion_rate == 0 || size < 100 100 else commafy size end end |
#suggested_visitors_ok? ⇒ Boolean
51 52 53 |
# File 'lib/a_b/model/a_b_variant.rb', line 51 def suggested_visitors_ok? visitors > sample_size(self.test.control) end |
#suggested_visitors_with_commas ⇒ Object
55 56 57 |
# File 'lib/a_b/model/a_b_variant.rb', line 55 def suggested_visitors_with_commas commafy suggested_visitors end |
#visitors_with_commas ⇒ Object
59 60 61 |
# File 'lib/a_b/model/a_b_variant.rb', line 59 def visitors_with_commas commafy visitors end |