| print.accept_reject {AcceptReject} | R Documentation |
Print method for accept_reject objects
Description
Print method for accept_reject objects.
Usage
## S3 method for class 'accept_reject'
print(x, n_min = 10L, ...)
Arguments
x |
An accept_reject object. |
n_min |
Minimum number of observations to print. |
... |
Additional arguments. |
Details
The function print.accept_reject() is responsible for printing an object of
class accept_reject in a formatted manner, providing some information
about the accept_reject object, including the number of observations, the
value of the constant c that maximizes acceptance, and the acceptance
probability 1/c. Additionally, it prints the first generated
observations. The function print.accept_reject() delivers formatted output
when executing an object of class accept_reject in the console or when
executing the function print() on an object of class accept_reject,
returned by the function accept_reject().
Value
An object of class character, providing a formatted output with some
information about the accept_reject object, including the number of
observations, the value of the constant c that maximizes acceptance, and
the acceptance probability 1/c. Additionally, it prints the first
generated observations. The function print.accept_reject() enables
formatting when executing an object of class 'accept_reject' in the console
or when executing the function print() on an object of class
accept_reject, returned by the function accept_reject().
See Also
accept_reject() and plot.accept_reject().
Examples
set.seed(0) # setting a seed for reproducibility
x = accept_reject(
n = 2000L,
f = dbinom,
continuous = FALSE,
args_f = list(size = 10, prob = 0.5),
xlim = c(0, 10)
)
print(x)