Giter VIP home page Giter VIP logo

distributions3's Introduction

distributions3

CRAN status R-CMD-check Codecov test coverage

distributions3, inspired by the eponynmous Julia package, provides a generic function interface to probability distributions. distributions3 has two goals:

  1. Replace the rnorm(), pnorm(), etc, family of functions with S3 methods for distribution objects

  2. Be extremely well documented and friendly for students in intro stat classes.

The main generics are:

  • random(): Draw samples from a distribution.
  • pdf(): Evaluate the probability density (or mass) at a point.
  • cdf(): Evaluate the cumulative probability up to a point.
  • quantile(): Determine the quantile for a given probability. Inverse of cdf().

Installation

You can install distributions3 with:

install.packages("distributions3")

You can install the development version with:

install.packages("devtools")
devtools::install_github("alexpghayes/distributions3")

Basic Usage

The basic usage of distributions3 looks like:

library("distributions3")

X <- Bernoulli(0.1)

random(X, 10)
#>  [1] 0 0 0 0 0 0 0 0 0 0
pdf(X, 1)
#> [1] 0.1

cdf(X, 0)
#> [1] 0.9
quantile(X, 0.5)
#> [1] 0

Note that quantile() always returns lower tail probabilities. If you aren’t sure what this means, please read the last several paragraphs of vignette("one-sample-z-confidence-interval") and have a gander at the plot.

Contributing

If you are interested in contributing to distributions3, please reach out on Github! We are happy to review PRs contributing bug fixes.

Please note that distributions3 is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Related work

For a comprehensive overview of the many packages providing various distribution related functionality see the CRAN Task View.

  • distributional provides distribution objects as vectorized S3 objects
  • distr6 builds on distr, but uses R6 objects
  • distr is quite similar to distributions, but uses S4 objects and is less focused on documentation.
  • fitdistrplus provides extensive functionality for fitting various distributions but does not treat distributions themselves as objects

distributions3's People

Contributors

1danjordan avatar alexpghayes avatar brunaw avatar dickoa avatar dkwhu avatar ellessenne avatar emilhvitfeldt avatar mnlang avatar ndrewwm avatar paulnorthrop avatar rmtrane avatar zeileis avatar

Forkers

retostauffer

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.