序贯概率比检验Sequential Probability Ratio Test

序贯概率比检验(Sequential probability ratio test,SPRT)

什么是序贯概率比检验

数理统计学的一个分支,其名称源出于亚伯拉罕·瓦尔德在1947年发表的一本同名著作,它研究的对象是所谓“序贯抽样方案”,及如何用这种抽样方案得到的样本去作统计推断。序贯抽样方案是指在抽样时,不事先规定总的抽样个数(观测或实验次数),而是先抽少量样本,根据其结果,再决定停止抽样或继续抽样、抽多少,这样下去,直至决定停止抽样为止。反之,事先确定抽样个数的那种抽样方案,称为固定抽样方案。

例如,一个产品抽样检验方案规定按批抽样品20件,若其中不合格品件数不超过 3,则接收该批,否则拒收。在此,抽样个数20是预定的,是固定抽样。若方案规定为:第一批抽出3个,若全为不合格品,拒收该批,若其中不合格品件数为x1<3,则第二批再抽3-x1个,若全为不合格品,则拒收该批,若其中不合格品数为 x2<3-x1,则第三批再抽3-x1-x2个,这样下去,直到抽满20件或抽得 3个不合格品为止。这是一个序贯抽样方案,其效果与前述固定抽样方案相同,但抽样个数平均讲要节省些。此例中,抽样个数是随机的,但有一个不能超过的上限20。有的序贯抽样方案,其可能抽样个数无上限,例如,序贯概率比检验的抽样个数就没有上限。

 

Sequential Probability Ratio Test for Reliability Demonstration

 

The Sequential Probability Ratio Test (SPRT) was developed by Abraham Wald more than a half century ago [1]. It is widely used in quality control in manufacturing and detection of anomalies in medical trials. In this article, we will explain the theory behind this method and illustrate its use in reliability engineering, especially in reliability demonstration test design. An example using the SPRT report template in Weibull++ is provided.

序列概率比测试(SPRT)是由Abraham Wald在半个多世纪前[1]开发的。它被广泛应用于制造质量控制和医学试验中异常的检测。在本文中,我们将解释这种方法背后的理论,并说明其在可靠性工程,特别是可靠性演示试验设计中的应用。在Weibull++中提供了一个使用SPRT报告模板的示例。

SPRT Theory

SPRT was originally developed as an inspection tool to determine whether a given lot meets the production requirements. Basically, a sequential test is a method by which items are tested in sequence (one after another). The test results are reviewed after each test. Two tests of significance are applied to the data accumulated up to that time.

SPRT最初是作为一种检验工具开发的,用于确定给定批次是否满足生产要求。基本上,序贯测试是一种按顺序(一个接一个)测试项目的方法。每次测试后都会对测试结果进行评审。对到那时为止积累的数据进行了两种显著性检验。

Concept of SPRT

Let's first use a simple example to explain the principal behind SPRT. Two vendors provide the same component to a company. Although the components from the two companies look exactly the same, their lifetime distributions are different. Components from vendor A have a mean life of μ1 = 15, and components made by vendor B have a mean life of μ2 = 20. An unlabeled box of components was received by the company. We want to determine if the components are from vendor A or from vendor B by conducting a test. The test should meet the following requirements:

让我们先用一个简单的例子来解释SPRT背后的原理。两个供应商为一个公司提供相同的组件。尽管这两家公司的组件看起来完全相同,但它们的寿命分布却不同。厂商A的元器件平均寿命为μ1 = 15,厂商B的元器件平均寿命为μ2 = 20。该公司收到了一盒没有标签的组件。我们想通过测试来确定组件是来自供应商A还是来自供应商B。试验应满足以下要求:

  • If the component is indeed from vendor A, the chance of making a wrong claim that it is from vendor B should be less than α1 = 0.01.
  • 如果该组件确实来自供应商A,则错误声称其来自供应商B的几率应小于α1 = 0.01。
  • If the component is indeed from vendor B, the chance of making a wrong claim that it is from vendor A should be less than α2 = 0.05.
  • 如果该组件确实来自供应商B,则错误声称其来自供应商a的几率应小于α2 = 0.05。

Therefore, we need to conduct two statistical hypothesis tests. Since we know μ2 > μ1, the two tests are one-sided tests. The first test is for vendor A:

因此,我们需要进行两次统计假设检验。因为我们知道μ2 > μ1,所以这两个测试都是单侧检验。第一个测试是针对供应商A的:

test 1

The second one is for vendor B:

第一个测试是给供应商B的:

test 2

These two separate hypothesis tests are shown graphically below:

