Description Usage Arguments Details Value Author(s) Examples
Given a numerical data vector, this function fits multiple distributions
with the maximum likelihood method and returns an object containing the best
fitted parameters and information criteria.
Refer to the “Examples” section or the result class
globalfit
on how to sort and output the results with
e.g. summary
.
1 2 3 4 5 6 |
data |
numeric vector of data points. |
continuity |
logical; if |
method |
character;
method for parameter estimation. So far only Maximum-Likelihood is
implemented, thus this argument must
be |
verbose |
logical;
if |
packages |
either a character vector with names of packages; default: “stats”. |
append_packages |
logical; if |
max_dim_discrete |
non-negative integer; distributions with more
non-continuous parameters than |
cores |
integer; number of CPU cores to be used in the calculations of best fitted parameters and information criteria. |
sanity |
either a positive numeric or logical; if it is a positive numeric, it controls a sanity check where obviously bad fits are filtered out. The smaller the number, the stricter the check will be executed and the more potential distributions will be rejected. If Default is 1. |
timeout |
logical or numeric.
if it is a
positive numeric, it gives the
seconds until timeout for the underlying optimiser
If |
If there is no continuity input given, this function first tests via multiple
criteria whether the data is continuously or discretely distributed.
Given that information, the related distributions from getFamilies()
are fitted to the data via maximum likelihood method and information
criteria are calculated. For discrete data not in the form of
integers only, an appropriate linear transformation is applied to ensure
stable optimization.
Since DistributionFitR technically allows for comparing over all distributions in any R-package, computation speed is likely to be an issue. The following may help:
using argument packages
with append_packages = FALSE
to restrict the search to certain packages
discarding distributions with too many discrete parameters using
argument max_dim_discrete
specifying timeout
, which affects the maximum time spent on
each distribution (not overall!). The value in timeout
will not be translated directly to the actual maximum time
due to differing number of times optim
is run
under different algorithms.
globalfit
returns an object of class
globalfit
.
Moritz Lauff, Kiril Dik, Nadine Tampe, Borui Niklas Zhu, Benedikt Geier, Moritz Kern
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | # Example 1
data <- rnorm(n = 100, mean = 70, sd = 4)
r <- globalfit(data, cores = if(interactive()) NULL else 2)
summary(r)
# continuous or discrete
# Example 2
# Alternatively, it is possible to input whether the data is
globalfit(data, continuity = TRUE)
# Example 3
# fit over all distribution in the standard search list
globalfit(data, packages = NULL)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.