distr-package

0th

Percentile

distr -- object orientated implementation of distributions

distr provides a conceptual treatment of distributions by means of S4 classes. A mother class Distribution is introduced with slots for a parameter and ---most important--- for the four constitutive methods r, d, p, and q for simulation respectively for evaluation of density / c.d.f. and quantile function of the corresponding distribution. Most distributions of package stats (like normal, Poisson, etc.) are implemented as subclasses of either AbscontDistribution or DiscreteDistribution, which themselves are again subclasses of Distribution. Arithmetics and unary mathematical transformations for distributions are available: For Distribution objects X and Y expressions like 3*X+sin(exp(-Y/4+3)) have their natural interpretation as corresponding image distributions.

Keywords
package, distribution
Details

ll{ Package: distr Version: 1.8 Date: 2006-10-03 Depends: R(>= 2.2.0), methods, graphics Imports: stats SaveImage: no LazyLoad: yes License: GPL (version 2 or later) URL: http://www.uni-bayreuth.de/departments/math/org/mathe7/DISTR/ }

Note

Arithmetics on distribution objects are understood as operations on corresponding (independent) r.v.'s and not on distribution functions or densities. See also infoShow("distr","ARITHMETICS"). Accuracy of these arithmetics is controlled by global options which may be inspected / set by distroptions() and getdistrOption(), confer distroptions .

Classes

Distribution classes have a slot param the class of which is is specialized for the particualar distributions. The parameter classes for the particular distributions have slots with names according to the corresponding [rdpq] functions of package base. DiscreteDistribution and descendants have an additional slot support. For all particular distributions, generating functions are provided, e.g. X <- Norm(mean = 3, sd = 2). All slots should be inspected / modified by means of corresponding accessor- /replacement functions; e.g. mean(X) <- 3 (see Parameter classes). Distribution classes slots: [()] img(rSpace), param(OptionalParameter), r(function), d(OptionalFunction), p(OptionalFunction), q(OptionalFunction), .withSim(logical), .withArith(logical) "Distribution" |>"UnivariateDistribution" |>|>"AbscontDistribution" |>|>|>"Beta" |>|>|>"Cauchy" |>|>|>"ExpOrGammaOrChisq" (VIRTUAL) |>|>|>|>"Exp" |>|>|>|>"Gammad" |>|>|>|>"Chisq" |>|>|>"Fd" |>|>|>"Lnorm" |>|>|>"Logis" |>|>|>"Norm" |>|>|>"Td" |>|>|>"Unif" |>|>|>"Weibull" |>|>|"DiscreteDistribution" |>|>|>"Binom" |>|>|>"Dirac" |>|>|>"Hyper" |>|>|>"NBinom" |>|>|>|>"Geom" |>|>|>"Pois" Parameter classes "OptionalParameter" |>"Parameter" |>|>"BetaParameter" |>|>"BinomParameter" |>|>"CauchyParameter" |>|>"ChisqParameter" |>|>"DiracParameter" |>|>"ExpParameter" |>|>"FParameter" |>|>"GammaParameter" |>|>"GeomParameter" |>|>"HyperParameter" |>|>"LnormParameter" |>|>"LogisParameter" |>|>"NbinomParameter" |>|>"NormParameter" |>|>"UniNormParameter" |>|>|>"PoisParameter" |>|>"TParameter" |>|>"UnifParameter" |>|>"WeibullParameter" Space classes "rSpace" |>"EuclideanSpace" |>|>"Reals" |>"Naturals"

Methods

The group Math of unary (see Math) as well as convolution are made available for distributions, see operators-methods. Besides, there are plot and print-methods for distributions. For the space classes, we have liesIn. The "history" of distributions obtained by chaining operations may be shortened using simplifyr.

Functions

RtoDPQ Default procedure to fill slots d,p,q given r for a.c. distributions RtoDPQ.d Default procedure to fill slots d,p,q given r for discrete distributions distroptions Functions to change the global variables of the package 'distr' standardMethods Utility to automatically generate accessor and replacement functions

Acknowledgement

We thank Martin Maechler, Josef Leydold, John Chambers, Duncan Murdoch, Gregory Warnes, Paul Gilbert, Kurt Hornik, Uwe Ligges, Torsten Hothorn, and Seth Falcon for their help in preparing this package.

Start-up-Banner

You may suppress the start-up banner/message completely by setting options("StartupBanner"="off") somewhere before loading this package by library or require in your R-code / R-session. If option "StartupBanner" is not defined (default) or setting options("StartupBanner"=NULL) or options("StartupBanner"="complete") the complete start-up banner is displayed. For any other value of option "StartupBanner" (i.e., not in c(NULL,"off","complete")) only the version information is displayed. The same can be achieved by wrapping the library or require call into either suppressStartupMessages() or onlytypeStartupMessages(.,atypes="version").

Demos

Demos are available --- see demo(package="distr")

References

P. Ruckdeschel, M. Kohl, T. Stabla, F. Camphausen (2006): S4 Classes for Distributions, {\emR News}, {\em6}(2), 2-6. http://CRAN.R-project.org/doc/Rnews/Rnews_2006-2.pdf a vignette for packages distr, distrSim, distrTEst, and distrEx is included into the mere documentation package distrDoc and may be called by require("distrDoc");vignette("distr") a homepage to this package is available under http://www.uni-bayreuth.de/departments/math/org/mathe7/DISTR/

Aliases
  • distr-package
  • distr
Examples
X <- Unif(2,3)
Y <- Pois(lambda = 3)
Z <- X+Y  # generates Law of corresponding independent variables
p(Z)(0.2)
r(Z)(1000)
plot(Z+sin(Norm()))
Documentation reproduced from package distr, version 1.8, License: GPL (version 2 or later)

Community examples

Looks like there are no examples yet.