Acceptance-Rejection Method for Generating Pseudo-Random Observations
Overview
Provides a function that implements the acceptance-rejection method in an optimized manner to generate pseudo-random observations for discrete or continuous random variables. Proposed by von Neumann J. (1951), https://mcnp.lanl.gov/pdf_files/, the function is optimized to work in parallel on Unix-based operating systems and performs well on Windows systems. The acceptance-rejection method implemented optimizes the probability of generating observations from the desired random variable, by simply providing the probability function or probability density function, in the discrete and continuous cases, respectively. Implementation is based on references CASELLA, George at al. (2004) https://www.jstor.org/stable/4356322, NEAL, Radford M. (2003) https://www.jstor.org/stable/3448413 and Bishop, Christopher M. (2006, ISBN: 978-0387310732).
- The performance of the
one_step()function, an internal function used in the implementation of C++ using Rcpp, has been improved; - The method
qqplot.accept_reject()has been added, which constructs the QQ-Plot of an object of classaccept_rejectreturned by the functionaccept_reject(); - The
qqplot.accept_reject()function utilizes the **scattermore** package if the point density is high, i.e., above 10 thousand observations; - The function
accept_reject()now has the argument cores, which allows the user to control the number of cores that will be used ifparallel = TRUE. The default,cores = NULL, means that all processor cores will be used. Ifparallel = FALSE, the cores argument is ignored; - The DESCRIPTION file was edited;
- Another bibliographic reference was added to the
accept_reject()function; - The dependency on the
lbfgspackage has been removed; - New unit tests have been introduced;
- Bug fix.
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK14 OK2026-04-22
- ERROR13 OK, 1 ERROR2026-04-18
- OK14 OK2026-03-10
Documentation
- Help pages
- 6
- Examples that run
- 100%5 run in a plain check
- Exported functions with examples
- 67%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 17%
Downloads
Repository
Stars over time
9 development-tooling and community-health practices detected across 4 families in the upstream repository
Checks run against github.com/prdm0/acceptreject on 2026-10-18.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2024-05-22 · The repository has a site deploy workflow
Dependencies
Code & Tests
People & History
Pick two releases to compare their code metrics.
- RR 4.6.0 released · 2026-04-24
- RR 4.5.0 released · 2025-04-11
- 0.1.2Latest
- 0.1.1
- RR 4.4.0 released · 2024-04-24
- 0.1.02024-04-11
- RR 4.3.0 released · 2023-04-21
Package metadata
- First published
- 2024-04-11
- Total releases
- 3 / 2 yrs
- License
- GPL (>= 3) OSI
- Download size
- 721 KB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("AcceptReject")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-21, which the citation names so these numbers can be found later. More on citing and the projects behind them.