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 |
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 |
Details
This function is supported following univariate distributions:
for positive random variables: Log normal, Exponential, Gamma and Weibull.
for all random variables: Normal, Cauchy, Log normal, Exponential, Gamma, Weibull and Uniform.
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
William J. Conover (1971). Practical Nonparametric Statistics. New York: John Wiley & Sons. Pages 295–301.
Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.
See Also
Examples
petal.length <- datasets::iris$Petal.Length[datasets::iris$Species == "setosa"]
simukde::find_best_fit(x = petal.length, positive = TRUE)