univariateML

univariateML: An R package for maximum likelihood estimation of univariate densities - Published in JOSS (2019)

https://github.com/jonasmoss/univariateml

Science Score: 95.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org
  • Committers with academic emails
    2 of 3 committers (66.7%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

density estimation maximum-likelihood

Scientific Fields

Earth and Environmental Sciences Physical Sciences - 40% confidence
Last synced: 4 months ago · JSON representation

Repository

An R package for maximum likelihood estimation of univariate densities.

Basic Info
Statistics
  • Stars: 9
  • Watchers: 1
  • Forks: 6
  • Open Issues: 4
  • Releases: 6
Topics
density estimation maximum-likelihood
Created over 6 years ago · Last pushed 10 months ago
Metadata Files
Readme Contributing License Code of conduct

README.Rmd

---
output:
  github_document:
    html_preview: true
---



```{r, echo = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-"
)
```

# univariateML 
[![R-CMD-check](https://github.com/JonasMoss/univariateML/workflows/R-CMD-check/badge.svg)](https://github.com/JonasMoss/univariateML/actions)
[![Codecov test coverage](https://codecov.io/gh/JonasMoss/univariateML/branch/master/graph/badge.svg)](https://app.codecov.io/gh/JonasMoss/univariateML?branch=master)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![DOI](https://joss.theoj.org/papers/10.21105/joss.01863/status.svg)](https://doi.org/10.21105/joss.01863)
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/univariateML)](https://cran.r-project.org/package=univariateML)

```{r setup, include = FALSE}
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(out.width = "750px", dpi = 200)
set.seed(313)
```

## Overview
[`univariateML`](https://jonasmoss.github.io/univariateML/index.html) is an `R`-package for
user-friendly maximum likelihood estimation of a
[selection](https://jonasmoss.github.io/univariateML/articles/distributions.html) of parametric univariate densities and probability mass functions. In addition to basic estimation capabilities,
this package support visualization through `plot` and `qqmlplot`, model selection
by `AIC` and `BIC`, confidence sets through the parametric bootstrap with
`bootstrapml`, and convenience functions such as the density, distribution 
function, quantile function, and random sampling at the estimated distribution
parameters.

## Installation
Use the following command from inside `R` to install from CRAN.
```{r install, echo = TRUE, eval = FALSE}
install.packages("univariateML")
```

Or install the development version from Github.
```{r install_github, echo = TRUE, eval = FALSE}
# install.packages("devtools")
devtools::install_github("JonasMoss/univariateML")
```

## Usage

The core of `univariateML` are the `ml***` functions, where `***` is a 
distribution suffix such as `norm`, `gamma`, or `weibull`.

```{R, mlweibull}
library("univariateML")
mlweibull(egypt$age)
```

Now we can visually assess the fit of the Weibull model to the `egypt` data with
a plot.

```{R, weibull_plot}
hist(egypt$age, freq = FALSE, xlab = "Mortality", main = "Egypt")
lines(mlweibull(egypt$age))
```

## Supported distributions

### Continuous distributions
| Name                                | univariateML function  | Package    | 
| ----------------------------------- | ---------------------- | ---------- | 
| Cauchy distribution                 | `mlcauchy`             | stats      | 
| Gumbel distribution                 | `mlgumbel`             | extraDistr | 
| Laplace distribution                | `mllaplace`            | extraDistr | 
| Logistic distribution               | `mllogis`              | stats      | 
| Normal distribution                 | `mlnorm`               | stats      | 
| Student t distribution              | `mlstd`                | fGarch     | 
| Generalized Error distribution      | `mlged`                | fGarch     | 
| Skew Normal distribution            | `mlsnorm`              | fGarch     | 
| Skew Student t distribution         | `mlsstd`               | fGarch     | 
| Skew Generalized Error distribution | `mlsged`               | fGarch     | 
| Beta prime distribution             | `mlbetapr`             | extraDistr |
| Exponential distribution            | `mlexp`                | stats      | 
| Gamma distribution                  | `mlgamma`              | stats      | 
| Inverse gamma distribution          | `mlinvgamma`           | extraDistr |
| Inverse Gaussian distribution       | `mlinvgauss`           | actuar     |
| Inverse Weibull distribution        | `mlinvweibull`         | actuar     |
| Log-logistic distribution           | `mlllogis`             | actuar     |
| Log-normal distribution             | `mllnorm`              | stats      |
| Lomax distribution                  | `mllomax`              | extraDistr | 
| Rayleigh distribution               | `mlrayleigh`           | extraDistr | 
| Weibull distribution                | `mlweibull`            | stats      |
| Log-gamma distribution              | `mllgamma`             | actuar     |
| Pareto distribution                 | `mlpareto`             | extraDistr |
| Beta distribution                   | `mlbeta`               | stats      |
| Kumaraswamy distribution            | `mlkumar`              | extraDistr |
| Logit-normal                        | `mllogitnorm`          | logitnorm  |
| Uniform distribution                | `mlunif`               | stats      |
| Power distribution                  | `mlpower`              | extraDistr |
| Gompertz distribution               | `mlgompertz`           | extraDistr |
| Burr distribution                   | `mlburr`               | actuar     |
| Inverse Burr distribution           | `mlinvburr`            | actuar     |
| Birnbaum-Saunders                   | `mlfatigue`            | extraDistr |

### Discrete distributions

| Name                                | univariateML function  | Package    | 
| ----------------------------------- | ---------------------- | ---------- | 
| Poisson distribution                | `mlpois`               | stats      |
| Negative binomial distribution      | `mlnbinom`             | stats      |
| Binomial distribution               | `mlbinom`              | stats      |
| Geometric distribution              | `mlgeom`               | stats      |
| Zipf distribution                   | `mlzipf`               | sads       |
| Zero-inflated Poisson distribution  | `mlzip`                | extraDistr |
| Discrete uniform distribution       | `mldunif`              | extraDistr |
| Logarithmic series distribution     | `mldunif`              | extraDistr |

## Implementations

Analytic formulae for the maximum likelihood estimates are used whenever
they exist. Most `ml***` functions without analytic solutions have a custom made
Newton-Raphson solver. These can be much faster than a naïve solution using 
`nlm` or `optim`. For example, `mlbeta` has a large speedup over the naïve
solution using `nlm`.

```{R, beta, warning = FALSE, cache = TRUE}
# install.packages("microbenchmark")
set.seed(313)
x <- rbeta(500, 2, 7)

microbenchmark::microbenchmark(
  univariateML = univariateML::mlbeta(x),
  naive = nlm(function(p) -sum(dbeta(x, p[1], p[2], log = TRUE)), p = c(1, 1))
)
```

The maximum likelihood estimators in this package have all been subject to
testing, see the `tests` folder for details. 


## Documentation
For an overview of the package and its features see the 
[overview vignette](https://jonasmoss.github.io/univariateML/articles/overview.html). 
For an illustration of how this package can make an otherwise long and 
laborious process much simpler, see the [copula vignette](https://jonasmoss.github.io/univariateML/articles/copula.html).

## How to Contribute or Get Help

Please read `CONTRIBUTING.md` for details about how to contribute or get help.

Owner

  • Name: Jonas Moss
  • Login: JonasMoss
  • Kind: user
  • Location: Oslo
  • Company: BI Norwegian Business School

Assistant professor in statistics.

JOSS Publication

univariateML: An R package for maximum likelihood estimation of univariate densities
Published
December 04, 2019
Volume 4, Issue 44, Page 1863
Authors
Jonas Moss ORCID
University of Oslo
Editor
Arfon Smith ORCID
Tags
statistics maximum likelihood density estimation

GitHub Events

Total
  • Create event: 2
  • Release event: 1
  • Issues event: 7
  • Watch event: 1
  • Delete event: 1
  • Issue comment event: 17
  • Push event: 22
  • Pull request event: 5
Last Year
  • Create event: 2
  • Release event: 1
  • Issues event: 7
  • Watch event: 1
  • Delete event: 1
  • Issue comment event: 17
  • Push event: 22
  • Pull request event: 5

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 345
  • Total Committers: 3
  • Avg Commits per committer: 115.0
  • Development Distribution Score (DDS): 0.072
Past Year
  • Commits: 63
  • Committers: 2
  • Avg Commits per committer: 31.5
  • Development Distribution Score (DDS): 0.063
Top Committers
Name Email Commits
Jonas Moss j****n@g****m 320
tnagler t****r@t****e 21
Chitu Okoli C****i@s****u 4
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 43
  • Total pull requests: 16
  • Average time to close issues: 12 months
  • Average time to close pull requests: 7 days
  • Total issue authors: 6
  • Total pull request authors: 4
  • Average comments per issue: 1.35
  • Average comments per pull request: 0.69
  • Merged pull requests: 14
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 3
  • Pull requests: 6
  • Average time to close issues: 9 days
  • Average time to close pull requests: 5 days
  • Issue authors: 3
  • Pull request authors: 2
  • Average comments per issue: 1.67
  • Average comments per pull request: 0.67
  • Merged pull requests: 5
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • JonasMoss (33)
  • tnagler (5)
  • oezgesahin (2)
  • niklhart (1)
  • tripartio (1)
  • jakeberv (1)
Pull Request Authors
  • JonasMoss (8)
  • tripartio (6)
  • tnagler (5)
  • oezgesahin (1)
Top Labels
Issue Labels
enhancement (7) documentation (7) improvement (3) test (2)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 1,073 last-month
  • Total dependent packages: 3
  • Total dependent repositories: 2
  • Total versions: 4
  • Total maintainers: 1
cran.r-project.org: univariateML

Maximum Likelihood Estimation for Univariate Densities

  • Versions: 4
  • Dependent Packages: 3
  • Dependent Repositories: 2
  • Downloads: 1,073 Last month
Rankings
Forks count: 10.8%
Dependent packages count: 13.7%
Downloads: 14.2%
Average: 15.5%
Dependent repos count: 19.2%
Stargazers count: 19.3%
Maintainers (1)
Last synced: 4 months ago

Dependencies

DESCRIPTION cran
  • R >= 2.10 depends
  • actuar * imports
  • assertthat * imports
  • extraDistr * imports
  • fGarch * imports
  • logitnorm * imports
  • nakagami * imports
  • tibble * imports
  • copula * suggests
  • covr * suggests
  • dplyr * suggests
  • knitr * suggests
  • markdown * suggests
  • rmarkdown * suggests
  • testthat * suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v4 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.5.0 composite
  • actions/checkout v4 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite