diag.hgld: Diagnostic for the Hurdle Generalized Lambda Distribution

Description Usage Arguments Details Value References Examples

View source: R/diag.hgld.R

Description

Diagnostic plots and measures of goodness-of-fit for a Hurdle Generalized Lambda Distribution.

Usage

1
2
3
4
diag.hgld(fit, facet = FALSE, facet.breaks, facet.labels, facet.ncol,
  trace = TRUE, no.test = 1000, len = floor(0.9 *
  length(fit$data[fit$data != 0])), alpha = 0.05, plotKS = TRUE,
  KS = TRUE)

Arguments

fit

An object of class fit.hgld.

facet

Whether the plots must be faceted for better visualization.

facet.breaks

The breaks in which to facet the data. Must be the endpoints of the intervals.

facet.labels

The labels of the categories given by the facet breaks.

facet.ncol

The number of columns for the facet plot.

trace

Whether a progress bar must be printed in order to trace the algorithm.

no.test

Total number of KS tests required.

len

Number of data to sample at each KS test.

alpha

Significance level of KS test.

plotKS

Whether to plot the KS resample test result within each plot.

KS

Whether the resample KS test must be performed to the non-zero values.

Details

The diagnostics techniques are applied to the non-zero data values. Returns the qq-plot and the quantile plot between the data and the theoretical fitted HGLD. Also returns a table comparing sample moments with theoretical moments. A Kolmogorov-Simornov resample test is performed and the percentage of the times that the null hypotheses, i.e., goodness-of-fit, is not rejected is displayed. All diagnostics are performed for both the RS and fmkl HGLD.

Value

qqRS

ggplot qq-plot for the RS HGLD.

qqfmkl

ggplot qq-plot for the fmkl HGLD.

quantRS

ggplot quantile plot for the RS HGLD.

quantfmkl

ggplot quantile plot for the fmkl HGLD.

moments

Moments comparison for the GLD fitted to the non-zero data for both parametrizations. These are not the moments of the HGLD, but are instead the moments of the GLD fitted to the non-zero data values.

KS

Percentage of no rejection for the KS resample test.

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
 9
10
set.seed(100)
data <- healthcare[sample(1:nrow(healthcare),50),]
fit <- fit.hgld(data$log_expense)
d <- diag.hgld(fit,facet = FALSE,plotKS = FALSE)

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

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