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:

Note that a probability mass/density, quantile and a cumulative distribution function must exist.

The following functions exists for disributions:

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: NA)

x

vector of values

probs

numeric: vector of probabilities with values in [0,1].

q

numeric: vector of quantiles

object

distribution object

d

distribution

param

character: names for the distribution parameters

digits

integer: number of digits used in signif

min

numeric: left border of interval

max

numeric: right border of interval

tol

numeric: tolerance for max==min (default: 1e-6)

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)

[Package exams.forge version 1.0.10 Index]