Git Product home page Git Product logo

rinruby's Introduction

rinruby

Build Status

Maintainability

DESCRIPTION

RinRuby is a Ruby library that integrates the R interpreter in Ruby, making R's statistical routines and graphics available within Ruby. The library consists of a single Ruby script that is simple to install and does not require any special compilation or installation of R. Since the library is 100% pure Ruby, it works on a variety of operating systems, Ruby implementations, and versions of R. RinRuby's methods are simple, making for readable code. The website rinruby.ddahl.org describes RinRuby usage, provides comprehensive documentation, gives several examples, and discusses RinRuby's implementation.

Copyright 2005-2008 David B. Dahl

Developed by David B. Dahl. Documented by David B. Dahl and Scott Crawford

Homepage: http://rinruby.ddahl.org

Maintainer: Claudio Bustos

Contributors:

FEATURES/PROBLEMS

  • Pure Ruby. Works on Ruby 2.1, 2.2, 2.4 and JRuby-head (2018/03/29). There isn't any specific code that impides to use Ruby < 2.0, but is deprecated.
  • Slower than RSRuby, but more robust

SYNOPSIS

Below is a simple example of RinRuby usage for simple linear regression. The simulation parameters are defined in Ruby, computations are performed in R, and Ruby reports the results. In a more elaborate application, the simulation parameter might come from input from a graphical user interface, the statistical analysis might be more involved, and the results might be an HTML page or PDF report.

Code

  require "rinruby"
  n = 10
  beta_0 = 1
  beta_1 = 0.25
  alpha = 0.05
  seed = 23423
  R.x = (1..n).entries
  R.eval <<EOF
      set.seed(#{seed})
      y <- #{beta_0} + #{beta_1}*x + rnorm(#{n})
      fit <- lm( y ~ x )
      est <- round(coef(fit),3)
      pvalue <- summary(fit)$coefficients[2,4]
  EOF
  puts "E(y|x) ~= #{R.est[0]} + #{R.est[1]} * x"
  if R.pvalue < alpha
    puts "Reject the null hypothesis and conclude that x and y are related."
  else
    puts "There is insufficient evidence to conclude that x and y are related."
  end

Output

  E(y|x) ~= 1.264 + 0.273 * x
  Reject the null hypothesis and conclude that x and y are related.

REQUIREMENTS

  • R

INSTALL

  • sudo gem install rinruby

LICENSE

GPL-3. See LICENSE.txt for more information.

rinruby's People

Contributors

clbustos avatar cole-christensen avatar fenrir-naru avatar fguillen avatar htwroclau avatar martyn-w avatar robheittman avatar seanmarcia avatar virtualstaticvoid avatar

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.