
Print Method for proposal Objects
print.proposal.Rd
The function displays detailed information about the proposal object created by STORS' build_proposal()
or proposal_optimizer()
functions.
This includes the number of steps within the proposal, the range of values covered by the proposal, and the proposal's sampling efficiency.
This information is crucial for understanding the structure and performance of the proposal in sampling processes.
Usage
# S3 method for class 'proposal'
print(x, ...)
Arguments
- x
A list generated using STORS'
build_proposal()
orproposal_optimizer()
functions.- ...
Additional arguments passed to the
print
function.
Details
This method extends the generic print
function for objects of class proposal
.
It prints the provided proposal's features such as the number of steps, steps limit, and efficiency.
Examples
# Define the density function, its logarithm,
#and its derivative for the standard normal distribution
modes_norm = 0
f_norm <- function(x) { 1 / sqrt(2 * pi) * exp(-0.5 * x^2) }
h_norm <- function(x) { log(f_norm(x)) }
h_prime_norm <- function(x) { -x }
# Build a dense proposal for the standard normal distribution
norm_proposal = build_proposal(lower = -Inf, upper = Inf, mode = modes_norm,
f = f_norm, h = h_norm, h_prime = h_prime_norm, steps = 1000)
# Print the properties of the generated proposal
print(norm_proposal)
#>
#> ── Proposal Summary ────────────────────────────────────────────────────────────
#> • Total steps: 1,000
#> • Steps range: [-2.876766, 2.876766]
#> • Sampling efficiency: 99.56%