Statistics

spicefault.statistics.describe

The distribution of each measurement over the drawn circuits.

ecdf(values)

Empirical distribution of the finite values: (x sorted, fraction of values <= x).

quantile_interval(n, q, confidence=0.95)

Ranks (l, u), counted from 1, of the order statistics that bracket the quantile q of any continuous distribution with at least the given confidence: P(x_(l) <= quantile <= x_(u)) >= confidence.

The number of samples below the quantile is Binomial(n, q), so the ranks come from its tails, with half of the error probability on each side. None if the sample is too small for such ranks to exist: the quantile cannot be estimated from it.

describe(samples, features, by=('fault_id', 'condition'), ok='sim_ok', quantiles=(0.01, 0.5, 0.99), confidence=0.95)

Statistics of each feature over the samples of each group, one row per group and feature.

  • n: samples used, those whose simulation succeeded; n_failed: those that did not. They are counted, never dropped silently: a statistic over the successful samples describes the circuits that could be simulated.
  • mean, std (with n - 1), minimum, maximum, and mean_low, mean_high: the interval of the mean, mean +- z std / sqrt(n), which assumes that n is large enough for the mean to be normal.
  • q<p>, q<p>_low, q<p>_high for each quantile p: the estimate (linear interpolation between order statistics) and a distribution-free interval from the order statistics (quantile_interval). When the sample is too small for the interval to exist, the three are NaN: the smallest of 100 values is not an estimate of the 0.1 % quantile.

A group in which a feature has no value at all, as for a measurement that its operating condition does not make, gives no row.

spicefault.statistics.yields

Yield: the fraction of the drawn circuits that meets its specifications.

samples_for_half_width(half_width, p=0.5, confidence=0.95)

Samples for a proportion near p to be estimated within +- half_width: n = z^2 p (1 - p) / half_width^2, the normal approximation. p = 0.5 is the worst case; for a yield near 1 use the expected yield.

zero_failure_bound(n, confidence=0.95)

Upper bound of the failure probability when none of n independent samples failed: 1 - (1 - confidence)^(1 / n), about 3 / n at 95 %. No failure in a sample does not mean that the probability of one is zero.

yield_report(values, specifications, simulated=None, confidence=0.95, interval='wilson')

Yield per specification and overall, from one row per drawn circuit.

values holds the column of each specification; simulated is False for the circuits whose simulation failed (all True by default). One row per specification and a last row all:

  • n: circuits simulated successfully; n_failed: those that were not;
  • passed, yield, ci_low, ci_high: over the n simulated circuits, with a binomial interval (wilson or clopper-pearson) that assumes independent, randomly drawn circuits;
  • yield_min, yield_max: the yield over all the circuits if every failed simulation is counted as not compliant, and as compliant. A value that is not finite in a simulated circuit is a violation;
  • only_this: circuits that fail this specification and no other;
  • mean, std, minimum, maximum: of the specified quantity;
  • margin_sigma: distance from the mean to the nearest limit, in standard deviations. It describes the sample; it is not a guarantee, and it says little about a distribution that is far from normal.

A finite sample estimates and bounds the yield; it does not prove it.

spicefault.statistics.replication

The uncertainty of an estimate from independent replications of an experiment.

student_t_quantile(p, df)

Quantile of the Student t distribution with df degrees of freedom, by integrating its density and bisecting.

replicated_interval(estimates, confidence=0.95)

(mean, low, high) of an estimate obtained in several independent replications.

This is the interval for an experiment whose samples are not independent, such as a Latin hypercube or a Sobol design: the whole experiment is repeated with different seeds, each repetition gives one estimate, and the estimates are independent even though the samples inside a repetition are not. mean +- t s / sqrt(k), with the Student t of k - 1 degrees; it assumes that the estimates are roughly normal.