Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Refactor confidence helper.

  • Loading branch information...
commit af5bd61a1ebcf4c25720d7b2b85008b6278186fa 1 parent 02b59b0
@elliotcm elliotcm authored
Showing with 12 additions and 23 deletions.
  1. +12 −23 lib/split/dashboard/helpers.rb
View
35 lib/split/dashboard/helpers.rb
@@ -19,30 +19,19 @@ def round(number, precision = 2)
def confidence_level(z_score)
return z_score if z_score.is_a? String
- z = round(z_score.to_s.to_f, 3)
- if z > 0.0
- if z < 1.96
- 'no confidence'
- elsif z < 2.57
- '95% confidence'
- elsif z < 3.29
- '99% confidence'
- else
- '99.9% confidence'
- end
- elsif z < 0.0
- if z > -1.96
- 'no confidence'
- elsif z > -2.57
- '95% confidence'
- elsif z > -3.29
- '99% confidence'
- else
- '99.9% confidence'
- end
+ z = round(z_score.to_s.to_f, 3).abs
+
+ if z == 0.0

@andrew you mentioned in your talk at LRUG about the confidence not necessarily being particularly sophisticated. Just got round to taking a look at it. Could you explain where the magic numbers come from?
I wonder if we can replace this with a calculation.

Disclaimer: I have no stats background, so in no position to judge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ 'No Change'
+ elsif z < 1.96
+ 'no confidence'
+ elsif z < 2.57
+ '95% confidence'
+ elsif z < 3.29
+ '99% confidence'
else
- "No Change"
+ '99.9% confidence'
end
end
end
-end
+end
@markburns

@andrew you mentioned in your talk at LRUG about the confidence not necessarily being particularly sophisticated. Just got round to taking a look at it. Could you explain where the magic numbers come from?
I wonder if we can replace this with a calculation.

Disclaimer: I have no stats background, so in no position to judge.

Please sign in to comment.
Something went wrong with that request. Please try again.