find_best_fit {simukde}R Documentation

Find The Best Fitting Distribution

Description

It finds the best fitting distribution from supported univariate continuous distributions for given data.

Usage

find_best_fit(
  x,
  positive = FALSE,
  plot = TRUE,
  legend.pos = "topright",
  dlc = NULL,
  dlw = 1,
  ...
)

Arguments

x

a numeric vector; data.

positive

a logical constant; distribution type.

plot

a logical constant. If TRUE (default), a histogram and density lines are drawn.

legend.pos

a character string. Indicates the legend position and must be one of "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright" (default), "right" and "center".

dlc

a vector; probability density line colors for supported (up to 7) distributions. If unspecified, the rainbow color palette will be used.

dlw

a numerical constant; probability density line width.

...

Further arguments and parameters for the function hist, particularly, main title and axis labels. However, the parameter freq is not able to override.

Details

This function is supported following univariate distributions:

Legends of the plot are ordered by p-values of the test.

Value

A list containing the following items:

distribution

the name of the best fitting distribution.

ks.statistic

the Kolmogorov-Smirnov test statistic for the distribution.

p.value

the p-value of the test.

summary

results similar to above for other distributions.

x

given data.

n

the sample size.

References

  1. William J. Conover (1971). Practical Nonparametric Statistics. New York: John Wiley & Sons. Pages 295–301.

  2. Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.

See Also

ks.test, fitdistr, hist

Examples

petal.length <- datasets::iris$Petal.Length[datasets::iris$Species == "setosa"]
simukde::find_best_fit(x = petal.length, positive = TRUE)

[Package simukde version 1.3.0 Index]