Skip to content
Browse files

changed to a centered moving average and went 6 sigma. Still too sens…

…itive
  • Loading branch information...
1 parent 7f5f5dc commit 5cea8752a6bee44b0b11d10a82c3b9129cbfd399 @bentut committed
Showing with 5 additions and 5 deletions.
  1. +2 −2 app/views/series/outlier_graph.html.erb
  2. +1 −1 lib/series_external_relationship.rb
  3. +2 −2 lib/series_statistics.rb
View
4 app/views/series/outlier_graph.html.erb
@@ -18,7 +18,7 @@ var dat_gui_ranges = {
h : [0, 1200],
udaman_width :[0,20],
aremos_width :[0,20],
- mult :[0,4],
+ mult :[0,10],
}
@@ -48,7 +48,7 @@ var params = {
aremos_color: "#D84506",
aremos_width:1.5,
udaman_width:1.5,
- mult: 2.5,
+ mult: 6,
// fill_opacity: 0.2,
// point_size :2.5,
//just to store for redraw
View
2 lib/series_external_relationship.rb
@@ -150,7 +150,7 @@ def aremos_data_side_by_side
def ma_data_side_by_side
comparison_hash = {}
- ma = self.backward_looking_moving_average
+ ma = self.moving_average
all_dates = self.data.keys | ma.data.keys
all_dates.each do |date_string|
ma_point = ma.data[date_string].nil? ? nil : ma.data[date_string]
View
4 lib/series_statistics.rb
@@ -23,7 +23,7 @@ def standard_deviation
def outlier
begin
outlier_hash = {}
- ma = moving_average = self.backward_looking_moving_average
+ ma = moving_average = self.moving_average
all_dates = self.data.keys | ma.data.keys
residuals = []
@@ -36,7 +36,7 @@ def outlier
average = residuals.inject{ |sum, el| sum + el }.to_f / residuals.count
std_dev = Math.sqrt((residuals.inject(0){ | sum, x | sum + (x - average) ** 2 }) / (residuals.count - 1))
- mult = 2.5
+ mult = 6
self.data.each do |date_string, val|
next if moving_average.data[date_string].nil?
upper = moving_average.data[date_string] + mult * std_dev

0 comments on commit 5cea875

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