bestfit {PredictionR}R Documentation

Best fitting of a distribution to a data

Description

Fit of a distribution to a data by two methods: maximum likelihood (mle) and moment matching (mme). Kolmogorov-Smirnov test is used to construct the best fitting.

Usage

bestfit(data, dist , order=NULL, start=NULL, conf=0.95)

Arguments

data

A numeric vector

dist

A character string "name" naming a distribution for which the corresponding density function dname, the corresponding distribution function pname and the corresponding quantile function qname must be defined.

order

A numeric vector for the moment order(s). The length of this vector must be equal to the number of parameters to estimate. This argument may be omitted(default) for some distributions for which reasonable order are computed.

start

A named list giving the initial values of parameters of the named distribution. This argument may be omitted(default) for some distributions for which reasonable starting values are computed.

conf

Confidence level for the test.

Details

This function is not intended to be called directly but is internally called in predI and predP. It is assumed that the two methods: "mle" and "mme" are applied then Kolmogorov-Smirnov test is used to construct the best fitting.

Value

bestfit returns a list with following components,

fit

the parameter estimates.

p.value

the pvalue of the Kolmogorov-Smirnov Test.

Author(s)

H. M. Barakat, O. M. Khaled and Hadeer A. Ghonem.

References

Delignette-Muller ML and Dutang C (2015), fitdistrplus: An R Package for Fitting Distributions. Journal of Statistical Software, 64(4), 1-34.

See Also

predI, predP.

Examples


#best fitting of a logistic distribution
#
n=100
x1 <- rlogis(n, 0.5, 0.8)
bestfit(x1, "logis")
bestfit(x1, "logis")$p.value


[Package PredictionR version 1.0-12 Index]