The goal of this package is to implement the concept of probability distribution finitization.
Moment-Preserving Finitization for Power-Series Distributions
The finitization package implements the finitization of discrete probability distributions, a technique that approximates a distribution by preserving a finite number of moments. These finitized distributions enable faster random variate generation than inverse transform sampling and are useful in simulation and statistical modeling. Symbolic computation is performed using the GiNaC library together with CLN and GMP for multiprecision arithmetic. The package requires compilation and links against external symbolic and multiprecision libraries.
Required system libraries must be installed prior to installation.
Debian / Ubuntu:
sudo apt-get update
sudo apt-get install -y libgmp-dev libcln-dev libginac-dev pkg-config
macOS (Homebrew):
brew install gmp cln ginac pkg-config
Then install from CRAN:
install.packages("finitization")
Once dependencies are installed, you can build and install the package from source:
git clone https://github.com/bogdanoancea/finitization.git
cd finitization
R CMD build .
R CMD INSTALL finitization_0.1.0.tar.gz
Or use devtools:
install.packages("devtools")
devtools::install_github("bogdanoancea/finitization")
To run tests:
library(testthat)
testthat::test_package("finitization")
library(finitization)
dpois(4, 0.5, c(0,1,3))
dpois(4, 0.5, c(0,1,3), log = TRUE)
This package depends on the external libraries GMP, CLN, and GiNaC for symbolic differentiation and formal Taylor series expansion. These libraries are required at compile time and are available on standard Linux and macOS systems via system package managers.
CRAN Windows builders do not provide CLN or GiNaC by default. For this
reason, the package declares OS_type: unix in DESCRIPTION and is
intended for CRAN builds on Linux and macOS platforms only.
The Windows installation instructions provided in INSTALL.md are for manual source builds outside CRAN infrastructure.
GPL (>= 3)
https://github.com/bogdanoancea/finitization/issues
Maintainer: Bogdan Oancea bogdan.oancea@gmail.com