MyNixOS website logo
Description

Maximum Likelihood Estimation for Univariate Densities.

User-friendly maximum likelihood estimation (Fisher (1921) <doi:10.1098/rsta.1922.0009>) of univariate densities.

univariateML

R-CMD-check Codecov testcoverage Project Status: Active – The project has reached a stable, usablestate and is being activelydeveloped. DOI CRAN_Status_Badge

Overview

univariateML is an R-package for user-friendly maximum likelihood estimation of a selection of parametric univariate densities. 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.

install.packages("univariateML")

Or install the development version from Github.

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

library("univariateML")
mlweibull(egypt$age)
#> Maximum likelihood estimates for the Weibull model 
#>  shape   scale  
#>  1.404  33.564

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

hist(egypt$age, freq = FALSE, xlab = "Mortality", main = "Egypt")
lines(mlweibull(egypt$age))

Supported densities

NameunivariateML functionPackage
Cauchy distributionmlcauchystats
Gumbel distributionmlgumbelextraDistr
Laplace distributionmllaplaceextraDistr
Logistic distributionmllogisstats
Normal distributionmlnormstats
Student t distributionmlstdfGarch
Generalized Error distributionmlgedfGarch
Skew Normal distributionmlsnormfGarch
Skew Student t distributionmlsstdfGarch
Skew Generalized Error distributionmlsgedfGarch
Beta prime distributionmlbetaprextraDistr
Exponential distributionmlexpstats
Gamma distributionmlgammastats
Inverse gamma distributionmlinvgammaextraDistr
Inverse Gaussian distributionmlinvgaussactuar
Inverse Weibull distributionmlinvweibullactuar
Log-logistic distributionmlllogisactuar
Log-normal distributionmllnormstats
Lomax distributionmllomaxextraDistr
Rayleigh distributionmlrayleighextraDistr
Weibull distributionmlweibullstats
Log-gamma distributionmllgammaactuar
Pareto distributionmlparetoextraDistr
Beta distributionmlbetastats
Kumaraswamy distributionmlkumarextraDistr
Logit-normalmllogitnormlogitnorm
Uniform distributionmlunifstats
Power distributionmlpowerextraDistr

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.

# 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)))
#> Unit: microseconds
#>          expr     min       lq      mean   median       uq     max neval
#>  univariateML   259.2   348.75   557.959   447.05   536.40  5103.5   100
#>         naive 15349.1 15978.35 16955.165 16365.45 17082.25 48941.4   100

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. For an illustration of how this package can make an otherwise long and laborious process much simpler, see the copula vignette.

How to Contribute or Get Help

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

Metadata

Version

1.1.1

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows