knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" ) library(rmo) library(tidyverse) library(ggplot2) set.seed(1623)
An R package for constructing and simulating high-dimensional Marshall-Olkin (MO) distributions, making it simple and fun to use them for research and real-world applications. Read more about simulating high-dimensional MO distributions in [@Sloot2022a].
You can install the development version from GitHub using the devtools
package
with:
# install.packages("devtools") devtools::install_github("hsloot/rmo")
Simulating high-dimensional Marshall–Olkin distributions is made simple with the
rpextmo()
function. Here is a basic example:
rpextmo( n = 10, # number of samples d = 3, # dimension eta = log2(2 - 0.5), # distribution family parameter family = "AlphaStable" # distribution family )
All parametric families are linked to so-called Bernstein functions. The class of Bernstein functions is closed under addition, scaling, and composite scaling. You can create new Bernstein functions and simulate from them. Here is an example:
# Create a custom Bernstein function parametrization alpha <- log2(2 - 0.5) x0 <- 5e-4 bf <- SumOfBernsteinFunctions( first = LinearBernsteinFunction( scale = alpha * x0^(1 - alpha) / (1 - alpha) / gamma(1 - alpha) ), second = ScaledBernsteinFunction( scale = x0^(-alpha) / gamma(1 - alpha), original = ParetoBernsteinFunction( alpha = alpha, x0 = x0 ) ) ) # Simulate from the custom Bernstein function parametrization rextmo(n = 10, d = 3, bf = bf)
While the package is extensively tested, numerical issues may arise in high-dimensional simulations due to very small or large numbers. We recommend performing statistical tests suitable for your use-case to ensure validity. For more guidance, refer to our statistical unit tests and submit an issue report if you encounter statistical problems.
Additionally, note that while the package reached a certain level of stability,
it is still under active development. We aim to keep the interface of the
primary function rpextmo()
backwards compatible, the implementation may
undergo changes.
The package is documented using roxygen2
and pkgdown
. You can find the
documentation on the project website.
The package is tested using testthat
. You can run the tests using the
following command after checking out the repository:
devtools::test()
The changelog is available in the NEWS.md file.
Contributions to rmo
are welcome! You contribution can be about improving the
documentation, writing tests, raising issues or feature requests, implementing
feature requests, or fixing bugs. Check out our contribution
guide to get started.
GPL-3 Henrik Sloot
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.