Sha256: da20d572923c174c55771555fc9afa7b3dd0d2d602553b4d4d8d78329f1e69b2

Contents?: true

Size: 998 Bytes

Versions: 6

Compression:

Stored size: 998 Bytes

Contents

#!/usr/bin/ruby
# == Description
# 
# This example illustrates how daru, combined with Statsample::Graph::Boxplot
# can be used for generating box plots of a normally distributed set of data.
# 
# The 'rnorm' function, defined in statsample/shorthands generates a Daru::Vector
# object which contains the specified number of random variables in a normal distribution.
# It uses the 'distribution' gem for this purpose.
# 
# Create a boxplot of the data by specifying the vectors a, b and c and providing 
# necessary options to Statsample::Graph::Boxplot. The 'boxplot' function is shorthand
# for calling Statsample::Graph::Boxplot.
$:.unshift(File.dirname(__FILE__)+'/../lib/')
require 'statsample'
Statsample::Analysis.store(Statsample::Graph::Boxplot) do 
  n = 30
  a = rnorm(n-1,50,10)
  b = rnorm(n, 30,5)
  c = rnorm(n,5,1)
  a.push(2)

  boxplot(:vectors=>[a,b,c],:width=>300, :height=>300, :groups=>%w{first first second}, :minimum=>0)
end

if __FILE__==$0
  Statsample::Analysis.run
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
statsample-ekatena-2.0.2.1 examples/boxplot.rb
statsample-ekatena-2.0.2 examples/boxplot.rb
statsample-2.1.0 examples/boxplot.rb
statsample-2.0.2 examples/boxplot.rb
statsample-2.0.1 examples/boxplot.rb
statsample-2.0.0 examples/boxplot.rb