Catalog.estimate_mc_ks#

Catalog.estimate_mc_ks(delta_m: float | None = None, mcs_test: list | None = None, p_value_pass: float = 0.1, stop_when_passed: bool = True, b_value: float | None = None, b_method: ~seismostats.analysis.bvalue.base.BValueEstimator = <class 'seismostats.analysis.bvalue.classic.ClassicBValueEstimator'>, n: int = 10000, ks_ds_list: list[list] | None = None, verbose: bool = False, **kwargs) tuple[float | None, dict[str, Any]]#

Returns the smallest magnitude in a given list of completeness magnitudes for which the KS test is passed, i.e., where the null hypothesis that the sample of magnitudes is drawn from a Gutenberg-Richter law cannot be rejected.

Source:
  • Clauset, A., Shalizi, C.R. and Newman, M.E., 2009. Power-law distributions in empirical data. SIAM review, 51(4), pp.661-703.

  • Mizrahi, L., Nandan, S. and Wiemer, S., 2021. The effect of declustering on the size distribution of mainshocks. Seismological Society of America, 92(4), pp.2333-2342.

Attention

Catalog.mc will be replaced by the best_mc return value.

Parameters:
  • delta_m – Bin size of discretized magnitudes. Catalog needs to be rounded to bins beforehand. Either given as parameter or taken from the object attribute.

  • mcs_test – Array of tested completeness magnitudes. If None, it will be generated automatically based on magnitudes and delta_m.

  • p_value_pass – p-value required to pass the test.

  • stop_when_passed – Stop calculations when first mc passes the test.

  • b_value – If b_value is ‘known’, only estimate mc assuming the given b_value. If None, the b-value is either taken from the object attribute or estimated.

  • b_method – b-value estimator to use if b-value needs to be calculated from data.

  • n – Number of number of times the KS distance is calculated for estimating the p-value.

  • ks_ds_list – KS distances from synthetic data with the given parameters. If None, they will be estimated here.

  • verbose – Boolean that indicates whether to print verbose output.

  • **kwargs – Additional parameters to be passed to the b-value estimator.

Returns:
  • best_mcmc for which the p-value is lowest.

  • mc_info – Dictionary with additional information about the calculation of the best mc, including:

    • best_b_value: b_value corresponding to the best mc.

    • mcs_tested: Tested completeness magnitudes.

    • b_values_tested: Tested b-values.

    • ks_ds: KS distances.

    • p_values: Corresponding p-values.

Examples

>>> from seismostats import Catalog
>>> cat = Catalog.from_dict({
...     'magnitude': [2.3, 1.2, 1.5, 1.2, 1.7, 1.1, 1.2, 1.5,
...                   1.8, 1.6, 1.2, 1.5, 1.2, 1.7, 1.6, 1.1,
...                   1.1, 1.2, 2.0, 1.1, 1.2, 1.1, 1.2, 1.6,
...                   1.9, 1.3, 1.7, 1.3, 1.0, 1.2, 1.7, 1.3,
...                   1.3, 1.1, 1.5, 1.4]})
>>> cat.delta_m = 0.1
>>> cat.estimate_mc_ks()
>>> cat.mc

1.0

The mc_ks method returns additional information about the calculation of the best mc, like b-values tested and ks distances. Those are returned by the method and can be used for further analysis.

>>> best_mc, mc_info = cat.estimate_mc_ks()
>>> (mc_info['b_values_tested'], mc_info['ks_ds'])

([0.9571853220063774], [0.1700244200244202])