pl_fit {spatialwarnings}R Documentation

Distribution-fitting functions

Description

These functions fit parametric distributions to a set of discrete values.

Usage

pl_fit(dat, xmin = 1)

exp_fit(dat, xmin = 1)

lnorm_fit(dat, xmin = 1)

tpl_fit(dat, xmin = 1)

Arguments

dat

The set of values to which the distribution are fit

xmin

The minimum possible value to consider when fitting the distribution

Details

These functions will fit distributions to a set of values using maximum-likelihood estimation. In the context of the 'spatialwarnings' package, they are most-often used to fit parametric distributions on patch size distributions. As a result, these functions assume that the data contains only integer, strictly positive values. The type of distribution depends on the prefix of the function: 'pl' for power-law, 'tpl' for truncated power-law, 'lnorm' for lognormal and 'exp' for an exponential distribution.

In the context of distribution-fitting, 'xmin' represents the minimum value that a distribution can take. It is often used to represent the minimum scale at which a power-law model is appropriate (Clauset et al. 2009), and can be estimated on an empirical distribution using xmin_estim. Again, please note that the fitting procedure assumes here that xmin is equal or grater than one.

Please note that a best effort is made to have the fit converge, but it may sometimes fail when the parameters are far from their usual range. It is good practice to make sure the fits are sensible when convergence warnings are reported.

For reference, the shape of the distributions is as follow:

The lognormal form follows the standard definition.

Value

A list containing at list the following components:

Additionnaly, this list may have one or more of the following parameters depending on the type of distribution that has been fitted:

References

Clauset, Aaron, Cosma Rohilla Shalizi, and M. E. J. Newman. 2009. “Power-Law Distributions in Empirical Data.” SIAM Review 51 (4): 661–703. https://doi.org/10.1137/070710111.

See Also

patchdistr_sews, xmin_estim

Examples


# Fit an exponential model to patch size distribution 
exp_fit(patchsizes(forestgap[[8]]))
 
# Use the estimated parameters as an indicator function
## Not run: 

get_truncation <- function(mat) { 
   c(exp_cutoff = exp_fit(patchsizes(mat))$cutoff)
}
trunc_indic <- compute_indicator(forestgap, get_truncation)
plot(trunc_indic)
plot(indictest(trunc_indic, nulln = 19))


## End(Not run)


[Package spatialwarnings version 3.0.3 Index]