Skip to content

Stress-strength interference

stress_strength

Stress-strength interference: the chance a strength exceeds a stress.

A part fails when the stress put on it reaches its strength. Both are random: the strength varies from part to part, and the stress from use to use. With a strength Y and a stress X that are independent, the reliability of the part is

``R = P(Y > X) = integral of f_X(x) S_Y(x) dx``

where f_X is the stress's density and S_Y the strength's survival function (the chance the strength is above a level). If the part has to withstand n independent applications of the stress, it survives when the strength is above the largest of them:

``R_n = P(Y > max(X_1..X_n)) = integral of n f_X F_X^(n-1) S_Y dx``

This is pure probability. RePyability takes the two models as given, fitted in surpyval (or anything with the methods named in stress_strength), and fits nothing. It says nothing about where a strength comes from (no fatigue, wear or crack-growth law): to let the strength change with age, give the model it has at each age (stress_strength_over_time).

The models share one unit. Strength and stress must be in the same unit (both in MPa, both in newtons, both in hours of cycles, ...). RePyability does not check units; a model in the wrong unit gives a wrong answer.

How R is worked out:

  • Closed forms where they exist, for models with no offset, no limited failure population and no zero inflation: both Normal, both LogNormal, both Exponential, and both Weibull with the same shape (and, for n loads, both Exponential or both Weibull with the same shape).
  • Quadrature otherwise. With u = F_X(x) the integral is over the stress's probability from 0 to 1, of n u^(n-1) S_Y(Q_X(u)), a smooth function between 0 and 1, which the Gauss-Kronrod (7, 15) rule of the mean-lifetime integral (rbd/_mean_lifetime.py) splits at the probabilities where the strength's quantiles fall, and halves until its error is within RTOL, relative.
  • Simulation on request (method="simulate").

stress_strength

stress_strength(strength, stress, n_loads=1, method='auto', uncertainty=None, n_draws=DEFAULT_DRAWS, confidence=0.95, mc_samples=DEFAULT_SAMPLES, seed=None)

The reliability of a part whose strength must exceed its stress: R = P(strength > stress), for independent strength and stress.

In plain words: the strength varies from part to part, the stress from use to use, and the part fails in a use whose stress is above its strength. R is the chance a randomly chosen part survives a randomly chosen use. With n_loads uses in a row (each stress drawn independently, the strength fixed for the part), the part survives when its strength is above the largest of them. Strength and stress are random variables in the same unit, which is not checked. Exponentials and normals with the same mean and spread give very different answers from the single "factor of safety" of their means: this is the whole distribution's answer. See the user guide for formulas and a worked example.

Parameters:

Name Type Description Default
strength model

The strength: a fitted surpyval model, or anything with sf (and, for the failure side to keep its precision, ff and, for better splits, qf; random if simulating).

required
stress model

The stress: a fitted surpyval model, or anything with qf (and ff for better splits; random if simulating). In the unit of strength.

required
n_loads int

The number of independent applications of the stress the strength must survive. The default is 1.

1
method str

"auto" for a closed form where there is one and quadrature otherwise (both exact to the precision of the models' own methods); "numerical" for quadrature even where a closed form exists; "simulate" for the Monte-Carlo estimate.

'auto'
uncertainty str

"fit" to draw both models' parameters from the normal approximation of their fitted estimates (surpyval's covariance()), independently of each other (they are fitted to separate data), and give the bounds of R over the draws. A model that has no parameter covariance (not fitted by maximum likelihood, a mixture, a non-parametric fit) is refused. Not with method="simulate".

None
n_draws int

The number of draws of the parameters for uncertainty.

DEFAULT_DRAWS
confidence float

The confidence level of the bounds, strictly between 0 and 1.

0.95
mc_samples int

The number of simulated draws of the strength and the stress when method="simulate".

DEFAULT_SAMPLES
seed int

Seeds the simulation and the draws of the parameters. The same seed gives the same results.

None

Returns:

Type Description
StressStrengthResult

R (reliability), 1 - R, the reliability index, how it was found, and the standard error (simulated) or the bounds (uncertainty).

Raises:

Type Description
TypeError

If a model lacks the methods it needs, or is a surpyval distribution itself rather than a model of it.

ValueError

If an argument is out of range, a model is a fixed probability or has a share that never occurs, or the uncertainty cannot be drawn.

stress_strength_over_time

stress_strength_over_time(strength_at, stress, times, n_loads=1, method='auto')

The reliability of a part whose strength changes with age, against a stress that does not: R(t) = P(strength at age t > stress).

RePyability has no law for how a strength changes (that is the user's knowledge of the part, or a model fitted in surpyval): give the model it has at each age. The result is the interference reliability of each age's model against the stress, worked out as stress_strength does. It is the chance that a part of that age survives one use (or n_loads uses in a row), not that it survives from new to that age.

Parameters:

Name Type Description Default
strength_at callable

A function of an age (a float) that returns the strength's model at that age, such as lambda t: surv.Normal.from_params([100 - 2 * t, 8]).

required
stress model

The stress's model, as in stress_strength, in the strength's unit. It does not change with age.

required
times array_like

The ages, finite numbers, in the unit strength_at takes.

required
n_loads int

The number of independent applications of the stress at each age.

1
method str

"auto" for a closed form where there is one and quadrature otherwise, or "numerical" for quadrature throughout.

'auto'

Returns:

Type Description
StressStrengthCurve

R(t) and 1 - R(t) at each age.

Raises:

Type Description
TypeError

If strength_at is not callable, or gives something that is not a model.

ValueError

If an argument is out of range.

stress_strength_over_time

stress_strength_over_time(strength_at, stress, times, n_loads=1, method='auto')

The reliability of a part whose strength changes with age, against a stress that does not: R(t) = P(strength at age t > stress).

RePyability has no law for how a strength changes (that is the user's knowledge of the part, or a model fitted in surpyval): give the model it has at each age. The result is the interference reliability of each age's model against the stress, worked out as stress_strength does. It is the chance that a part of that age survives one use (or n_loads uses in a row), not that it survives from new to that age.

Parameters:

Name Type Description Default
strength_at callable

A function of an age (a float) that returns the strength's model at that age, such as lambda t: surv.Normal.from_params([100 - 2 * t, 8]).

required
stress model

The stress's model, as in stress_strength, in the strength's unit. It does not change with age.

required
times array_like

The ages, finite numbers, in the unit strength_at takes.

required
n_loads int

The number of independent applications of the stress at each age.

1
method str

"auto" for a closed form where there is one and quadrature otherwise, or "numerical" for quadrature throughout.

'auto'

Returns:

Type Description
StressStrengthCurve

R(t) and 1 - R(t) at each age.

Raises:

Type Description
TypeError

If strength_at is not callable, or gives something that is not a model.

ValueError

If an argument is out of range.