Search code examples
rstatisticsdata-fittingmodel-fittingkolmogorov-smirnov

Distribution fitting using various criteria in R


Consider me to be an undergraduate student doing a routine research study.

Is there a simple, straight forward way to find and access (or implement) distribution fitting in R using the following estimates:

  • Kolmogorov-Smirnov Minimum Distance estimate
  • Cramér–von Mises Minimum Distance estimate
  • Anderson-Darling Minimum Distance estimate
  • Maximum Likelihood Estimate

I got my self lost in tons of documentation and reference manuals on various R packages.

The question more relates to using R software system than to statistics itself, that's why I asked it here, at SO.


Solution

  • library(fitdistrplus)
    
    # normally distributed sample
    x1 = rnorm(100)
    
    # Kolmogorov-Smirnov mimimum distance method
    fitdist(x1, "mge", distr="norm", gof="KS")
    
    # Cramer-von Mises
    fitdist(x1, "mge", distr="norm", gof="CvM")
    
    # Anderson-Darling
    fitdist(x1, "mge", distr="norm", gof="AD")
    
    # Maximum Likelihood estimate
    fitdist(x1, "mle", distr="norm")
    

    Things are appeared to be pretty straight forward.