Home

Awesome

Statsample

Homepage :: https://github.com/sciruby/statsample

Build Status Gem Version

DESCRIPTION

A suite for basic and advanced statistics on Ruby. Tested on Ruby 2.1.1p76 (June 2014), 1.8.7, 1.9.1, 1.9.2 (April, 2010), ruby-head(June, 2011) and JRuby 1.4 (Ruby 1.8.7 compatible).

Include:

Principles

Features

Examples of use:

See the examples folder too.

Boxplot

require 'statsample'

ss_analysis(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
Statsample::Analysis.run # Open svg file on *nix application defined

Correlation matrix

require 'statsample'
# Note R like generation of random gaussian variable
# and correlation matrix

ss_analysis("Statsample::Bivariate.correlation_matrix") do
  samples=1000
  ds=data_frame(
    'a'=>rnorm(samples), 
    'b'=>rnorm(samples),
    'c'=>rnorm(samples),
    'd'=>rnorm(samples))
  cm=cor(ds) 
  summary(cm)
end

Statsample::Analysis.run_batch # Echo output to console

Requirements

Optional:

Note: Use gsl 1.12.109 or later.

Resources

Installation

$ sudo gem install statsample

On *nix, you should install statsample-optimization to retrieve gems gsl, statistics2 and a C extension to speed some methods.

There are available precompiled version for Ruby 1.9 on x86, x86_64 and mingw32 archs.

$ sudo gem install statsample-optimization

If you use Ruby 1.8, you should compile statsample-optimization, usign parameter <tt>--platform ruby</tt>

$ sudo gem install statsample-optimization --platform ruby

If you need to work on Structural Equation Modeling, you could see +statsample-sem+. You need R with +sem+ or +OpenMx+ [http://openmx.psyc.virginia.edu/] libraries installed

$ sudo gem install statsample-sem

Available setup.rb file

sudo gem ruby setup.rb

License

BSD-3 (See LICENSE.txt)

Could change between version, without previous warning. If you want a specific license, just choose the version that you need.