fitDist: Distribution fitting

View source: R/fitting.R

fitDistR Documentation

Distribution fitting

Description

Fits a parametric distribution to data using the Nelder-Mead simplex algorithm to minimise one of four fitting norms.

Usage

fitDist(
  data,
  dist,
  n.points,
  norm,
  constrain,
  opts = list(algorithm = "NLOPT_LN_NELDERMEAD", xtol_rel = 1e-08, maxeval = 10000)
)

Arguments

data

numeric vector of values to fit

dist

character; distribution name (e.g. "norm", "ggamma")

n.points

integer; number of ECDF points used in norm computation

norm

character; norm identifier — one of "N1" (ratio RMSE on quantiles), "N2" (MSE on quantiles), "N3" (ratio RMSE on probabilities), "N4" (MSE on probabilities)

constrain

logical; if TRUE, constrains shape2 parameters to (0, 0.48) to enforce finite upper tails

opts

list of nloptr minimisation options

Value

An object of class "fitDist": a named list of fitted distribution parameters with attributes dist, edf (empirical CDF), and nfo (full nloptr output).

See Also

fitACS, plot.fitDist

Examples


x <- fitDist(rnorm(1000), "norm", 30, "N1", FALSE)
x


CoSMoS documentation built on May 8, 2026, 1:08 a.m.