序貫概率比檢驗(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的:

The second one is for vendor B:
第一個測試是給供應商B的:

These two separate hypothesis tests are shown graphically below:
這兩個獨立的假設檢驗如下圖所示:

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
, which is that the components are from vendor A. Otherwise, we accept
, 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
that the component is from vendor B; otherwise, we accept
, 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
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. - 假設樣本具有均值
。對於供應商A的測試,由於它小於C1,我們接受μ = μ1。對於供應商B的測試,由於它小於C2,我們接受μ < μ2。測試結束,我們得出組件來自供應商A。 - Assume a sample with mean
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. - 假設樣本具有均值
。對於供應商A的測試,由於它大於C1,我們拒絕μ = μ1。對於供應商B的測試,由於它大於C2,我們接受μ = μ2。測試結束,我們得出組件來自供應商B。 - Assume a sample with mean
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. - 假設樣本具有均值
。對於供應商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)。指數分布的概率密度函數為:
![]() |
(1) |
For an observed failure time t, if it is from vendor A, then the “probability” of observing it is:
對於觀察到的故障時間t,如果它來自供應商A,則觀察到它的“概率”為:
![]() |
(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,則觀察到它的“概率”為:
![]() |
(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:
上述兩種概率比率的對數如下:
![]() |
(4) |
When there are more samples, the log-likelihood ratio becomes:
當樣本數增加時,對數似然比為:
![]() |
(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之間,則無法得出結論。還需要更多的樣品。決策依據如下公式:
![]() |
(6) |
But what are the values for U and L? U 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:
![]() |
(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類錯誤的要求,我們有:
![]() |
(8) |
From Eqns. (7) and (8), we set:
從方程式(7)和(8),設:
![]() |
(9) |
Similarly, when the ratio is larger than U, we accept vendor B:
同樣,當比值大於U時,我們接受供應商B:
![]() |
(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是第二類錯誤。因此,我們有:
![]() |
(11) |
From Eqns. (7) and (8), we can set:
從方程式(7)和(8),設:
![]() |
(12) |
Combining all the above equations, we get the decision formula for SPRT as the follows:
綜合以上方程,得到SPRT決策公式如下:
![]() |
(13) |
Which is:
即:
![]() |
(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分布的概率密度函數為:
![]() |
(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 η2(η2 > η1). The two likelihood functions are:
假設我們要檢驗一個組件是來自參數為b1 和η1的Weibull種群,還是來自參數為b2 和η2的種群(η2 > η1)。兩個似然函數為:
![]() |
(16) |
and
![]() |
(17) |
The likelihood ratio is:
似然比為:
![]() |
(18) |
When b1 = b2, the above equation becomes:
當b1 = b2時,上式為:
![]() |
(19) |
The decision equation for the log-likelihood ratio R is:
對數似然比R的決策方程為:
![]() |
(20) |
L and U are given in Eqns. (9) and (12). Therefore, Eqn. (20) becomes:
L和U用等式(9)和(12)表示。因此,Eqn(20)就變成:
![]() |
(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
- Calculate η1 and η2 based on the reliability requirements. The reliability function for a Weibull distribution is given by:

Therefore, η2 equals:

and η1 equals:

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

The equation becomes:

- Calculate
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.

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:
- Add a new analysis workbook in an existing project, by choosing Insert > Reports and Plots > Analysis Workbook.
- Select the Based on Existing Template check box and then choose Weibull SPRT Template on the Standard tab.

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

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.





















