methods-print: Pdqr methods for print function

methods-printR Documentation

Pdqr methods for print function

Description

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

Usage

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

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

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

## S3 method for class '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"))

r_unif <- as_r(runif, n_grid = 251)
print(r_unif)

# Printing of boolean pdqr-function
print(r_unif >= 0.3)

pdqr documentation built on May 31, 2023, 8:48 p.m.