这两个独立的假设检验如下图所示:

plot vendor A and B

The top plot is for the first hypothesis test (vendor A). C1 is the critical value at a significance level of α1. If we take some samples and the sample mean is less than C1, then we accept Equation, which is that the components are from vendor A. Otherwise, we accept Equation, that the components are not from vendor A.

最上面的图是第一个假设检验(供应商A)。C1为α1显著性水平下的临界值。如果我们取一些样本,样本均值小于C1,则接受原假设,即组件来自供应商A。否则,接受备择假设,即组件不是来自供应商A。

The bottom plot is for the second test (vendor B). C2 is the critical value at a significance level of α2. If a sample mean is greater than C2, then we accept Equation that the component is from vendor B; otherwise, we accept Equation, that the component is not from vendor B.

下图为第二次试验(供应商B)。C2是α2显著性水平下的临界值。如果样本均值大于C2,则接受原假设,即该成组件来自供应商B;否则,我们接受备择假设,即组件不是来自供应商B。

 

When we take samples for the life test, the resulting sample mean has one of the following values:

当我们进行寿命试验取样时,得到的样本均值有以下值之一:

  • Assume a sample with mean Equation was drawn. For the test for vendor A, since it is less than C1, we accept that μ = μ1. For the test for vendor B, since it is less than C2, we accept that μ < μ2. The test is ended and we conclude that the component is from vendor A.
  • 假设样本具有均值Equation。对于供应商A的测试,由于它小于C1,我们接受μ = μ1。对于供应商B的测试,由于它小于C2,我们接受μ < μ2。测试结束,我们得出组件来自供应商A。
  • Assume a sample with mean Equation was drawn. For the test for vendor A, since it is greater than C1, we reject that μ = μ1. For the test for vendor B, since it is greater than C2, we accept that μ = μ2. The test is ended and we conclude that the component is from vendor B.
  • 假设样本具有均值Equation。对于供应商A的测试,由于它大于C1,我们拒绝μ = μ1。对于供应商B的测试,由于它大于C2,我们接受μ = μ2。测试结束,我们得出组件来自供应商B。
  • Assume a sample with mean Equation was drawn. For the test for vendor A, since it is less than C1, we accept that μ = μ1. For the test for vendor B, since it is greater than C2, we accept that μ = μ2. We conclude the component is from both vendor A and vendor B, which is impossible. Therefore, the test is not ended and more samples are needed.
  • 假设样本具有均值Equation 。对于供应商A的测试,由于它小于C1,我们接受μ = μ1。对于供应商B的测试,由于它大于C2,我们接受μ = μ2。我们得出的结论是组件来自供应商A和供应商B,这是不可能的。因此,测试还没有结束,还需要更多的样品。

With more and more samples, the sample mean will be closer to the true population mean. The test will end with a conclusion either from vendor A or from vendor B. This is the principal behind a sequential test. A sequential probability ratio test is based on this idea.

随着样本数的增加,样本均值会更接近真实总体均值。测试将以来自供应商a或供应商b的结论结束。这是序贯测试背后的主要内容。序贯概率比检验正是基于这一思想。

Calculation of SPRT

Now assume the lifetime t of the component follows an exponential distribution. Let θA = μA for vendor A and θB = μB for vendor B. The probability density function (pdf) of the exponential distribution is:

现在假设这个组件的寿命t服从指数分布。θA = μA(厂商A), θB = μB(厂商b)。指数分布的概率密度函数为:

Equation (1)

For an observed failure time t, if it is from vendor A, then the “probability” of observing it is:

对于观察到的故障时间t,如果它来自供应商A,则观察到它的“概率”为:

Equation (2)

where Δt is a very small time duration around t.

Δt是一个在t附近很小的持续时间。

If the observation is from vendor B, then the “probability” of observing it is:

如果观察来自供应商B,则观察到它的“概率”为:

Equation (3)

If the component is from vendor A, then Eqn. (2) will likely have a larger value than the one given in Eqn. (3), and vice versa.

如果组件来自供应商A,则Eqn(2)可能会有一个比Eqn(3)更大的值,反之亦然。

The logarithm of the ratio of the above two probabilities is given by:

上述两种概率比率的对数如下:

Equation (4)

When there are more samples, the log-likelihood ratio becomes:

当样本数增加时,对数似然比为:

Equation (5)

If the ratio is greater than a critical value U, then the chance that the samples are from vendor B is much larger than the chance that the samples are from vendor A. We can conclude that the samples are from vendor B.

如果比值大于临界值U,则样本来自供应商B的概率远大于样本来自供应商a的概率,我们可以得出样本来自供应商B的结论。

