{"id":13858689,"url":"https://github.com/clbustos/statsample","last_synced_at":"2026-03-14T19:18:02.112Z","repository":{"id":892981,"uuid":"644533","full_name":"clbustos/statsample","owner":"clbustos","description":"A suite for basic and advanced statistics on Ruby.","archived":false,"fork":false,"pushed_at":"2023-01-19T05:58:01.000Z","size":2413,"stargazers_count":407,"open_issues_count":25,"forks_count":95,"subscribers_count":20,"default_branch":"master","last_synced_at":"2025-05-27T08:35:57.765Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://github.com/clbustos/statsample","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"waj/redmine_google_apps","license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clbustos.png","metadata":{"files":{"readme":"README.md","changelog":"History.txt","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-05-03T15:01:31.000Z","updated_at":"2025-03-15T14:35:23.000Z","dependencies_parsed_at":"2023-02-10T20:45:45.995Z","dependency_job_id":null,"html_url":"https://github.com/clbustos/statsample","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/clbustos/statsample","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clbustos%2Fstatsample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clbustos%2Fstatsample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clbustos%2Fstatsample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clbustos%2Fstatsample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clbustos","download_url":"https://codeload.github.com/clbustos/statsample/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clbustos%2Fstatsample/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265230891,"owners_count":23731481,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-05T03:02:17.628Z","updated_at":"2026-03-14T19:17:57.087Z","avatar_url":"https://github.com/clbustos.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"# Statsample\n\nHomepage :: https://github.com/sciruby/statsample\n\n[![Build Status](https://travis-ci.org/clbustos/statsample.svg?branch=master)](https://travis-ci.org/clbustos/statsample)\n[![Gem Version](https://badge.fury.io/rb/statsample.svg)](http://badge.fury.io/rb/statsample)\n## DESCRIPTION\n\nA 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).\n\nInclude:\n* Descriptive statistics: frequencies, median, mean, standard error, skew, kurtosis (and many others).\n* Imports and exports datasets from and to Excel, CSV and plain text files.\n* 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.\n* Intra-class correlation\n* Anova: generic and vector-based One-way ANOVA and Two-way ANOVA, with contrasts for One-way ANOVA.\n* Tests: F, T, Levene, U-Mannwhitney.\n* Regression: Simple, Multiple (OLS), Probit  and Logit\n* 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.\n* Reliability analysis for simple scale and a DSL to easily analyze multiple scales using factor analysis and correlations, if you want it.\n* Basic time series support\n* Dominance Analysis, with multivariate dependent and bootstrap (Azen \u0026 Budescu)\n* Sample calculation related formulas\n* Structural Equation Modeling (SEM), using R libraries +sem+ and +OpenMx+\n* Creates reports on text, html and rtf, using ReportBuilder gem\n* Graphics: Histogram, Boxplot and Scatterplot\n\n## Principles\n\n* Software Design: \n  * One module/class for each type of analysis\n  * Options can be set as hash on initialize() or as setters methods\n  * Clean API for interactive sessions\n  * summary() returns all necessary informacion for interactive sessions\n  * All statistical data available though methods on objects\n  * All (important) methods should be tested. Better with random data.\n* Statistical Design\n  * Results are tested against text results, SPSS and R outputs.\n  * Go beyond Null Hiphotesis Testing, using confidence intervals and effect sizes when possible\n  * (When possible) All references for methods are documented, providing sensible information on documentation \n\n## Features\n\n* Classes for manipulation and storage of data:\n  * Statsample::Vector: An extension of an array, with statistical methods like sum, mean and standard deviation\n  * 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. \n  * Statsample::Multiset: multiple datasets with same fields and type of vectors\n* Anova module provides generic Statsample::Anova::OneWay and vector based Statsample::Anova::OneWayWithVectors. Also you can create contrast using Statsample::Anova::Contrast\n* 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\n* Multiple types of regression.\n  * Simple Regression :  Statsample::Regression::Simple\n  * Multiple Regression: Statsample::Regression::Multiple\n  * Logit Regression:    Statsample::Regression::Binomial::Logit\n  * Probit Regression:    Statsample::Regression::Binomial::Probit\n* Factorial Analysis algorithms on Statsample::Factor module.\n  * Classes for Extraction of factors: \n    * Statsample::Factor::PCA\n    * Statsample::Factor::PrincipalAxis\n  * Classes for Rotation of factors: \n    * Statsample::Factor::Varimax\n    * Statsample::Factor::Equimax\n    * Statsample::Factor::Quartimax\n  * Classes for calculation of factors to retain\n    * Statsample::Factor::ParallelAnalysis performs Horn's 'parallel analysis' to a principal components analysis to adjust for sample bias in the retention of components.\n    * 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.\n* 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\n  * Statsample::DominanceAnalysis class can report dominance analysis for a sample, using uni or multivariate dependent variables\n  * Statsample::DominanceAnalysis::Bootstrap can execute bootstrap analysis to determine dominance stability, as recomended by  Azen \u0026 Budescu (2003) link[http://psycnet.apa.org/journals/met/8/2/129/]. \n* Module Statsample::Codification, to help to codify open questions\n* Converters to import and export data:\n  * Statsample::Database : Can create sql to create tables, read and insert data\n  * Statsample::CSV : Read and write CSV files\n  * Statsample::Excel : Read and write Excel files\n  * Statsample::Mx    : Write Mx Files\n  * Statsample::GGobi : Write Ggobi files\n* Module Statsample::Crosstab provides function to create crosstab for categorical data\n* Module Statsample::Reliability provides functions to analyze scales with psychometric methods. \n  * 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.\n  * Class Statsample::Reliability::MultiScaleAnalysis provides a DSL to easily analyze reliability of multiple scales and retrieve correlation matrix and factor analysis of them.\n  * Class Statsample::Reliability::ICC provides intra-class correlation, using Shrout \u0026 Fleiss(1979) and McGraw \u0026 Wong (1996) formulations.\n* Module Statsample::SRS (Simple Random Sampling) provides a lot of functions to estimate standard error for several type of samples\n* Module Statsample::Test provides several methods and classes to perform inferencial statistics\n  * Statsample::Test::BartlettSphericity\n  * Statsample::Test::ChiSquare\n  * Statsample::Test::F\n  * Statsample::Test::KolmogorovSmirnov (only D value)\n  * Statsample::Test::Levene\n  * Statsample::Test::UMannWhitney\n  * Statsample::Test::T\n  * Statsample::Test::WilcoxonSignedRank\n* Module Graph provides several classes to create beautiful graphs using rubyvis\n  * Statsample::Graph::Boxplot\n  * Statsample::Graph::Histogram\n  * Statsample::Graph::Scatterplot\n* Gem \u003ctt\u003ebio-statsample-timeseries\u003c/tt\u003e provides module Statsample::TimeSeries with support for time series, including ARIMA estimation using Kalman-Filter. \n* Gem \u003ctt\u003estatsample-sem\u003c/tt\u003e provides a DSL to R libraries +sem+ and +OpenMx+\n* Gem \u003ctt\u003estatsample-glm\u003c/tt\u003e provides you with GML method, to work with Logistic, Poisson and Gaussian regression ,using ML or IRWLS. \n* Close integration with gem \u003ctt\u003ereportbuilder\u003c/tt\u003e, to easily create reports on text, html and rtf formats.\n\n# Examples of use:\n\nSee the [examples folder](https://github.com/clbustos/statsample/tree/master/examples/) too.\n\n## Boxplot\n\n```ruby\nrequire 'statsample'\n\nss_analysis(Statsample::Graph::Boxplot) do \n  n=30\n  a=rnorm(n-1,50,10)\n  b=rnorm(n, 30,5)\n  c=rnorm(n,5,1)\n  a.push(2)\n  boxplot(:vectors=\u003e[a,b,c], :width=\u003e300, :height=\u003e300, :groups=\u003e%w{first first second}, :minimum=\u003e0)\nend\nStatsample::Analysis.run # Open svg file on *nix application defined\n```\n\n## Correlation matrix\n\n```ruby\nrequire 'statsample'\n# Note R like generation of random gaussian variable\n# and correlation matrix\n\nss_analysis(\"Statsample::Bivariate.correlation_matrix\") do\n  samples=1000\n  ds=data_frame(\n    'a'=\u003ernorm(samples), \n    'b'=\u003ernorm(samples),\n    'c'=\u003ernorm(samples),\n    'd'=\u003ernorm(samples))\n  cm=cor(ds) \n  summary(cm)\nend\n\nStatsample::Analysis.run_batch # Echo output to console\n```\n\n# Requirements\n\nOptional: \n\n* Plotting: gnuplot and rbgnuplot, SVG::Graph\n* 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 \u003ctt\u003egem install rb-gsl\u003c/tt\u003e. \n\n*Note*: Use gsl 1.12.109 or later.\n\n# Resources\n\n* Source code on github :: http://github.com/clbustos/statsample\n* Docs :: http://statsample.apsique.cl/\n* Bug report and feature request :: http://github.com/clbustos/statsample/issues\n* E-mailing list :: http://groups.google.com/group/statsample\n\n# Installation\n\n```bash\n$ sudo gem install statsample\n```\n\nOn *nix, you should install statsample-optimization to retrieve gems gsl, statistics2 and a C extension to speed some methods. \n\nThere are available precompiled version for Ruby 1.9 on x86, x86_64 and mingw32 archs.\n\n```bash\n$ sudo gem install statsample-optimization\n```\n\nIf you use Ruby 1.8, you should compile statsample-optimization, usign parameter \u003ctt\u003e--platform ruby\u003c/tt\u003e\n\n```bash\n$ sudo gem install statsample-optimization --platform ruby\n```\n\nIf 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\n\n```bash\n$ sudo gem install statsample-sem\n```\n\nAvailable setup.rb file\n\n```bash\nsudo gem ruby setup.rb\n```\n\n## License\n\nBSD-3 (See LICENSE.txt)\n\nCould change between version, without previous warning. If you want a specific license, just choose the version that you need.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclbustos%2Fstatsample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclbustos%2Fstatsample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclbustos%2Fstatsample/lists"}