| distribution {exams.forge} | R Documentation |
Class Distribution
Description
Holds an univariate distribution including its parameters. The name of the distribution is used to determine the right use of the function.
For example, in the case of function for quantiles: paste0("q", name). Usually the full name has to be used; some abbreviated names are possible:
binombinomial distribution, parameters:size,probhyperhypergeometric distribution, parameters:m,n,kgeomgeometric distribution, parameters:probpoisPoisson distribution, parameters:lambdaunifcontinuous uniform distribution, parameters:min,maxdunifdiscrete uniform distribution, parameters:min,maxdunif2continuous uniform distribution, parameters:min,maxexpexponential distribution, parameter:ratenormnormal distribution, parameters:mean,sdlnormlog-normal distribution, parameters:meanlog,sdlogtStudent t distribution, parameter:dfchisqchi-squared distribution, parameter:dffF distribution, parameters:df1,df2
Note that a probability mass/density, quantile and a cumulative distribution function must exist.
The following functions exists for disributions:
distributioncreates a distribution withnameand parametersquantilecomputes the quantiles of a distribution usingpaste0('q', name)cdfcomputes the cumulative distribution function of a distribution usingpaste0('p', name)pmdfcomputes the probability mass/density function of a distribution usingpaste0('d', name)probcomputes the probability for a interval betweenminandmax(maxincluded,minexcluded)prob1computes the point probability fis.distributionchecks ifobjectis distribution object. Ifnameis given then it checks whether the distribution type is the sametoLatexgenerates a LaTeX representation of the distribution an its parameter
Usage
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, ...)
## S3 method for class 'distribution'
print(x, ...)
## S3 method for class 'distribution'
summary(object, ...)
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)
compute_cdf(x, q, ...)
compute_pmdf(d, x, ...)
compute_probability(d, min = -Inf, max = +Inf, tol = 1e-06)
point_probability(d, x, tol = 1e-06)
pprob(d, x, tol = 1e-06)
is_distribution(object, name = NULL)
Arguments
name |
character: a replacement of the name of the distribution type |
... |
further named distribution parameters |
discrete |
logical: is the distribution discrete? (default: |
x |
vector of values |
probs |
numeric: vector of probabilities with values in |
q |
numeric: vector of quantiles |
object |
distribution object |
d |
distribution |
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 |
Value
A distribution object.
Examples
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)