If the ratio is less than a critical value L, then the chance that the samples are from vendor A is much larger than the chance that the samples are from vendor B. We can conclude that the samples are from vendor A.

如果比值小于临界值L,那么样本来自供应商a的概率远大于样本来自供应商b的概率,我们可以得出样本来自供应商a的结论。

If the ratio is between L and U, then no conclusion can be made. More samples are needed. The decision is made based on the following formula:

如果比例在L和U之间,则无法得出结论。还需要更多的样品。决策依据如下公式:

Equation (6)

But what are the values for U and LU and L are determined based on the two significance levels α1 and α2. The significance level is also called a Type I error. For details on Type I and Type II errors, please refer to https://www.weibull.com/hotwire/issue88/relbasics88.htm.

但是U和L的值是多少?U和L是根据两个显著性水平α1和α2确定的。显著性水平也称为第一类错误。关于第一类和第二类错误的详细信息,请参考https://www.weibull.com/hotwire/issue88/relbasics88.htm。

When the ratio is less than L, we accept vendor A:

当比值小于L时,我们接受供应商A:

Equation (7)

When we accept vendor A, the probability of making the right decision (the component is from vendor A) should be greater than 1-α1, as required by the hypothesis test. The probability of making the wrong decision (the component is actually from vendor B) should be less than α2. Here α1 is the Type I error α and α2 is the Type II error β for the hypothesis test for vendor A.

当我们接受供应商A时,根据假设检验的要求,做出正确决策的概率(组件来自供应商A)应该大于1-α1。做出错误决策(组件实际上来自供应商B)的概率应该小于α2。这里α1是对供应商A的假设检验的第一类错误α, α2是第二类错误β。

Please note that Type I and Type II errors are related to a given statistical hypothesis test. Since SPRT combines two hypothesis tests together, it is very important to determine which one is the Type I error and which one is the Type II error.

请注意,第一类和第二类错误与给定的统计假设检验有关。由于SPRT将两个假设检验结合在一起,因此确定哪一个是第一类错误,哪一个是第二类错误非常重要。

When vendor A is accepted, based on the requirement for the Type I and Type II errors, we have:

当供应商A被接受时,基于对I类和II类错误的要求,我们有:

Equation (8)

From Eqns. (7) and (8), we set:

从方程式(7)和(8),设:

Equation (9)

Similarly, when the ratio is larger than U, we accept vendor B:

同样,当比值大于U时,我们接受供应商B:

Equation (10)

When we accept vendor B, the probability of making the right decision (the component is indeed from vendor B) should be greater than 1-α2. The probability of making the wrong decision (the component is actually from vendor A) should be less than α1. Here α2 is the Type I error and α1 is the Type II error for the hypothesis test for vendor B. Therefore, we have:

当我们接受供应商B时,做出正确决策的概率(组件确实来自供应商B)应该大于1-α2。做出错误决策(组件实际上来自供应商A)的概率应该小于α1。这里α2是对供应商b的假设检验的第一类错误,α1是第二类错误。因此,我们有:

Equation (11)

From Eqns. (7) and (8), we can set:

从方程式(7)和(8),设:

Equation (12)

Combining all the above equations, we get the decision formula for SPRT as the follows:

综合以上方程,得到SPRT决策公式如下:

Equation (13)

Which is:

即:

Equation (14)

SPRT for Weibull Distribution

SPRT can be used for any distribution. The likelihood ratio can be calculated based on the assumed distribution. In this section, we will use the Weibull distribution to illustrate how it is used in a reliability requirement test. The probability density function for a Weibull distribution is given by:

SPRT可以用于任何分布。似然比可以根据假设的分布来计算。在本节中,我们将使用Weibull分布来说明如何在可靠性需求测试中使用它。Weibull分布的概率密度函数为:

Equation (15)

where:

  • η is the scale parameter.

  • η为尺度参数。
  • b is the shape parameter. Note that here we do not use the traditional notation beta for the shape parameter because beta is used for the Type II error in this article.

  • b为形状参数。注意,这里我们不使用传统的符号beta来表示形状参数,因为在本文中使用beta表示Type II型错误。

Assume we want to test if a component is from a Weibull population with parameters of b1 and η1, or from a population with parameters of b2 and η22  >  η1). The two likelihood functions are:

假设我们要检验一个组件是来自参数为b1 和η1的Weibull种群,还是来自参数为b2 和η2的种群(η2 > η1)。两个似然函数为:

Equation (16)

and

Equation (17)

The likelihood ratio is:

似然比为:

