Pdqr-functions have their own methods for print() which displays function's metadata in readable and concise form.

# S3 method for p
print(x, ...)

# S3 method for d
print(x, ...)

# S3 method for q
print(x, ...)

# S3 method for r
print(x, ...)

Arguments

x

Pdqr-function to print.

...

Further arguments passed to or from other methods.

Details

Print output of pdqr-function describes the following information:

  • Full name of function class:

    • P-function is "Cumulative distribution function".

    • D-function is "Probability mass function" for "discrete" type and "Probability density function" for "continuous".

    • Q-function is "Quantile function".

    • R-function is "Random generation function".

  • Type of function in the form "of * type" where "*" is "discrete" or "continuous" depending on actual type.

  • Support of function.

  • Number of elements in distribution for "discrete" type or number of intervals of piecewise-linear density for "continuous" type.

  • If pdqr-function has "discrete" type and exactly two possible values 0 and 1, it is treated as "boolean" pdqr-function and probability of 1 is shown. This is done to simplify interactive work with output of comparing functions like >=, etc. (see description of methods for S3 group generic functions). To extract probabilities from "boolean" pdqr-function, use summ_prob_true() and summ_prob_false().

Symbol "~" in print() output indicates that printed value or support is an approximation to a true one (for readability purpose).

See also

Other pdqr methods for generic functions: methods-group-generic, methods-plot

Examples

print(new_d(1:10, "discrete"))
#> Probability mass function of discrete type #> Support: [1, 10] (10 elements)
r_unif <- as_r(runif, n_grid = 251) print(r_unif)
#> Random generation function of continuous type #> Support: [0, 1] (250 intervals)
# Printing of boolean pdqr-function print(r_unif >= 0.3)
#> Random generation function of discrete type #> Support: [0, 1] (2 elements, probability of 1: 0.7)