# Statistical Power Analysis in Reliability Demonstration Testing: The Probability of Test Success
## 3 Calculation of the Probability of Test Success
### General Calculation Procedure
#### 3.1.1 General Calculation for Failure-Based Tests  
For failure-based tests, such as EoL tests or censored EoL tests, the first step of the bootstrap is to draw \(n\) pseudo-random failure times from the failure distribution \(F(t)\) available from the prior knowledge. The sample size \(n\) and the sampling behavior of these failure times must be the same as the reliability test for which \(P_{\text{ts}}\) is to be calculated. If censoring of the failure times is prevalent in the test, it must be reflected here in the same way. The failure distribution \(F(t)\) of this bootstrap sample is then estimated by, e.g., a maximum likelihood estimation (MLE) [51; 52], and the lifetime at the required reliability \(\hat{t}_{R_{\text{r}}}\) is calculated. Because the failure distribution of the prior knowledge determines the effect size \(\Delta\) and is linked to the alternative hypothesis, \(H_{1}\) (if \(s>0\)), subtracting the required lifetime \(t_{\text{r}}\) from this value yields a value of the test statistic under validity of \(H_{1}\) as follows:  
\[\hat{t}_{H_{1}}=\hat{t}_{R_{\text{r}}}-t_{\text{r}}=\hat{F}^{-1}(1-R_{\text{r }})-t_{\text{r}} \tag{8}\]  
The test statistic under validity of the null hypothesis \(H_{0}\) is obtained in the same way; however, the failure distribution has to follow \(H_{0}\), which means that the safety distance must be negative or equal to zero (\(s\leq 0\)). If the failure distribution under \(H_{0}\) is known and satisfies \(s\leq 0\), it should be used. However, in most practical applications, only prior knowledge about the products' performance is known, which corresponds to \(H_{1}\). In order obtain the failure distribution such that \(s=0\), which translates to \(t_{\text{p}}=t_{\text{r}}\), the failure times of \(F(t)\) can be multiplied by \((1-s)\). This multiplicative transformation ensures a preservation of the shape of the failure distribution, \(F(t)\), which corresponds to the failure mechanism itself. This is in accordance with the shape parameter of a Weibull distribution being tied to the failure mechanism [10]. For the hypothesis test to work, the failure mechanism has to stay the same. Using the already-drawn bootstrap samples of \(\hat{t}_{R_{\text{r}}}\) from \(F(t)\), the following equation yields the test statistic under validity of the null hypothesis, \(H_{0}\):  
\[\hat{t}_{H_{0}}=(1-s)\,\hat{t}_{R_{\text{r}}}-t_{\text{r}}=t_{\text{r}}\cdot \left(\frac{\hat{F}^{-1}(1-R_{\text{r}})}{F^{-1}(1-R_{\text{r}})}-1\right) \tag{9}\]  
where the value of \(s\) with \(t_{\text{p}}\) calculated as \(t_{\text{p}}=F^{-1}(1-R_{\text{r}})\) of the prior knowledge is used. Multiple iterations of sampling from the failure distribution of the prior knowledge, estimating \(\hat{t}_{R_{\text{r}}}\), and transforming the values to obtain the distributions of \(\hat{t}_{H_{1}}\) and \(\hat{t}_{H_{0}}\) enable to use the law of large numbers [53] for calculating the integrals of (6) and (7). The value of \(\Delta_{\text{crit}}\) of (6) is calculated by  
\[C_{\text{r}}\overset{!}{=}\frac{\text{Number of }\hat{t}_{H_{0}}\leq\Delta_{ \text{crit}}}{\text{Total number of iterations}}. \tag{10}\]  
Using the calculated value of \(\Delta_{\text{crit}}\), the \(P_{\text{ts}}\) of failure-based tests can be calculated using  
\[P_{\text{ts}}=\frac{\text{Number of }\hat{t}_{H_{1}}\geq\Delta_{\text{crit}}}{ \text{Total number of iterations}}. \tag{11}\]  
Because the location of the distributions of the obtained test statistics, \(\hat{t}_{H_{0}}\) and \(\hat{t}_{H_{1}}\), are tied to the hypothesis (\(s\leq 0\) and \(s>0\)) and are eventually subject to bias errors due to the estimator of the quantiles (e.g., MLE bias), the two distributions are shifted such that \(\text{median}(\hat{\tau}_{H_{0}})=0\) and \(\text{median}(\hat{\tau}_{H_{1}})=t_{\text{p}}-t_{\text{r}}\). In this way, the bootstrap procedure only estimates the variance and shape of the sampling distributions.