Skip to contents

Methods for voting for a consensus model based on the metrics of fit_distributions

Usage

find_consensus_model(
  models,
  method = c("weighted_majority_vote", "rra"),
  metric = unique(sapply(models, `[[`, "metric")),
  distribution_prioritization = c("norm", "unif", "gamma", "gamma_flip"),
  weights = rev(sqrt(seq(1, 6))[1:length(metric)])
)

Arguments

models

a list of models, e.g. derived from fit_distributions

method

one of weighted_majority_vote and rra as a method of determining the best method. rra requires the package RobustRankAggreg

metric

metrics used to fit models. Metrics should be ordered in descending priority. The first metric in the vector will be used to return the consensus model for the distribution determined through voting.

distribution_prioritization

if method is weighted_majority_voting, a list of ranked distributions, to break ties

weights

required if method is weighted_majority_voting. weights of each metric to be multiplied by rankings. Weights should be in decreasing order. A higher weight results in a higher priority of the metric.

Value

a list of the best model for each metric and a consensus model representing the model with the consensus distribution and the lowest weighted metric. Each model is a list of 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

seg_start

start index of the interval

seg_end

end index of the interval

Examples

if (FALSE) {
 data <- observations_to_histogram(rnorm(10000, mean = 20, sd = 10))
 data <- data$histogram_data
 models <- fit_distributions(data)
 find_consensus_models(models)

}