sepfit: Fit a Skewed Exponential Power density via maximum likelihood

View source: R/RcppExports.R

sepfitR Documentation

Fit a Skewed Exponential Power density via maximum likelihood

Description

sepfit returns the parameters, standard errors. negative log-likelihood and covariance matrix of the skewed power exponential for a sample. The process performs a global minimization over the negative log-likelihood function. See details below.

Usage

sepfit(
  data,
  verb = 0L,
  par = as.numeric(c(0, 1, 2, 0)),
  g_opt_par = as.numeric(c(0.1, 0.01, 100, 0.001, 1e-05, 2))
)

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 headings and summary table

  • 2 intermediate steps results

  • 3 intermediate steps internals

  • 4+ details of optim. routine

par

NumericVector - vector containing the initial guess for parameters m (location), a (scale), b (shape), lambda (skewness), respectively. Default values of are c(0, 1, 2, 0), i.e. a normal distribution.

g_opt_par

NumericVector - vector containing the global optimization parameters. The optimization parameters are:

  • step - (num) initial step size of the searching algorithm.

  • tol - (num) line search tolerance.

  • iter - (int) maximum number of iterations.

  • eps - (num) gradient tolerance. The stopping criteria is ||\text{gradient}||<\text{eps}.

  • msize - (num) simplex max size. stopping criteria given by ||\text{max edge}||<\text{msize}

  • algo - (int) algorithm. the optimization method used:

    • 0 Fletcher-Reeves

    • 1 Polak-Ribiere

    • 2 Broyden-Fletcher-Goldfarb-Shanno

    • 3 Steepest descent

    • 4 Nelder-Mead simplex

    • 5 Broyden-Fletcher-Goldfarb-Shanno ver.2

Details for each algorithm are available on the 'GSL' Manual. Default values are c(.1, 1e-2, 100, 1e-3, 1e-5, 2).

Details

The SEP is a exponential power distribution controlled by four parameters, with formula:

f(x; m, b, a, \lambda) = 2 \Phi(w) e^{-|z|^b/b}/(c)

where:

z = (x-m)/a

w = sign(z) |z|^{(b/2)} \lambda \sqrt{2/b}

c = 2 ab^{(1/b)-1} \Gamma(1/b)

with \Phi the cumulative normal distribution with mean zero and variance one. Details on the method are available on the package vignette.

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.

Examples

sample_subbo <- rpower(1000, 1, 2)
sepfit(sample_subbo)

Rsubbotools documentation built on April 16, 2025, 5:10 p.m.