distribution | R Documentation |
Holds a univariate distribution including its parameters. The name of the distribution is used to determine, for example
the function for quantiles: paste0("q", name)
. Usually the full name has to be used; some abbreviated names are possible
binom
binomial distribution, parameters: size
, prob
hyper
hypergeometric distribution, parameters: m
, n
, k
geom
geometric distribution, parameters: prob
pois
Poisson distribution, parameters: lambda
unif
continuous uniform distribution, parameters: min
, max
dunif
discrete uniform distribution, parameters: min
, max
dunif2
continuous uniform distribution, parameters: min
, max
exp
exponential distribution, parameter: rate
norm
normal distribution, parameters: mean
, sd
lnorm
log-normal distribution, parameters: meanlog
, sdlog
t
Student t distribution, parameter: df
chisq
chi-squared distribution, parameter: df
f
F distribution, parameters: df1
, df2
Note that a probability mass/density, quantile and cumulative distribution function must exist.
The following functions exists for disributions
:
distribution
creates a distribution with name name
and parameters
quantile
computes the quantiles of a distribution using paste0('q', name)
cdf
computes the cumulative distribution function of a distribution using paste0('p', name)
pmdf
computes the probability mass/density function of a distribution using paste0('d', name)
prob
computes the probability for a interval between min
and max
(max
included, min
excluded)
prob1
computes the point probability f
is.distribution
checks if object
is distribution object. If name
is given then it checks if distribution type is the same
toLatex
generates a LaTeX representation of the distribution an its parameter
distribution(name, ...)
## Default S3 method:
distribution(name, ..., discrete = NA)
## S3 method for class 'distribution'
quantile(x, probs = seq(0, 1, 0.25), ...)
cdf(x, q, ...)
pmdf(d, x, ...)
## S3 method for class 'distribution'
toLatex(object, name = NULL, param = NULL, digits = 4, ...)
is.distribution(object, name = NULL)
prob(d, min = -Inf, max = +Inf, tol = 1e-06)
prob1(d, x, tol = 1e-06)
name |
character: a replacement of the name of the distribtuion type |
... |
further named distribution parameters |
discrete |
logical: Is distribution discrete? (default: |
x |
vector of values |
probs |
numeric: vector of probabilities with values in |
q |
numeric: vector of quantiles |
d |
distribution |
object |
distribution object |
param |
character: names for the distribution parameters |
digits |
integer: number of digits used in |
min |
numeric: left border of interval |
max |
numeric: right border of interval |
tol |
numeric: tolerance for |
a distribution object
d <- distribution("norm", mean=0, sd=1)
quantile(d)
quantile(d, c(0.025, 0.975))
cdf(d, 0)
is.distribution(d)
is.distribution(d, "t")
toLatex(d)
# see the LaTeX names
data(distributions)
distributions
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.