Fitting of probability distributions to data.
A distribution is fitted by its key (see fastmath.random/distribution) to a sample. What the engine needs to know about the distribution comes from fastmath.random/fit-spec: the fitted parameters with their domains and roles, the data validation and, optionally, closed form estimators and starting values. Distributions without a specification can't be fitted.
The methods are the maximum likelihood estimate (:mle), the minimum goodness-of-fit estimates (:ks, :cvm, :ad and its variants), the maximum product of spacings (:mps), quantile matching (:qme), moment matching (:mme) and L-moment matching (:lmme). An estimate is a closed form one when the specification has an exact estimator for the method, otherwise it is found numerically: the box constrained quasi-Newton method L-BFGS-B (the simplex method for the minimum distance methods) started from the starting values of the specification or, when there are none, from the best points of a scan of the parameter space with a quantile matching objective.
Functions:
fit fits a distribution and returns the fitted distribution, its parameters and statistics: information criteria, standard errors of the maximum likelihood estimate and, for continuous distributions, goodness-of-fit statistics (the chi-square statistic for discrete ones). The statistics are descriptive, there are no p-values.bootstrap refits resamples of the data and returns the bootstrap distribution and intervals of every parameter.qq and pp return the data of quantile-quantile and probability-probability plots.compare ranks fits of one sample by an information criterion, with Akaike weights.Fitting of probability distributions to data. A distribution is fitted by its key (see [[fastmath.random/distribution]]) to a sample. What the engine needs to know about the distribution comes from [[fastmath.random/fit-spec]]: the fitted parameters with their domains and roles, the data validation and, optionally, closed form estimators and starting values. Distributions without a specification can't be fitted. The methods are the maximum likelihood estimate (`:mle`), the minimum goodness-of-fit estimates (`:ks`, `:cvm`, `:ad` and its variants), the maximum product of spacings (`:mps`), quantile matching (`:qme`), moment matching (`:mme`) and L-moment matching (`:lmme`). An estimate is a closed form one when the specification has an exact estimator for the method, otherwise it is found numerically: the box constrained quasi-Newton method L-BFGS-B (the simplex method for the minimum distance methods) started from the starting values of the specification or, when there are none, from the best points of a scan of the parameter space with a quantile matching objective. Functions: - [[fit]] fits a distribution and returns the fitted distribution, its parameters and statistics: information criteria, standard errors of the maximum likelihood estimate and, for continuous distributions, goodness-of-fit statistics (the chi-square statistic for discrete ones). The statistics are descriptive, there are no p-values. - [[bootstrap]] refits resamples of the data and returns the bootstrap distribution and intervals of every parameter. - [[qq]] and [[pp]] return the data of quantile-quantile and probability-probability plots. - [[compare]] ranks fits of one sample by an information criterion, with Akaike weights.
(bootstrap dist-key data)(bootstrap dist-key
data
{:keys [samples alpha ci-type rng]
:or {samples 200 alpha 0.05 ci-type :percentile}
:as opts})Bootstrap of the parameters of a fitted distribution: the nonparametric bootstrap with confidence intervals.
The distribution is fitted to data with fit, then to :samples resamples of data drawn with replacement (see fastmath.stats.bootstrap/bootstrap). The refits run in parallel (pmap), skip the statistics, and each gets its own generator seeded from :rng, so the result is the same for a seeded :rng. A refit which throws (a resample which the distribution can't be fitted to) is left out.
Parameters:
dist-key (keyword): A key of fastmath.random/distribution which has a specification, see fit.data (sequence of numbers): The sample.opts (map, optional): The options of fit (:method, :fixed, :optimizer, :restarts, :closed-form? and the options of the method) are used for every fit; and
:samples (long, default 200): The number of resamples, at least 2.:alpha (double, default 0.05): The significance level, inside (0, 1); the intervals have the level 1 - alpha.:ci-type (keyword, default :percentile): The interval, :percentile, :basic, :normal, :bc or :mad-median, the median of the estimates -/+ their median absolute deviation (see fastmath.stats.bootstrap/ci-mad-median; the interval of fitdistr, it has no level and ignores :alpha); the others are described in fastmath.stats.bootstrap/ci-percentile, fastmath.stats.bootstrap/ci-basic, fastmath.stats.bootstrap/ci-normal and fastmath.stats.bootstrap/ci-bc.:rng: The random number generator of the resampling and of the seeds of the refits. The default is a new unseeded generator.Returns a map with the keys:
:fit: The result of fit for data.:replicates: The number of refits which succeeded.:alpha and :ci-type: As used.:params: A map from the name of every parameter which was not fixed (a searched integer included) to a map with :t0 (the estimate from data), :ts (the estimates of the resamples), :ci (the vector [lower upper] of the interval), :bias (the mean of :ts minus :t0) and :stddev (the standard deviation of :ts, the bootstrap standard error).Throws what fit throws for data, ex-info with :type :invalid-input for a wrong :samples, :alpha or :ci-type, and with :type :not-converged when fewer than two refits succeed.
See also fit, fastmath.stats.bootstrap/bootstrap.
Bootstrap of the parameters of a fitted distribution: the nonparametric bootstrap with confidence intervals. The distribution is fitted to `data` with [[fit]], then to `:samples` resamples of `data` drawn with replacement (see [[fastmath.stats.bootstrap/bootstrap]]). The refits run in parallel (`pmap`), skip the statistics, and each gets its own generator seeded from `:rng`, so the result is the same for a seeded `:rng`. A refit which throws (a resample which the distribution can't be fitted to) is left out. Parameters: - `dist-key` (keyword): A key of [[fastmath.random/distribution]] which has a specification, see [[fit]]. - `data` (sequence of numbers): The sample. - `opts` (map, optional): The options of [[fit]] (`:method`, `:fixed`, `:optimizer`, `:restarts`, `:closed-form?` and the options of the method) are used for every fit; and - `:samples` (long, default `200`): The number of resamples, at least `2`. - `:alpha` (double, default `0.05`): The significance level, inside `(0, 1)`; the intervals have the level `1 - alpha`. - `:ci-type` (keyword, default `:percentile`): The interval, `:percentile`, `:basic`, `:normal`, `:bc` or `:mad-median`, the median of the estimates -/+ their median absolute deviation (see [[fastmath.stats.bootstrap/ci-mad-median]]; the interval of `fitdistr`, it has no level and ignores `:alpha`); the others are described in [[fastmath.stats.bootstrap/ci-percentile]], [[fastmath.stats.bootstrap/ci-basic]], [[fastmath.stats.bootstrap/ci-normal]] and [[fastmath.stats.bootstrap/ci-bc]]. - `:rng`: The random number generator of the resampling and of the seeds of the refits. The default is a new unseeded generator. Returns a map with the keys: - `:fit`: The result of [[fit]] for `data`. - `:replicates`: The number of refits which succeeded. - `:alpha` and `:ci-type`: As used. - `:params`: A map from the name of every parameter which was not fixed (a searched integer included) to a map with `:t0` (the estimate from `data`), `:ts` (the estimates of the resamples), `:ci` (the vector `[lower upper]` of the interval), `:bias` (the mean of `:ts` minus `:t0`) and `:stddev` (the standard deviation of `:ts`, the bootstrap standard error). Throws what [[fit]] throws for `data`, `ex-info` with `:type :invalid-input` for a wrong `:samples`, `:alpha` or `:ci-type`, and with `:type :not-converged` when fewer than two refits succeed. See also [[fit]], [[fastmath.stats.bootstrap/bootstrap]].
(compare results)(compare results {:keys [criterion] :or {criterion :aic}})Compares results of fit fitted to the same sample in a table.
The rows are ordered from the best to the worst by the information criterion (the smallest value is the best).
Parameters:
results (sequence of results of fit): At least one; all fitted to the same data, all continuous or all discrete (see (fastmath.random/continuous? d); a density and a mass log likelihood can't be compared), with the statistics (not fitted with :stats? false).opts (map, optional):
:criterion (keyword, default :aic): :aic, :aicc or :bic, the criterion of the order and of the :rank.Returns a vector of rows, maps with the keys: :distribution (the key of the distribution), :method, :k, :n, :loglik, :aic, :aicc, :bic, :delta-aic and :delta-bic (the difference from the smallest value), :akaike-weight (relative likelihood of the model, exp(-delta-aic / 2) normalized to sum 1) and :rank (from 1). Continuous results add :ks, :cvm and :ad and discrete results add :chisq and :chisq-df, a value which a result doesn't have is nil. There are no p-values.
Throws ex-info with :type :invalid-input and :property :kind for results of both kinds, :property :n for results of different sample sizes, :property :results for no results or a result without the statistics and :property :criterion for an unknown criterion.
Compares results of [[fit]] fitted to the same sample in a table. The rows are ordered from the best to the worst by the information criterion (the smallest value is the best). Parameters: - `results` (sequence of results of [[fit]]): At least one; all fitted to the same data, all continuous or all discrete (see `(fastmath.random/continuous? d)`; a density and a mass log likelihood can't be compared), with the statistics (not fitted with `:stats? false`). - `opts` (map, optional): - `:criterion` (keyword, default `:aic`): `:aic`, `:aicc` or `:bic`, the criterion of the order and of the `:rank`. Returns a vector of rows, maps with the keys: `:distribution` (the key of the distribution), `:method`, `:k`, `:n`, `:loglik`, `:aic`, `:aicc`, `:bic`, `:delta-aic` and `:delta-bic` (the difference from the smallest value), `:akaike-weight` (relative likelihood of the model, `exp(-delta-aic / 2)` normalized to sum `1`) and `:rank` (from `1`). Continuous results add `:ks`, `:cvm` and `:ad` and discrete results add `:chisq` and `:chisq-df`, a value which a result doesn't have is `nil`. There are no p-values. Throws `ex-info` with `:type :invalid-input` and `:property :kind` for results of both kinds, `:property :n` for results of different sample sizes, `:property :results` for no results or a result without the statistics and `:property :criterion` for an unknown criterion. See also [[fit]], [[qq]], [[pp]].
(fit dist-key data)(fit dist-key
data
{:keys [method fixed optimizer restarts closed-form? rng se? stats? breaks]
:or {method :mle restarts 3 closed-form? true se? true stats? true}
:as opts})Fits a distribution to data.
The distribution is given by its key (see fastmath.random/distribution), the fitted parameters are the ones listed by fastmath.random/fit-spec. When the specification of the distribution has an exact closed form estimator for the method (and the fixed parameters are the ones it is declared for, none for most estimators, and :closed-form? is not false) it is the result. Otherwise the objective of the method is minimized, from a closed form estimate that is not exact or the starting values of the specification or the maximum likelihood estimate of the specification, or from the best points of a scan of the parameter space (a quantile matching objective over ranges derived from the data and the roles of the parameters) when it has none.
Methods (the :method option):
:mle: maximum likelihood, the default.:infer: the closed form maximum likelihood estimate and nothing else: the sample mean and standard deviation for the :mu and :sd of the normal distribution. It never runs the optimizer or the scan: when the specification has no exact closed form maximum likelihood estimator for the fixed parameters (one which is only a starting point for a numerical fit is not an estimate), or the estimator has no estimate for the data (for example constant data), it throws. The result is the one of :mle with :tier :closed-form, :method :infer and, as for :mle, the statistics and the standard errors. It can't be used with :closed-form? set to false.:ks, :cvm, :ad, :adr, :adl, :ad2r, :ad2l, :ad2: minimum distance, the minimum of the Kolmogorov-Smirnov, Cramer-von Mises or Anderson-Darling statistic or of one of its variants (see fastmath.stats/ks-statistic, fastmath.stats/cvm-statistic, fastmath.stats/ad-statistic).:mps: maximum product of spacings, the maximum of the mean logarithm of the spacings of the cumulative distribution function at the sorted sample. A spacing between tied observations is zero and is replaced by the density (mass) at the observation, so the method can be used for discrete distributions.:qme: quantile matching, the minimum of the mean squared distance of the sample quantiles and the distribution quantiles.:mme: moment matching, the first k raw moments (k is the number of fitted parameters) of the distribution equal to the ones of the sample.:lmme: L-moment matching, the first k L-moments of the distribution equal to the ones of the sample.Integer parameters (the :integer role, for example the trials of the binomial distribution) can't be found by the optimizer. When the specification gives a :range for the one which is not fixed, it is searched: for each integer the other parameters are fitted and the integer with the best value of the objective is chosen (the objective has to be unimodal in the integer). Otherwise an integer parameter has to be fixed.
Parameters:
dist-key (keyword): A key of fastmath.random/distribution which has a specification.data (sequence of numbers): The sample; it has to pass the validation of the specification (for example :gamma requires positive values and :poisson integers).opts (map, optional):
:method (keyword, default :mle): The estimation method.:fixed (map, default nil): Parameters which are not fitted, as a map from the name of a parameter to its value. At least one parameter has to stay free (or be searched).:optimizer (keyword): The method of fastmath.optimization used for the numerical minimization, :lbfgsb or :nelder-mead (its initial simplex is a fifth of the starting values). The default is :nelder-mead for the minimum distance methods (:ks, :cvm, :ad and its variants), whose objectives are not smooth or have plateaus, and :lbfgsb otherwise.:stats? (boolean, default true): Set to false to skip all the statistics (:stats is nil, :se? is ignored), as bootstrap does for its refits.:breaks (sequence of numbers, default nil): For discrete distributions, the increasing bounds of the cells of the chi-square statistic (see :chisq below); the cells are (-Inf, b1], (b1, b2], ..., (b_last, Inf). By default the bounds are chosen by the rule of fitdistrplus::gofstat: the observation at the position round(n / (4 n)^(2/5)) among the observations which are left, until at most 1.5 times that number is left; no bounds (and no chi-square) for a small sample.:se? (boolean, default true): Set to false to skip the standard errors (they take a few dozens of evaluations of the likelihood, slow for distributions with a numerically integrated density).:restarts (long, default 3): The number of starting points taken from the scan, when there are no other starting values.:closed-form? (boolean, default true): Set to false to skip the closed form estimators and fit numerically.:rng: The random number generator of the scan. The default is a new unseeded generator; pass a seeded one for a reproducible scan. The scan only provides starting points, so the fit is the same up to the tolerance of the optimizer. Fits which start from a closed form estimate or from the starting values of the specification don't use it.:quantiles (number or sequence, default 50) and :strategy (keyword, default :r7): For :qme. Either the probabilities of the matched quantiles (numbers inside (0, 1), at least as many as the fitted parameters) or their count, spread evenly from 0.01 to 0.99; and the quantile estimation strategy of fastmath.stats/quantiles.Returns a map with the keys:
:distribution: The fitted distribution object.:params: The map of all parameters (fitted, searched and fixed) to doubles.:method: The estimation method.:tier: :closed-form or :numeric. A fit in which the search of an integer parameter leaves no parameter to optimize (the chi distribution) is :closed-form.:converged?: true when the optimizer reported convergence or a stalled objective (it stopped changing, the usual end at the optimum), false when it stopped at the iteration limit. A closed form result is always converged.:iterations: The number of iterations of the optimizer, 0 for a closed form.:fixed: The map of fixed parameters, as given.:stats: A map with :k (the number of fitted parameters, a searched integer included), :n, :loglik, :aic, :aicc, :bic, and for continuous distributions the goodness-of-fit statistics :ks, :cvm and :ad, which are descriptive, not tests. They describe the fitted distribution, whatever the method. for discrete distributions :chisq (the Pearson chi-square statistic over the cells of :breaks, absent when the sample is too small for the automatic cells) and :chisq-df (cells - 1 - k, may be not positive, then the statistic is of no use), also descriptive, no p-value. :aicc is ##Inf when n is not above k + 1. Unless :se? is false it holds also :se, the map from the name of a fitted parameter to its standard error, from the inverse of the negative Hessian of the log likelihood at the estimate, a maximum likelihood result (the other methods give :se equal to nil). Fixed parameters, a searched integer and the ends of the support (the :lower-bound and :upper-bound roles, whose log likelihood is not smooth) have no entry and the other standard errors are conditional on them. When the Hessian is not finite, singular or not positive definite (a flat ridge of the likelihood), :se is nil and :se-warning gives the reason; it never throws.Moment matching with the moments above the second order, and L-moment matching, integrate the quantile function numerically unless the specification has its own :moments or :lmoments.
Throws ex-info with :type :not-fittable when the distribution has no specification, with :type :invalid-input for data which fail the validation, an unknown :method, the method :infer with :closed-form? set to false, wrong :quantiles, a wrong :fixed value, an integer parameter which has to be fixed or more than one integer parameter to search, with :type :moments-undefined when :mme or :lmme finds no parameters for which the moments exist (the Cauchy distribution has none), with :type :no-closed-form when the method :infer finds no exact closed form estimate, and with :type :not-converged when no usable estimate is found. An evaluation of the objective which throws or is not finite counts as an infinite objective value.
See also fastmath.random/fit-spec, fastmath.random/log-likelihood.
Fits a distribution to data. The distribution is given by its key (see [[fastmath.random/distribution]]), the fitted parameters are the ones listed by [[fastmath.random/fit-spec]]. When the specification of the distribution has an exact closed form estimator for the method (and the fixed parameters are the ones it is declared for, none for most estimators, and `:closed-form?` is not `false`) it is the result. Otherwise the objective of the method is minimized, from a closed form estimate that is not exact or the starting values of the specification or the maximum likelihood estimate of the specification, or from the best points of a scan of the parameter space (a quantile matching objective over ranges derived from the data and the roles of the parameters) when it has none. Methods (the `:method` option): - `:mle`: maximum likelihood, the default. - `:infer`: the closed form maximum likelihood estimate and nothing else: the sample mean and standard deviation for the `:mu` and `:sd` of the normal distribution. It never runs the optimizer or the scan: when the specification has no exact closed form maximum likelihood estimator for the fixed parameters (one which is only a starting point for a numerical fit is not an estimate), or the estimator has no estimate for the data (for example constant data), it throws. The result is the one of `:mle` with `:tier :closed-form`, `:method :infer` and, as for `:mle`, the statistics and the standard errors. It can't be used with `:closed-form?` set to `false`. - `:ks`, `:cvm`, `:ad`, `:adr`, `:adl`, `:ad2r`, `:ad2l`, `:ad2`: minimum distance, the minimum of the Kolmogorov-Smirnov, Cramer-von Mises or Anderson-Darling statistic or of one of its variants (see [[fastmath.stats/ks-statistic]], [[fastmath.stats/cvm-statistic]], [[fastmath.stats/ad-statistic]]). - `:mps`: maximum product of spacings, the maximum of the mean logarithm of the spacings of the cumulative distribution function at the sorted sample. A spacing between tied observations is zero and is replaced by the density (mass) at the observation, so the method can be used for discrete distributions. - `:qme`: quantile matching, the minimum of the mean squared distance of the sample quantiles and the distribution quantiles. - `:mme`: moment matching, the first `k` raw moments (`k` is the number of fitted parameters) of the distribution equal to the ones of the sample. - `:lmme`: L-moment matching, the first `k` L-moments of the distribution equal to the ones of the sample. Integer parameters (the `:integer` role, for example the trials of the binomial distribution) can't be found by the optimizer. When the specification gives a `:range` for the one which is not fixed, it is searched: for each integer the other parameters are fitted and the integer with the best value of the objective is chosen (the objective has to be unimodal in the integer). Otherwise an integer parameter has to be fixed. Parameters: - `dist-key` (keyword): A key of [[fastmath.random/distribution]] which has a specification. - `data` (sequence of numbers): The sample; it has to pass the validation of the specification (for example `:gamma` requires positive values and `:poisson` integers). - `opts` (map, optional): - `:method` (keyword, default `:mle`): The estimation method. - `:fixed` (map, default `nil`): Parameters which are not fitted, as a map from the name of a parameter to its value. At least one parameter has to stay free (or be searched). - `:optimizer` (keyword): The method of [[fastmath.optimization]] used for the numerical minimization, `:lbfgsb` or `:nelder-mead` (its initial simplex is a fifth of the starting values). The default is `:nelder-mead` for the minimum distance methods (`:ks`, `:cvm`, `:ad` and its variants), whose objectives are not smooth or have plateaus, and `:lbfgsb` otherwise. - `:stats?` (boolean, default `true`): Set to `false` to skip all the statistics (`:stats` is `nil`, `:se?` is ignored), as [[bootstrap]] does for its refits. - `:breaks` (sequence of numbers, default `nil`): For discrete distributions, the increasing bounds of the cells of the chi-square statistic (see `:chisq` below); the cells are `(-Inf, b1]`, `(b1, b2]`, ..., `(b_last, Inf)`. By default the bounds are chosen by the rule of `fitdistrplus::gofstat`: the observation at the position `round(n / (4 n)^(2/5))` among the observations which are left, until at most 1.5 times that number is left; no bounds (and no chi-square) for a small sample. - `:se?` (boolean, default `true`): Set to `false` to skip the standard errors (they take a few dozens of evaluations of the likelihood, slow for distributions with a numerically integrated density). - `:restarts` (long, default `3`): The number of starting points taken from the scan, when there are no other starting values. - `:closed-form?` (boolean, default `true`): Set to `false` to skip the closed form estimators and fit numerically. - `:rng`: The random number generator of the scan. The default is a new unseeded generator; pass a seeded one for a reproducible scan. The scan only provides starting points, so the fit is the same up to the tolerance of the optimizer. Fits which start from a closed form estimate or from the starting values of the specification don't use it. - `:quantiles` (number or sequence, default `50`) and `:strategy` (keyword, default `:r7`): For `:qme`. Either the probabilities of the matched quantiles (numbers inside `(0, 1)`, at least as many as the fitted parameters) or their count, spread evenly from `0.01` to `0.99`; and the quantile estimation strategy of [[fastmath.stats/quantiles]]. Returns a map with the keys: - `:distribution`: The fitted distribution object. - `:params`: The map of all parameters (fitted, searched and fixed) to doubles. - `:method`: The estimation method. - `:tier`: `:closed-form` or `:numeric`. A fit in which the search of an integer parameter leaves no parameter to optimize (the chi distribution) is `:closed-form`. - `:converged?`: `true` when the optimizer reported convergence or a stalled objective (it stopped changing, the usual end at the optimum), `false` when it stopped at the iteration limit. A closed form result is always converged. - `:iterations`: The number of iterations of the optimizer, `0` for a closed form. - `:fixed`: The map of fixed parameters, as given. - `:stats`: A map with `:k` (the number of fitted parameters, a searched integer included), `:n`, `:loglik`, `:aic`, `:aicc`, `:bic`, and for continuous distributions the goodness-of-fit statistics `:ks`, `:cvm` and `:ad`, which are descriptive, not tests. They describe the fitted distribution, whatever the method. for discrete distributions `:chisq` (the Pearson chi-square statistic over the cells of `:breaks`, absent when the sample is too small for the automatic cells) and `:chisq-df` (cells - 1 - `k`, may be not positive, then the statistic is of no use), also descriptive, no p-value. `:aicc` is `##Inf` when `n` is not above `k + 1`. Unless `:se?` is `false` it holds also `:se`, the map from the name of a fitted parameter to its standard error, from the inverse of the negative Hessian of the log likelihood at the estimate, a maximum likelihood result (the other methods give `:se` equal to `nil`). Fixed parameters, a searched integer and the ends of the support (the `:lower-bound` and `:upper-bound` roles, whose log likelihood is not smooth) have no entry and the other standard errors are conditional on them. When the Hessian is not finite, singular or not positive definite (a flat ridge of the likelihood), `:se` is `nil` and `:se-warning` gives the reason; it never throws. Moment matching with the moments above the second order, and L-moment matching, integrate the quantile function numerically unless the specification has its own `:moments` or `:lmoments`. Throws `ex-info` with `:type :not-fittable` when the distribution has no specification, with `:type :invalid-input` for data which fail the validation, an unknown `:method`, the method `:infer` with `:closed-form?` set to `false`, wrong `:quantiles`, a wrong `:fixed` value, an integer parameter which has to be fixed or more than one integer parameter to search, with `:type :moments-undefined` when `:mme` or `:lmme` finds no parameters for which the moments exist (the Cauchy distribution has none), with `:type :no-closed-form` when the method `:infer` finds no exact closed form estimate, and with `:type :not-converged` when no usable estimate is found. An evaluation of the objective which throws or is not finite counts as an infinite objective value. See also [[fastmath.random/fit-spec]], [[fastmath.random/log-likelihood]].
(pp result-or-distribution data)Data of the probability-probability plot of a sample against a distribution.
The sample is sorted and the cumulative probability of the distribution at its i-th value is paired with the i-th plotting position (i - a) / (n + 1 - 2 a) (see qq).
Parameters:
result-or-distribution: A result of fit or a distribution object.data (sequence of numbers): The sample.Returns a vector of pairs [theoretical-probability empirical-probability], ordered by the sample. A sample from the distribution lies along the diagonal.
Data of the probability-probability plot of a sample against a distribution. The sample is sorted and the cumulative probability of the distribution at its `i`-th value is paired with the `i`-th plotting position `(i - a) / (n + 1 - 2 a)` (see [[qq]]). Parameters: - `result-or-distribution`: A result of [[fit]] or a distribution object. - `data` (sequence of numbers): The sample. Returns a vector of pairs `[theoretical-probability empirical-probability]`, ordered by the sample. A sample from the distribution lies along the diagonal. See also [[qq]], [[fit]].
(qq result-or-distribution data)Data of the quantile-quantile plot of a sample against a distribution.
The sample is sorted and its i-th value is paired with the quantile of the distribution at the i-th plotting position (i - a) / (n + 1 - 2 a) (i from 1, a = 3/8 for n <= 10, 1/2 otherwise, the convention of ppoints and qqnorm of R).
Parameters:
result-or-distribution: A result of fit or a distribution object.data (sequence of numbers): The sample.Returns a vector of pairs [theoretical-quantile sample-value], ordered by the sample. A sample from the distribution lies along the diagonal.
Data of the quantile-quantile plot of a sample against a distribution. The sample is sorted and its `i`-th value is paired with the quantile of the distribution at the `i`-th plotting position `(i - a) / (n + 1 - 2 a)` (`i` from 1, `a = 3/8` for `n <= 10`, `1/2` otherwise, the convention of `ppoints` and `qqnorm` of R). Parameters: - `result-or-distribution`: A result of [[fit]] or a distribution object. - `data` (sequence of numbers): The sample. Returns a vector of pairs `[theoretical-quantile sample-value]`, ordered by the sample. A sample from the distribution lies along the diagonal. See also [[pp]], [[fit]].
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |