# Statsample: A statistical package for ruby

**URL:** <https://www.ruby-forum.com/t/statsample-a-statistical-package-for-ruby/183926>\
**Category:** Ruby\
**Created:** [February 22, 2010, 7:04pm UTC](https://www.ruby-forum.com/t/statsample-a-statistical-package-for-ruby/183926 "2010-02-22T19:04:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaaio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/8797f3/32.png) [@kaaio](https://www.ruby-forum.com/u/kaaio)\
**Post date:** [February 22, 2010, 7:04pm UTC](https://www.ruby-forum.com/t/statsample-a-statistical-package-for-ruby/183926/1 "2010-02-22T19:04:08Z")

</div>

Hi, everyone:

I like to invite you all to test and give some feedback on my ruby  
statistical package “statsample”

The home URL is:

[http://ruby-statsample.rubyforge.org/](http://ruby-statsample.rubyforge.org/)

and you can install it with

gem install statsample

Have descriptive and inferencial statistical tools, including Multiple,  
Logit and Probit Regression, PCA, Factor Analysis, Tetrachoric and  
Polychoric correlation.

I implement the algorithms according to my needs and time, so if you  
need something, you ask and I try to implement it.

For example, to do a Multiple Regression Analysis you could do

require ‘statsample’

samples=10000  
a=samples.times.collect {rand}.to\_scale  
b=samples.times.collect {rand}.to\_scale  
c=samples.times.collect {rand}.to\_scale  
d=samples.times.collect {rand}.to\_scale

ds={‘a’=\>a,‘b’=\>b,‘c’=\>c,‘d’=\>d}.to\_dataset  
ds[‘y’]=ds.collect{|row|  
row[‘a’]\*5+row[‘b’]\*3+row[‘c’]\*2+row[‘d’]\*1+rand()}  
lr=Statsample::Regression::Multiple::RubyEngine.new(ds,‘y’)  
puts lr.summary
