openquake.hme.utils.statsΒΆ

This module provides statistical functions that are not specific to any set of tests.

Functions

estimate_negative_binom_parameters(samples)

geom_mean(*vals)

Calculates the geometric mean of either a sequence of numbers (returning a scalar) or the element-wise geometric mean of multiple sequences of numbers of equal length (i.e., the geometric mean of the i-th value across all sequences), returning an array of the same length as the input sequences.

jensen_shannon_distance(p, q)

jensen_shannon_divergence(p, q)

kullback_leibler_divergence(p, q)

The Kullback-Leibler Divergence is a measure of the information loss in moving from a distribution P to a second distribution Q that may be a model or approximation.

negative_binomial_distribution(num_events, ...)

Returns the negative binomial probability for observing

poisson_likelihood(num_events, rate[, ...])

Returns the Poisson likelihood of observing num_events in a time_interval given the rate of those events in the units of the time interval (i.e., if the time_interval is in years, the rate is the annual occurrence rate).

poisson_likelihood_vect(num_events, rate[, ...])

poisson_likelihood_zero_rate(num_events[, ...])

poisson_log_likelihood(num_events, rate[, ...])

poisson_log_likelihood_vect(num_events, rate)

sample_event_times_in_interval(...[, t0, ...])

Returns the times of events

sample_event_times_in_interval_array(...[, ...])

Returns the times of events from an array of event rates.

sample_num_events_in_interval(...[, rand_seed])

Returns the number of events in an interval, sampled from the Poisson distribution for the occurrence rate and interval length.

sample_num_events_in_interval_array(...[, ...])

Returns the times of events from an array of event rates.

weighted_geom_mean(*vals[, weights])

Calculates the weighted geometric mean of either a sequence of numbers (returning a scalar) or the element-wise weighted geometric mean of multiple sequences of numbers of equal length (i.e., the weighted geometric mean of the i-th value across all sequences), returning an array of the same length as the input sequences.