Equation (18)

When b1 = b2, the above equation becomes:

当b1 = b2时,上式为:

Equation (19)

The decision equation for the log-likelihood ratio R is:

对数似然比R的决策方程为:

Equation (20)

L and U are given in Eqns. (9) and (12). Therefore, Eqn. (20) becomes:

L和U用等式(9)和(12)表示。因此,Eqn(20)就变成:

Equation (21)

Example

Let's assume the lifetime of a component is described by a Weibull distribution with the shape parameter b = 1.5. We will use SPRT to determine if the component meets the following reliability requirements:

让我们假设一个组件的寿命是由形状参数b = 1.5的威布尔分布描述的。我们将使用SPRT来确定组件是否满足以下可靠性要求:

  • A target reliability of 92% at 200 hours. If the component meets or exceeds the target reliability, the chance of rejecting it (i.e., Type I error or α error) should be less than 0.05. This is comparable to α2 in the previous section.
  • 目标可靠性在200小时内达到92%。如果该组件达到或超过目标可靠性,则拒绝该组件的机会(即I型误差或α误差)应小于0.05。这可与上一节中的α2相当。
  • A minimum reliability of 82% at 200 hours. If the component’s reliability is 82% or less, the probability of accepting it (i.e., Type II error or β error) should be less than 0.1. This is comparable to α1 in the previous section.
  • 在200小时内的最低可靠性为82%。如果元件的可靠性为82%或更少,接受它的概率(即II型误差或β误差)应小于0.1。这可与上一节中的α1相当。

Our objectives are to:

我们的目标是:

  • Calculate the acceptance and rejection line for the SPRT test.
  • 计算SPRT测试的接受和拒绝线。
  • Determine whether to accept or reject the component based on a series of observed failure times.
  • 根据观察到的一系列故障时间决定是否接受或拒绝组件。

Solution Using Manual Calculations

  1. Calculate η1 and η2 based on the reliability requirements. The reliability function for a Weibull distribution is given by:

    Equation

    Therefore, η2 equals:

     Equation

    and η1 equals:

    Equation

  2. Enter the calculated values for η1 and ηinto the decision equations from Eqn. (21).

    Equation

    The equation becomes:

    Equation

  3. Calculate equation for each observed failure time. The observed time from each sequential test and the calculated results are shown next. (Note that in the table, negative rejection values were adjusted to 0.)
ID Ti T Acceptance Value Rejection Value Decision
1 629 15,775.24 76,651.04125 0 Continue
2 369 22,863.5 97,964.88014 0 Continue
3 685 40,791.66 119,278.719 0 Continue
4 270 45,228.22 140,592.5579 14,209.44008 Continue
5 682 63,038.74 161,906.3968 35,523.27897 Continue
6 194 65,740.84 183,220.2357 56,837.11786 Continue
7 113 66,942.05 204,534.0746 78,150.95675 Reject

The plot of the data is shown next. The component is rejected at a failure time of 113 hours.

 plot

Solution Using the Weibull SPRT Template in Weibull++

The Synthesis version of Weibull++ includes a report template for calculating the SPRT results using a Weibull distribution and generating a plot of the results. To use the template:

  1. Add a new analysis workbook in an existing project, by choosing Insert > Reports and Plots > Analysis Workbook.
  2. Select the Based on Existing Template check box and then choose Weibull SPRT Template on the Standard tab.

Workbook Wizard

  1. Click OK, then click Yes to create the workbook.
  2. Enter the reliability and risk requirement values, and the observed failure times in the white cells. The results and plot are shown next.

data and plot

The resulting report provides all of the information that you obtained by doing the calculations manually and it automatically creates a plot.

Conclusion

Many published materials on SPRT only provide the simplified final formulas, such as Eqn. (21), for specific distributions for ease of use. In this article, we reviewed the basic theory of SPRT and illustrated its use in reliability engineering. It can be seen that it is a general tool that can be used for any distribution. Once the theory is understood, it is an easy task to develop your own SPRT for your applications.

许多关于SPRT的出版物只提供简化的最终公式,如Eqn(21)、针对特定分布,便于使用。本文回顾了SPRT的基本理论,并阐述了SPRT在可靠性工程中的应用。可以看出,它是一个通用的工具,可以用于任何分布。一旦理解了这个理论,就很容易为应用程序开发自己的SPRT。

Reference

[1] A. Wald, Sequential Analysis, John Wiley & Sons, Inc, New York, 1947.

posted on 2021-08-02 10:54  那抹阳光1994  阅读(2912)  评论(0编辑  收藏  举报

导航