Skip to contents

A helper function for fit_distributions

Usage

fit_distributions_helper(
  x,
  interval_start,
  interval_end,
  interval_midpoint,
  metric = c("mle", "jaccard", "intersection", "ks", "mse", "chisq"),
  truncated = FALSE,
  distributions = c("norm", "gamma", "gamma_flip", "unif")
)

Arguments

x

numeric vector, representing data to be fit

interval_start

starting coordinates for the bins

interval_end

ending coordinates for the bins

interval_midpoint

bin midpoints

metric

a subset of mle, jaccard, intersection, ks, mse, chisq indicating metrics to use for fit optimization

truncated

logical, whether to fit truncated distributions

distributions

character vector indicating distributions, subset of norm, gamma, gamma_flip and unif.

Value

a nested list where each sublist represents a model with the following data

par

a character string denoting the region_id of the Histogram

dist

the distribution name

metric

the metric used to fit the distribution

value

the fitted value of the metric function

dens

a function that returns the density of the fitted distribution