Code Monkey home page Code Monkey logo

statsample's Introduction

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:

  • Descriptive statistics: frequencies, median, mean, standard error, skew, kurtosis (and many others).
  • Imports and exports datasets from and to Excel, CSV and plain text files.
  • Correlations: Pearson's r, Spearman's rank correlation (rho), point biserial, tau a, tau b and gamma. Tetrachoric and Polychoric correlation provides by +statsample-bivariate-extension+ gem.
  • Intra-class correlation
  • Anova: generic and vector-based One-way ANOVA and Two-way ANOVA, with contrasts for One-way ANOVA.
  • Tests: F, T, Levene, U-Mannwhitney.
  • Regression: Simple, Multiple (OLS), Probit and Logit
  • Factorial Analysis: Extraction (PCA and Principal Axis), Rotation (Varimax, Equimax, Quartimax) and Parallel Analysis and Velicer's MAP test, for estimation of number of factors.
  • Reliability analysis for simple scale and a DSL to easily analyze multiple scales using factor analysis and correlations, if you want it.
  • Basic time series support
  • Dominance Analysis, with multivariate dependent and bootstrap (Azen & Budescu)
  • Sample calculation related formulas
  • Structural Equation Modeling (SEM), using R libraries +sem+ and +OpenMx+
  • Creates reports on text, html and rtf, using ReportBuilder gem
  • Graphics: Histogram, Boxplot and Scatterplot

Principles

  • Software Design:
    • One module/class for each type of analysis
    • Options can be set as hash on initialize() or as setters methods
    • Clean API for interactive sessions
    • summary() returns all necessary informacion for interactive sessions
    • All statistical data available though methods on objects
    • All (important) methods should be tested. Better with random data.
  • Statistical Design
    • Results are tested against text results, SPSS and R outputs.
    • Go beyond Null Hiphotesis Testing, using confidence intervals and effect sizes when possible
    • (When possible) All references for methods are documented, providing sensible information on documentation

