Statistics

ehtim.statistics.stats.bootstrap(data, statistic, num_samples=1000, alpha='1sig', wrapping_variable=False)[source]

bootstrap estimate of 100.0*(1-alpha) confidence interval for a given statistic :param data: vector of data to estimate bootstrap statistic on :param statistic: function representing the statistic to be evaluated :param num_samples: number of bootstrap (re)samples :param alpha: parameter of the confidence interval, ‘1s’ gets an analog of 1 sigma confidence for a normal variable :param wrapping_variable: True for circular variables, attempts to avoid problem related to estimating variability of wrapping variable

Returns

bootstrap-estimated value of the statistic bootstrap_CI: bootstrap-estimated confidence interval

Return type

bootstrap_value

ehtim.statistics.stats.circular_mean(theta, unit='deg')[source]

circular mean for averaging angular quantities :param theta: list/vector of angles to average :param unit: degrees (‘deg’) or radians (any other string)

Returns

circular mean

ehtim.statistics.stats.circular_std(theta, unit='deg')[source]

standard deviation of a circular distribution :param theta: list/vector of angles :param unit: degrees (‘deg’) or radians (any other string)

Returns

circular standard deviation

ehtim.statistics.stats.circular_std_of_mean(theta, unit='deg')[source]

standard deviation of mean for a circular distribution :param theta: list/vector of angles :param unit: degrees (‘deg’) or radians (any other string)

Returns

circular standard deviation of mean

ehtim.statistics.stats.compare_TV(obs, obsref, snr_cut=2.0, output='')[source]

Computes mean total variation reports :param obs: ObsData object :param obref: ObsData object to use as a reference :param snr_cut: threshold for data snr :param output: if empty, returns median relative TV across all (baselines, triangles, quadrangles) :type output: str :param if ‘Full’, returns full dictionaries comparing all: :type if ‘Full’, returns full dictionaries comparing all: baselines, triangles, quadrangles

Returns

dictionary of baseline relative differences in mean TV / median of baseline relative differences in mean TV cprel / cpmed: dictionary of triangle relative differences in mean TV / median of triangle relative differences in mean TV lcarel / lcamed: dictionary of quadrangle relative differences in mean TV / median of quadrangle relative differences in mean TV

Return type

amprel / ampmed

ehtim.statistics.stats.dicts_TV_report(obs, snr_cut=2.0)[source]

Computes mean total variation reports :param obs: ObsData object :param snr_cut: threshold for data snr

Returns

dictionary of baseline mean TV cptv: dictionary of triangle mean TV lcatv: dictionary of quadrangle mean TV

Return type

amptv

ehtim.statistics.stats.mean_incoh_amp(amp, sigma, debias=True, err_type='predicted', num_samples=1000)[source]

amplitude from ensemble of Rice-distributed measurements with debiasing :param amp: vector of (biased) amplitudes :param sigma: vector of errors :param debias: whether debiasing is applied

Returns

estimator of unbiased amplitude

Return type

amp0

ehtim.statistics.stats.mean_incoh_amp_from_vis(vis, sigma, debias=True, err_type='predicted', num_samples=1000)[source]

Amplitude from ensemble of visibility measurements with debiasing :param amp: vector of (biased) amplitudes :param sigma: vector of errors :param debias: whether debiasing is applied

Returns

estimator of unbiased amplitude

Return type

amp0