Module: Statsample::Util

Defined in:
lib/statsample/graph/gdchart.rb,
lib/statsample.rb

Overview

:nodoc:

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.chart_gdchart(file, width, height, chart_type, labels, options, num_datasets, data) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/statsample/graph/gdchart.rb', line 5

def chart_gdchart(file,width,height,chart_type, labels, options,num_datasets,data)
    require 'GDChart'
    gdc=GDChart.new
    gdc.title="Generic title"
    gdc.bg_color=0xFFFFFF
    gdc.image_type=GDChart::JPEG
    options.each{|k,v|
      gdc.send(k+"=",v)
    }
              
    File.open(file,"w") {|f|
      gdc.out_graph(width,height,f,chart_type, data.length/num_datasets,labels,num_datasets,data)
    }
end

Instance Method Details

#normal_order_statistic_medians(i, n) ⇒ Object



196
197
198
199
200
201
202
203
204
205
# File 'lib/statsample.rb', line 196

def normal_order_statistic_medians(i,n)
  if i==1
      u= 1.0 - normal_order_statistic_medians(n,n)
  elsif i==n
      u=0.5**(1 / n.to_f)
  else
      u= (i - 0.3175) / (n + 0.365)
  end
  u
end