knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
library(rmo)
library(tidyverse)
library(ggplot2)
set.seed(1623)

rmo

minimal R version packageversion Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. Lifecycle: experimental Last-changedate R build status Codecov test coverage

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].

Installation

You can install the development version from GitHub using the devtools package with:

# install.packages("devtools")
devtools::install_github("hsloot/rmo")

Basic usage

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
)

Advanced usage

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)

Word(s) of caution

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.

API documentation

The package is documented using roxygen2 and pkgdown. You can find the documentation on the project website.

Testing

The package is tested using testthat. You can run the tests using the following command after checking out the repository:

devtools::test()

Changelog

The changelog is available in the NEWS.md file.

Contributing

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.

References

License

GPL-3 Henrik Sloot



hsloot/rmo documentation built on April 25, 2024, 10:41 p.m.