fit.hgld: Fit the Hurdle Generalized Lambda Distribution

Description Usage Arguments Details Value References Examples

View source: R/fit.hgld.R

Description

Fit the Hurdle Generalized Lambda Distribution to a dataset by the Numerical Maximum Likelihood Method.

Usage

1
2
3
4
5
fit.hgld(data, mixture = FALSE, clustering.m = clara,
  threshold = NULL, leap1 = 3, leap2 = 3, fun1 = "runif.sobol",
  fun2 = "runif.sobol", rs.leap = 3, fmkl.leap = 3,
  rs.init = c(-1.5, 1.5), fmkl.init = c(-0.25, 1.5),
  FUN = "runif.sobol", no = 10000)

Arguments

data

A vector of data.

mixture

Whether a mixture of HGLD must be fitted.

clustering.m

Clustering method used in classifying the dataset into two parts when fitting a mixture of HGLD. Valid arguments include clara, fanny and pam from the cluster library, or threshold, if the data must be divided by a threshold. Default is clara. Or a logical vector specifying how data should be split. See fun.auto.bimodal.pml for more details.

threshold

The threshold to divide the data if clustering.m = "threshold".

leap1

Scrambling (0,1,2,3) for the sobol sequence for the first distribution fit when fitting a mixture of HGLD. See scrambling/leap argument for runif.sobol, runif.halton or QUnif of the GLDEX package.

leap2

Scrambling (0,1,2,3) for the sobol sequence for the second distribution fit when fitting a mixture of HGLD. See scrambling/leap argument for runif.sobol, runif.halton or QUnif of the GLDEX package.

fun1

A character string of either "runif.sobol" (default), "runif.halton" or "QUnif" for the first distribution fit when fitting a mixture of HGLD. See fun.auto.bimodal.pml for more details.

fun2

A character string of either "runif.sobol" (default), "runif.halton" or "QUnif" for the second distribution fit when fitting a mixture of HGLD. See fun.auto.bimodal.pml for more details.

rs.leap

Scrambling (0,1,2,3) for the sobol sequence for the RS generalized lambda distribution fit. See scrambling/leap argument for runif.sobol, runif.halton or QUnif of the GLDEX package. See fun.data.fit.ml for more details.

fmkl.leap

Scrambling (0,1,2,3) for the sobol sequence for the fmkl generalized lambda distribution fit. See scrambling/leap argument for runif.sobol, runif.halton or QUnif of the GLDEX package. See fun.data.fit.ml for more details.

rs.init

Initial values (lambda3 and lambda4) for the RS generalized lambda distribution. See fun.data.fit.ml for more details.

fmkl.init

Initial values (lambda3 and lambda4) for the fmkl generalized lambda distribution. See fun.data.fit.ml for more details.

FUN

A character string of either "runif.sobol" (default), "runif.halton" or "QUnif". See fun.data.fit.ml for more details.

no

Number of initial random values to find the best initial values for optimization. See fun.data.fit.ml for more details.

Details

Given a dataset, estimate by the Numerical Maximum Likelihood Method the five parameters of the HGLD. Fit both the RS and the fmkl parametrizations. Also fit a mixture of HGLDs.

Value

par

The estimate of the HGLD five parameters for both the RS and fmkl parametrizations if mixture = FALSE. Otherwise present the estimation of ten parameters: the zero probability mass, the four parameters of each GLD and the clustering parameter p.

data

The data used in the fit.

mixture

Whether a mixture of HGLD was fitted.

References

Marcondes, D.; Peixoto, C.; Maia, A. C.; A Survey of a Hurdle Model for Heavy-Tailed Data Based on the Generalized Lambda Distribution. (2017) arxiv1712.02183

Su, S.; Fitting Single and Mixture of Generalized Lambda Distributions to Data via Discretized and Maximum Likelihood Methods: GLDEX in R.(2007), Journal of Statistical Software: *21* 9.

Examples

1
2
3
4
5
6
7
8
set.seed(100)
data <- healthcare[sample(1:nrow(healthcare),30),]
fit <- fit.hgld(data$log_expense)

#mixture
set.seed(100)
data <- c(rcauchy(20,location = 10),rep(0,10),rcauchy(20))
fit2 <- fit.hgld(data = data,mixture = TRUE)

dmarcondes/HGLD documentation built on May 28, 2019, 12:56 p.m.