Description

Statsample is a statistical library for Ruby. Has modules for descriptive and inferencial statistics. Compatible with Ruby 1.8.7, 1.9.1, 1.9.2 and ruby-head

Features:

Examples

   1  require 'statsample'
   2  
   3  # Create a Vector
   4  a=(1..100).collect { rand(100)}.to_scale
   5  
   6  # Retrieve vector mean and standard deviation
   7  a.mean
   8  a.sd
   9      
  10  # Calculate correlation coefficient
  11  b=(1..100).collect { rand(100)}.to_scale
  12  Statsample::Bivariate.pearson(a,b)
  13  # Creates a dataset
  14  ds={"a"=>a,"b"=>b}.to_dataset
  15  
  16  # Creates a new vector based on previous vectors and add it to the dataset 
  17  ds['c']=ds.collect {|r| r['a']*10+r['b']*5+rand(10) }
  18  
  19  # OLS 
  20  lr=Statsample::Regression.multiple(ds,"c")

Download

With rubygems

$ gem install statsample

To install optimization packages

$ sudo gem install statsample-optimization

Download directly on Gemcutter

Resources

Related projects

Other useful projects

Manuals