Learn R Programming

Rsubbotools (version 0.0.1)

alaplafit: Fit an Asymmetric Laplace Distribution via maximum likelihood

Description

alaplafit returns the parameters, standard errors. negative log-likelihood and covariance matrix of the Asymmetric Laplace Distribution for a sample. See details below.

Usage

alaplafit(data, verb = 0L, interv_step = 10L, provided_m_ = NULL)

Value

a list containing the following items:

  • "dt" - dataset containing parameters estimations and standard deviations.

  • "log-likelihood" - negative log-likelihood value.

  • "matrix" - the covariance matrix for the parameters.

Arguments

data

(NumericVector) - the sample used to fit the distribution.

verb

(int) - the level of verbosity. Select one of:

  • 0 just the final result

  • 1 details of optim. routine

interv_step

int - the number of intervals to be explored after the last minimum was found in the interval optimization. Default is 10.

provided_m_

NumericVector - if NULL, the m parameter is estimated by the routine. If numeric, the estimation fixes m to the given value.

Details

The Asymmetric Laplace distribution is a distribution controlled by three parameters, with formula: $$f(x;a_l,a_r,m) = \frac{1}{A} e^{-|\frac{x-m}{a_l}| }, x < m$$ $$f(x;a_l,a_r,m) = \frac{1}{A} e^{-|\frac{x-m}{a_r}| }, x > m$$ with: $$A = a_l + a_r$$ where \(a*\) are scale parameters, and \(m\) is a location parameter. It is basically derived from the Asymmetric Exponential Power distribution by setting \(b_l = b_r = b\). The estimations are produced by maximum likelihood, where analytical formulas are available for the \(a*\) parameters. The \(m\) parameter is found by an iterative method, using the median as the initial guess. The method explore intervals around the last minimum found, similar to the subboafit routine. Details on the method can be found on the package vignette.

Examples

Run this code
sample_subbo <- rpower(1000, 1, 1)
alaplafit(sample_subbo)

Run the code above in your browser using DataLab