Learn R Programming

Rsubbotools (version 0.0.1)

laplafit: Fit a Laplace Distribution via maximum likelihood

Description

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

Usage

laplafit(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 Laplace distribution is a distribution controlled by two parameters, with formula: $$f(x;a,m) = \frac{1}{2a} e^{- \left| \frac{x-m}{a} \right| }$$ where \(a\) is a scale parameter, and \(m\) is a location parameter. The estimations are produced by maximum likelihood, where analytical formulas are available. Details on the method can be found on the package vignette.

Examples

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

Run the code above in your browser using DataLab