analysis.estimate_mc_ks#
- seismostats.analysis.estimate_mc_ks(magnitudes: ~numpy.ndarray, delta_m: float, mcs_test: ~numpy.ndarray | 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 is drawn from a Gutenberg-Richter law with that mc 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.
- Parameters:
magnitudes – Array of magnitudes to test.
delta_m – Bin size of discretized magnitudes. Sample has to be rounded to bins beforehand).
mcs_test – Array of tested completeness magnitudes. If
None, it will be generated automatically based onmagnitudesanddelta_m.p_value_pass – p-value threshold for the KS test. Below this value, the null hypothesis that the sample is drawn from a Gutenberg-Richter distribution with the given mc is rejected.
stop_when_passed – Whether to stop calculations when first mc passes the test.
b_value – If
b_valueis ‘known’, only estimatemcassuming the givenb_value.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 – Whether to print verbose output.
**kwargs – Additional parameters to be passed to the b-value estimator.
- Returns:
best_mc –
mcfor which the p-value is lowest.mc_info – Dictionary with additional information about the calculation of the best
mc, including:best_b_value:
b_valuecorresponding to the bestmc.mcs_tested: Tested completeness magnitudes.
b_values_tested: Tested b-values.
ks_ds: KS distances.
p_values: Corresponding p-values.
Examples
>>> from seismostats.analysis import estimate_mc_ks >>> import numpy as np >>> magnitudes = np.array([2.3, 1.2, 1.5, 1.2, 1.7, 1.1, 1.2, ... 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, 1.5] >>> delta_m = 0.1 >>> mc, _ = estimate_mc_ks(magnitudes, delta_m=delta_m) >>> 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 = estimate_mc_ks(magnitudes,delta_m=delta_m) >>> (mc_info['b_values_tested'], mc_info['ks_ds']) ([0.9571853220063774], [0.1700244200244202])