Features

  • Classes for manipulation and storage of data:
    • Statsample::Vector: An extension of an array, with statistical methods like sum, mean and standard deviation
    • Statsample::Dataset: a group of Statsample::Vector, analog to a excel spreadsheet or a dataframe on R. The base of almost all operations on statsample.
    • Statsample::Multiset: multiple datasets with same fields and type of vectors
  • Anova module provides generic Statsample::Anova::OneWay and vector based Statsample::Anova::OneWayWithVectors. Also you can create contrast using Statsample::Anova::Contrast
  • Module Statsample::Bivariate provides covariance and pearson, spearman, point biserial, tau a, tau b, gamma, tetrachoric (see Bivariate::Tetrachoric) and polychoric (see Bivariate::Polychoric) correlations. Include methods to create correlation and covariance matrices
  • Multiple types of regression.
    • Simple Regression : Statsample::Regression::Simple
    • Multiple Regression: Statsample::Regression::Multiple
    • Logit Regression: Statsample::Regression::Binomial::Logit
    • Probit Regression: Statsample::Regression::Binomial::Probit
  • Factorial Analysis algorithms on Statsample::Factor module.
    • Classes for Extraction of factors:
      • Statsample::Factor::PCA
      • Statsample::Factor::PrincipalAxis
    • Classes for Rotation of factors:
      • Statsample::Factor::Varimax
      • Statsample::Factor::Equimax
      • Statsample::Factor::Quartimax
    • Classes for calculation of factors to retain
      • Statsample::Factor::ParallelAnalysis performs Horn's 'parallel analysis' to a principal components analysis to adjust for sample bias in the retention of components.
      • Statsample::Factor::MAP performs Velicer's Minimum Average Partial (MAP) test, which retain components as long as the variance in the correlation matrix represents systematic variance.
  • Dominance Analysis. Based on Budescu and Azen papers, dominance analysis is a method to analyze the relative importance of one predictor relative to another on multiple regression
    • Statsample::DominanceAnalysis class can report dominance analysis for a sample, using uni or multivariate dependent variables
    • Statsample::DominanceAnalysis::Bootstrap can execute bootstrap analysis to determine dominance stability, as recomended by Azen & Budescu (2003) link[http://psycnet.apa.org/journals/met/8/2/129/].
  • Module Statsample::Codification, to help to codify open questions
  • Converters to import and export data:
    • Statsample::Database : Can create sql to create tables, read and insert data
    • Statsample::CSV : Read and write CSV files
    • Statsample::Excel : Read and write Excel files
    • Statsample::Mx : Write Mx Files
    • Statsample::GGobi : Write Ggobi files
  • Module Statsample::Crosstab provides function to create crosstab for categorical data
  • Module Statsample::Reliability provides functions to analyze scales with psychometric methods.
    • Class Statsample::Reliability::ScaleAnalysis provides statistics like mean, standard deviation for a scale, Cronbach's alpha and standarized Cronbach's alpha, and for each item: mean, correlation with total scale, mean if deleted, Cronbach's alpha is deleted.
    • Class Statsample::Reliability::MultiScaleAnalysis provides a DSL to easily analyze reliability of multiple scales and retrieve correlation matrix and factor analysis of them.
    • Class Statsample::Reliability::ICC provides intra-class correlation, using Shrout & Fleiss(1979) and McGraw & Wong (1996) formulations.
  • Module Statsample::SRS (Simple Random Sampling) provides a lot of functions to estimate standard error for several type of samples
  • Module Statsample::Test provides several methods and classes to perform inferencial statistics
    • Statsample::Test::BartlettSphericity
    • Statsample::Test::ChiSquare
    • Statsample::Test::F
    • Statsample::Test::KolmogorovSmirnov (only D value)
    • Statsample::Test::Levene
    • Statsample::Test::UMannWhitney
    • Statsample::Test::T
    • Statsample::Test::WilcoxonSignedRank
  • Module Graph provides several classes to create beautiful graphs using rubyvis
    • Statsample::Graph::Boxplot
    • Statsample::Graph::Histogram
    • Statsample::Graph::Scatterplot
  • Gem bio-statsample-timeseries provides module Statsample::TimeSeries with support for time series, including ARIMA estimation using Kalman-Filter.
  • Gem statsample-sem provides a DSL to R libraries +sem+ and +OpenMx+
  • Gem statsample-glm provides you with GML method, to work with Logistic, Poisson and Gaussian regression ,using ML or IRWLS.
  • Close integration with gem reportbuilder, to easily create reports on text, html and rtf formats.

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:

  • Plotting: gnuplot and rbgnuplot, SVG::Graph
  • Factorial analysis and polychorical correlation(joint estimate and polychoric series): gsl library and rb-gsl (https://rubygems.org/gems/rb-gsl/). You should install it using gem install rb-gsl.

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 --platform ruby

$ 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.

statsample's People

Contributors

blahah avatar clbustos avatar hstove avatar jkebinger avatar justin808 avatar mqzhang avatar rdlugosz avatar robbrit avatar thagomizer avatar ukd1 avatar v0dro avatar vpereira avatar zhomart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

statsample's Issues

`require': iconv will be deprecated in the future, use String#encode instead.

/Users/mind/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': iconv will be deprecated in the future, use String#encode instead.

ruby1.9.3:

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

trouble with Statsample::Bivariate#correlation_matrix

Hi, I'm in trouble with statsample to do PCA analysis for large data. Does anyone have any good idea?

I want to do PCA alanysis with very large data. (3000 variables, 50 samples)
Then, I wrote this code.

data_raw = IO.readlines('data1.txt').map{|v| v.split }[1..-1]

hash_tmp = {}

data_raw[1..3000].each do |ary|
  hash_tmp[ary[0]] = ary[1..-1].map(&:to_i).to_scale
end

ds = hash_tmp.to_dataset

puts "Input data done!"

cor_matrix=Statsample::Bivariate.correlation_matrix(ds)

puts "cor_matrix was prepared."

pca=Statsample::Factor::PCA.new(cor_matrix)

binding.pry

But the ruby on my mac doesn't return "Cor_matrix was prepared.".
I wrote another code to investigate a cause of this.

# Opening Class to investigate where is bottleneck
module Statsample
  module Bivariate
    class << self
      def covariance_matrix_optimized(ds)
        x=ds.to_gsl
        n=x.row_size
        m=x.column_size
        puts "calculating means..."
        means=((1/n.to_f)*GSL::Matrix.ones(1,n)*x).row(0)
        puts "centering matrix..."
        centered=x-(GSL::Matrix.ones(n,m)*GSL::Matrix.diag(means))
        puts "calculating covariance matrix..."
        ss=centered.transpose*centered
        puts "calculating n..."
        s=((1/(n-1).to_f))*ss
        puts "done!"              #<= This line has executed
        s
      end



      def correlation_matrix(ds)
        vars,cases=ds.fields.size,ds.cases
        if !ds.has_missing_data? and Statsample.has_gsl? and prediction_optimized(vars,cases) < prediction_pairwise(vars,cases)
          binding.pry
          cm=correlation_matrix_optimized(ds)
          binding.pry             #<= This line hasn't executed. :(
        else
          cm=correlation_matrix_pairwise(ds)
        end
        binding.pry
        cm.extend(Statsample::CovariateMatrix)
        binding.pry
        cm.fields=ds.fields
        binding.pry
        cm
      end
    end
  end
end

Then the Ruby return until "done!" and doesn't return from Statsample::Bivariate#covariance_matrix_optimized method.
I haven't seen a Ruby method which doesn't return.

If someone knows a way to solve this problem or investigate cause deeply, please tell me.

odd behavior of TwoSamplesIndependent.probability_not_equal_variance

Seems to give incorrect value. For example:

a=[0,0,0,1,1,1,2,2,2].to_scale
b=[2,2,2,3,3,3,4,4,4].to_scale
t_2 = Statsample::Test::T::TwoSamplesIndependent.new(a,b)
t_2.probability_not_equal_variance

this gives the result: => 0.03333672278567579

However, the result should be: 0.00016053418045947065

Which actually is the value of t_2.probability_equal_variance

The issue seems to be with Distribution::T.cdf which treats df different if its a Fixnum vs a Float.

For the two vectors, where the variance actually is the same, the t statistic and the df should be the same for the equal_variance case and the not_equal_variance case.

But Distribution::T.cdf(-4.8990,16) doesn't give the same result as Distribution::T.cdf(-4.8990,16.0)

I only just started using statsample today, so I don't know if this is a new issue or a long-standing one.

PCA: is it possible to save and restore eigenvectors / eigenvalues ?

Hi,

I'm considering using statsample for PCA, but my use case requires that I generate eigenvectors and eigenvalues for a dataset, save them and the recall them for computing components when new vectors are added to my data.

Is it possible to save the eigenvectors and eigenvalues for a PCA object such that they could be re-loaded for later use?

statsample override of array#sum conflicts with gem activerecord-import

In debugging this issue with activerecord-import, it appears that statsample overrides Array in a way that breaks activerecord-import.

That issue contains a small sample program that reproduces the issue. It seems specific to Array#sum.

The temporary solution I have is to monkey patch the insert_many method in ActiveRecord::Import::MysqlAdapter.

I think the long-term solution would be a fix in statsample. Happy to help with this, if needed.

Break statsample into smaller chunks

I think it would be nice if statsample could be restructured into many extensions...

so if you simply the wilcoxon test, you do the following:

require 'statsample/wilcoxon_test'

I believe that this would mean that dependencies are only installed when needed...

Point visitors to the SciRuby repos

Now that these gems are being maintained in the SciRuby organization, could a note be added to the top of the Readme that points visitors to the new location?

Argument should be a vector?

Hi there,

I'm trying to use statsample, but having some issues....

(pry) main: 0> b = [2,3,4,5,6,7].to_scale
(pry) output error: #<TypeError: Argument should be a Vector>

Do you know why I might be getting this error?

Recent gem releases not reflected in Github?

I noticed while upgrading some gems that Statsample went from 1.4.0 to 1.4.2 and Minimization went from 0.2.1 to 0.2.2 (and appears to have created a hard dependency on rb-gsl, as my heroku build failed—which led me here to investigate what changed).

Although I see an updated History.txt in both Gems, there's nothing reflected in the Github repos in the way of commits or tags. Were these releases made intentionally? Could we get the changes pushed to master?

Also, is rb-gsl going to become a hard dependency of statsample or minimization? (By locking to 1.4.0 and 0.2.1 I do not have rb-gsl in my dependency tree.)

Thanks!

Add support for Krippendorff's alpha reliability coefficient

(First of all, thanks so much for this package!
While it took me some time to get used to it, it's super handy even for simple statistics in business applications.)

I might lack the knowledge to combine the pieces of this framework, but I'm missing explicit support for measuring reliability between raters, e.g. Krippendorff's alpha.

R provides a nice interface for this here.

Thanks again for your efforts and time in supporting this project!

Error when running multi variable regression from a CSV: `_check_type': NoMethodError

I'm not really sure what's happening here. For some reason if the y value is high precision and I try to run a regression on it, I get this error. However this only works if the high precision data is in a CSV. It won't work as a number literal so it could be an issue with the CSV module itself. I should note that I'm running on Windows (8.1, 64 bit) so this might be an implementation issue.

The simplest code I can get this issue down to is as follows:

require 'statsample'
ds = Statsample::CSV.read("input.txt")
regression = Statsample::Regression.multiple(ds,'y')

And you'll need a file "input.txt" in the same directory with the following data:

x,y
1,9.629587310436753e+127
2,1.9341543147883677e+129
3,3.88485279048245e+130

The full stack trace is:

E:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/statsample-1.4.0/lib/statsample/vector.rb
:161:in `_check_type': NoMethodError (NoMethodError)
        from E:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/statsample-1.4.0/lib/statsam
ple/vector.rb:155:in `check_type'
        from E:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/statsample-1.4.0/lib/statsam
ple/vector.rb:911:in `mean'
        from E:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/statsample-1.4.0/lib/statsam
ple/regression/multiple/rubyengine.rb:23:in `initialize'
        from E:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/statsample-1.4.0/lib/statsam
ple/regression.rb:62:in `new'
        from E:/Ruby22-x64/lib/ruby/gems/2.2.0/gems/statsample-1.4.0/lib/statsam
ple/regression.rb:62:in `multiple'
        from script.rb:3:in `<main>'

just adding nyaplot gem (not even calling) gives me an error on osx (yosemite, 10.10.5)

$ ruby lib/correlation.rb 
/Users/tansaku/.rvm/gems/ruby-2.2.3/gems/iruby-0.2.7/lib/iruby/utils.rb:8:in `display': undefined method `session' for nil:NilClass (NoMethodError)
    from /Users/tansaku/.rvm/gems/ruby-2.2.3/gems/nyaplot-0.1.6/lib/nyaplot/core.rb:45:in `init_iruby'
    from /Users/tansaku/.rvm/gems/ruby-2.2.3/gems/nyaplot-0.1.6/lib/nyaplot/core.rb:48:in `<module:Nyaplot>'
    from /Users/tansaku/.rvm/gems/ruby-2.2.3/gems/nyaplot-0.1.6/lib/nyaplot/core.rb:3:in `<top (required)>'
    from /Users/tansaku/.rvm/gems/ruby-2.2.3/gems/nyaplot-0.1.6/lib/nyaplot.rb:4:in `require_relative'
    from /Users/tansaku/.rvm/gems/ruby-2.2.3/gems/nyaplot-0.1.6/lib/nyaplot.rb:4:in `<top (required)>'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
    from /Users/tansaku/.rvm/gems/ruby-2.2.3/gems/daru-0.1.1/lib/daru.rb:45:in `block in create_has_library'
    from /Users/tansaku/.rvm/gems/ruby-2.2.3/gems/daru-0.1.1/lib/daru/plotting/vector.rb:39:in `<top (required)>'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/tansaku/.rvm/gems/ruby-2.2.3/gems/daru-0.1.1/lib/daru/vector.rb:5:in `<top (required)>'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/tansaku/.rvm/gems/ruby-2.2.3/gems/daru-0.1.1/lib/daru.rb:70:in `<top (required)>'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/tansaku/.rvm/gems/ruby-2.2.3/gems/statsample-2.0.1/lib/statsample.rb:25:in `<top (required)>'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `require'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:128:in `rescue in require'
    from /Users/tansaku/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:39:in `require'
    from lib/correlation.rb:2:in `<main>'

first two lines of the file:

``ruby
require 'iruby'
require 'statsample'


if I remove the nyaplot gem everything runs fine :-(

Any advice for deploying on Heroku?

Any advice deploying to Heroku?

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

   /tmp/build_f2e88220-adf4-4199-83ad-47efd79ecbb1/vendor/ruby-2.1.2/bin/ruby extconf.rb
   *** ERROR: missing required library to compile this module: No such file or directory - gsl-config
   *** extconf.rb failed ***
   Could not create Makefile due to some reason, probably lack of necessary
   libraries and/or headers.  Check the mkmf.log file for more details.  You may
   need configuration options.

   Provided configuration options:
   --with-opt-dir
   --without-opt-dir
   --with-opt-include
   --without-opt-include=${opt-dir}/include
   --with-opt-lib
   --without-opt-lib=${opt-dir}/lib
   --with-make-prog
   --without-make-prog
   --srcdir=.
   --curdir
   --ruby=/tmp/build_f2e88220-adf4-4199-83ad-47efd79ecbb1/vendor/ruby-2.1.2/bin/ruby
   --with-gsl-version

   extconf failed, exit code 1

   Gem files will remain installed in /tmp/build_f2e88220-adf4-4199-83ad-47efd79ecbb1/vendor/bundle/ruby/2.1.0/gems/rb-gsl-1.16.0.2 for inspection.
   Results logged to /tmp/build_f2e88220-adf4-4199-83ad-47efd79ecbb1/vendor/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/rb-gsl-1.16.0.2/gem_make.out
   Installing thin 1.5.1
   Installing nokogiri 1.6.3.1
   An error occurred while installing rb-gsl (1.16.0.2), and Bundler cannot
   continue.
   Make sure that `gem install rb-gsl -v '1.16.0.2'` succeeds before bundling.

!
! Failed to install gems via Bundler.
!

Regressors are linearly dependent

With the following code, i get an error "matrixengine.rb:56:in `initialize': Regressors are linearly dependent (Statsample::Regression::LinearDependency)":

ds = Statsample::Dataset.new({
'a' => [5,5,4,5,5,2,2,4].to_scale,
'b' => [5,2,5,2,5,1,1,4].to_scale,
'c' => [4,5,2,4,5,2,1,4].to_scale,
'd' => [4,5,5,5,5,5,1,5].to_scale,
'e' => [5,4,1,5,1,5,4,2].to_scale,
'f' => [4,5,4,5,5,1,1,5].to_scale,
'g' => [4,2,4,4,5,5,4,1].to_scale,
'h' => [4,1,5,5,5,1,4,5].to_scale,
'i' => [4,2,2,1,4,5,5,5].to_scale
})

lr = Statsample::Regression.multiple(ds, 'a')
puts lr.summary

Any idea what is going on? (Excel does provide a linear regression)

Put documentation online

Rubyforge has shut down, so the statsample documentation is no longer hosted. Could you put it up somewhere?

Contrast method

Hi - I've been using the T Test and ANOVA methods in statsample quite a bit.
I wanted to try the "contrast" method today, but first I discovered that my copy doesn't have this method - Is it not included in the 1.0.1 distribution?

By including the contrast.rb code directly into my Ruby script, I got it to work, after I added alias :msw :ms_den to Statsample::Anova::OneWayWithVectors.

This works to calculate the psi and the se. But when I go to calculate a the T statistic (c.t) I get this error:

in t_object': undefined methodnew' for Statsample::Test::T:Module (NoMethodError)

Is there a version past 1.0.1 that has contrast implemented?
Thank you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.