## Abstract

Probabilistic Bayesian methods enable combination of information from various sources. The Bayes theorem is explained and its use is illustrated on several examples of practical importance, such as revealing the cause of an accident or reliability increasing of non-destructive testing. Also its use for continuous quantities and for increasing the reliability of the parameters of normal or Weibull distribution is shown.

### Keywords

- Statistics
- probability
- Bayes
- Bayes theorem
- reliability
- non-destructive testing
- normal distribution
- Weibull distribution
- combination of information

The term “Bayesian methods” denotes probabilistic methods that enable the combination of information on some event or quantity with previous information from measurement or experience. The use of additional information can increase the reliability of our information or reduce the extent of measurements needed for making conclusions on certain event. Examples of application are the determination of the most probable cause of a failure, increasing the reliability of diagnostic methods or increasing the accuracy of the determination of distribution parameters of random quantities.

Bayesian methods are based on the so-called Bayes theorem [1 – 6]. It was originally formulated for discrete quantities, but extended later for continuous quantities as well. These methods have also been included into standards. In this chapter, their principle will be explained, and the use is shown on several practical examples.

## 1. Bayes theorem

Let us assume that an event (* B*) can occur if another event (

*) has occured. The event*A

*, however, could occur by several ways (*A

A

_{1},

A

_{2},...,

A

_{n}), which are mutually exclusive. The probability of simultaneous occurence of both events

A

_{j}and

*is calculated as*B

where * P*(

A

_{j}) is the probability of event

A

_{j}, and

*(*P

*|*B

A

_{j}) is (conditional) probability that event

*can occur provided that event*B

A

_{j}has happened. The total probability of event

*is*B

the summation is done for all possible cases * j* = 1, 2,...,

*. Bayes theorem looks at the issue from the opposite side: ”If event*n

*has happened, what is the probability that it was as a consequence of (or after) event*B

A

_{j}?“ With the use of Equations (1) and (2) and the fact that

*(*P

BA

_{j}) =

*(*P

A

_{j}

*), this probability can be expressed as [2 – 6]:*B

where the total probability * P*(

*) in the denominator is calculated from individual probabilities via Equations (2) and (1). Equation (3) is the simplest form of Bayes theorem. Its use will be shown on three examples. The first example, adapted from [4], does not solve a reliability problem, but is very instructive.*B

** Example 1. **Identification of origin of a sample from several possible sources.

The materials for road building are delivered from two plants with daily capacities 300 t (plant 1) and 700 t (plant 2). The long-term monitoring of quality shows that plant 1 has 2% of all batches faulty and plant 2 has 4% faulty batches. If now a sample is chosen at random at the building site, and if this sample is faulty, which plant is the batch from?

From the total amount of 300 + 700 = 1000 t/day, plants 1 and 2 produce 30% and 70%, respectively. Let us denote event _{1}: the sample is from plant 1; event _{2}: the sample is from plant 2. The corresponding probabilities are * P*(

A

_{1}) = 0.3;

*(*P

A

_{2}) = 0.7. Event

*: the sample is defective. The probability of defective sample from plant 1 is*B

*(*P

*|*B

A

_{1}) = 0.02, and from plant 2, it is

*(*P

*|*B

A

_{2}) = 0.04. The total fraction of faulty production is:

*(*P

*) = 0.3 × 0.02 + 0.7 × 0.04 = 0.034 = 3.4%. The defective material from plant 1 represents 0.02 × 0.3 = 0.006 from the total production of both plants. This is 0.006/0.034 = 0.176 = 17.6% from the total faulty production. Similarly, plant 2 produces 82.4% of the scrap. These numbers also say that if the randomly chosen sample was faulty, a probability of 17.6% exists that it is from plant 1 and 82.4% that it is from plant 2.*B

Using Bayes rule (3), one can express the probability that the defective specimen is from plant 1 as * P*(

A

_{1}|

*) =*B

*(*P

A

_{1}) ×

*(*P

*|*B

A

_{1})/

*(*P

*). The values 0.3 × 0.02/0.034 yield the same result 0.176 as above. Similarly, the probability that the faulty sample is from plant 2,*B

*(*P

A

_{2}|

*) = 0.7 × 0.04/0.034 = 0.824 (=1 – 0.176).*B

If the quality is not considered, the probability that a randomly chosen sample comes from plant 1 equals 30% (i.e. the fraction of production from plant 1). If, however, additional information ”the sample was defective“ was used together with the information on quality in both plants, this probability has dropped to 17.6%. The same information has increased the probability of the sample being from plant 2 from 70% to 82.4%. Although the probability that a sample is from plant 2 was higher even without the Bayes rule (70%), the strengthening of this hypothesis is obvious.

The hypothesis ”the material is from plant 1 (or 2)“ can be strengthened (or mitigated) by checking more specimens. If * n* specimens are taken from one batch, and if all appear to be defective (= event

*), then the expression*B’

*(*P

*|*B

A

_{i}) in Bayes rule (3) must be replaced by the expression

*(*P

*|*B’

A

_{i}) =

*(*P

*|*B

A

_{i})

^{n}. For example, if three specimens were taken from a batch from the above example, and if all were faulty, then

*(*P

*|*B’

A

_{1}) = 0.02

^{3},

*(*P

*|*B’

A

_{2}) = 0.04

^{3},

*(*P

*’) = 0.3 × 0.02*B

^{3}+ 0.7 × 0.04

^{3}= 0.0000472, and

*(*P

A

_{1}|

*) = 0.3 × 0.02*B’

^{3}/0.0000472 = 0.05. Similarly,

*(*P

A

_{2}|

*) = 0.95. In such case, it is nearly sure that the batch was from plant 2.*B’

** Example 2. **Revealing the most probable cause of an accident.

This example is adapted from [2]. An explosion occurred during a repair of a tank for liquid natural gas. The accident could have happened due to (1) static electricity, (2) fault in the electric equipment, (3) work with open flame during the repair, or (4) intentional act (sabotage). Engineers for risk analysis estimated that the accident could happen with a probability of 25% due to static electricity, 20% due to a fault in the electric equipment, 40% due to work with open flame, and 75% due to a sabotage. The discussion with them also gave the following subjective assessment of probability of individual causes: 0.30, 0.40, 0.15, and 0.15. What is the most probable cause of the explosion in view of all this information?

Solution. Event * A*: presence of conditions for explosion:

*(*P

A

_{1}) = 0.30;

*(*P

A

_{2}) = 0.40;

*(*P

A

_{3}) = 0.15;

*(*P

A

_{4}) = 0.15 (note: Σ

*(*P

A

_{i}) = 1.00). Event

*: explosion. The probabilities of explosion under particular conditions are*B

*(*P

*|*B

A

_{1}) = 0.25;

*(*P

*|*B

A

_{2}) = 0.20;

*(*P

*|*B

A

_{3}) = 0.40;

*(*P

*|*B

A

_{4}) = 0.75. Total probability of the accident:

*(*P

*) = 0.30 × 0.25 + 0.40 × 0.20 + 0.15 × 0.40 + 0.15 × 0.75 = 0.3275. Probability that the explosion has happened due to: (1) static electricity:*B

*(*P

A

_{1}|

*) = 0.30 × 0.25/0.3275 = 0.229 = 22.9%, (2) electric appliance:*B

*(*P

A

_{2}|

*) = 24.4%, (3) open flame:*B

*(*P

A

_{3}|

*) = 18.3%, and (4) sabotage:*B

*(*P

A

_{4}|

*) = 34.3%. [Compare these updated probabilities with the original estimates*B

*(*P

A

_{i}).]

** Example 3**. Increasing the reliability of nondestructive testing.

Welded components are tested for the occurrence of defects (cracks). The device used for nondestructive testing is not perfect. It classifies defect correctly (as defect) only with probability 98%, whereas, in 2% of all cases, it does not recognize the crack and classifies the component as good. On the contrary, the device marks 96% of good parts as good, but 4% classifies as with a crack. According to long-term inspection records, 3% of all tested components contain cracks. The questions are: If the tested part was classified as ”wrong“ (i.e. with a defect), what is the probability that it is actually (a) wrong or (b) good? And what about if the component was classified as ”good“?

Solution. Event _{1}: Component contains a defect, _{2}: component is good. * P*(

A

_{1}) = 0.03;

*(*P

A

_{2}) = 0.97. Event

*: component is classified as wrong.*B

*(*P

*|*B

A

_{1}) = 0.98;

*(*P

*|*B

A

_{2}) = 0.04. The fraction of tested components marked as wrong:

*(*P

*) = 0.03 × 0.98 + 0.97 × 0.04 = 0.0682.*B

Case 1a. Probability that the component marked as wrong is actually wrong, is * P*(

A

_{1}|

*) =*B

*(*P

A

_{1}) ×

*(*P

*|*B

A

_{1})/

*(*P

*) = 0.03 × 0.98/0.0682 = 0.431 = 43.1%. Case 1b. Probability that the component marked as wrong, is actually good, is*B

*(*P

A

_{2}|

*) = 0.97 × 0.04/0.0682 = 0.569 = 56.9%. (Remark: Due to the high proportion of good parts (98%), the proportion of good but rejected parts is high.)*B

Event * B’*: Component is classified as good.

*(*P

*|*B’

A

_{1}) = 0.02;

*(*P

*|*B’

A

_{2}) = 0.96. The total fraction of components, denoted as good, is

*(*P

*) = 0.03 × 0.02 + 0.97 × 0.96 = 0.9318. Case 2a. Probability that the component marked as good is actually wrong, is*B’

*(*P

A

_{1}|

*) = 0.03 × 0.02/0.9318 = 0.00064 = 0.06%. Case 2b. Probability that the component marked as good is actually good is*B’

*(*P

A

_{2}|

*) = 0.99936 = 99.94%.*B’

Recommendation: All rejected components could be tested once more to reduce the number of discarded good components.

A similar approach can be used in medicine (e.g. in cancer screening).

## 2. Bayes rule for continuous quantities

If the probability of event * B* depends on the value of a continuous quantity

*, described by the probability density*A

*(*f

*), it is possible to calculate the total probability of this event as*A

the integration is performed over the whole domain * A*. [The integration has replaced the summation in Equation (2).] An example is the nondestructive detection of cracks in welds:

*(*P

*) is the probability of crack detection,*B

*(*f

*) is the probability distribution of cracks of size*A

*, and*A

*(*P

*|*B

*) is the probability of detection of a crack of size*A

*, the so-called ”probability of detection“ curve (shortly POD curve) of the device.*A

Now, a question can be asked: If event * B* (result of the test) has occurred, what is the actual distribution of random variable

*? Bayes rule (3) can be modified also for this case; the formula for updated distribution of quantity*A

*is [1, 3]:*A

where * P*(

*) is given by Equation (4). For example, the updated distribution of crack lengths can be used for the estimation of time to fatigue failure by the Monte Carlo method [1, 2].*B

## 2. Other applications

Bayesian methods can also be used for the improvement of parameter estimate of various probability distributions. Three examples follow.

The mean value * μ* and standard deviation

*of a population with normal distribution are usually unknown, so that they are replaced by their estimates*σ

*and*m

*from a sample of size*s

*. The estimate of the mean value can be refined via confidence interval:*n

where _{α,ν} is * α*-critical value of Student’s

*-distribution for*t

*=*ν

*– 1 degrees of freedom.*n

The estimate can be made more accurate if additional information is available (e.g. estimates of _{0} and _{0} from previous measurements or records). If the number _{0} of these values is known, and if the assumption can be made that all samples (new and old) belong to the same population, the following procedure may be used. The updated average is calculated as the weighted average of both sample averages:

where _{u} is the updated number of values. The updated standard deviation is

Then, the updated confidence interval for * μ* can be calculated with

*,*m

*, and*s

*in (9) replaced by the updated values*n

m

_{u},

s

_{u}, and

n

_{u}. If

n

_{0}is unknown, the literature on Bayesian methods recommends an approximate formula [1, 5, 6]:

based on the idea that _{0} and _{0} carry information corresponding to a fictitious sample of certain size _{0}. The smaller the scatter _{0}^{2} compared to ^{2}, the more important are the original results and the larger is the size of the fictitious sample. (An important condition for this estimate is that the ”a priori“ values of _{0} and _{0} were obtained from large samples.)

The ISO 12491 standard ”Statistical methods for quality control of building materials and components“ recommends the following formula for the Bayesian estimate of * p*-quantile of normal variable

*:*x

where _{p} = _{p}(* α*,

*,*p

ν

_{u}) is

*-quantile of Student’s*p

*distribution for*t-

ν

_{u}=

n

_{u}– 1 degrees of freedom. If no additional information is available, the standard recommends the original values

*,*m

*, and*s

*.*n

Some quantities, such as the strength or time to failure due to fatigue, can often be approximated by Weibull distribution:

The parameters * a, b*, and

x

_{0}are determined from tests. (The threshold value

x

_{0}is often assumed equal zero.) Sometimes, the number of tests is too low for obtaining reliable values of all parameters. Fortunately, the investigated component or structure is often not a quite new solution but rather an improvement of the current conception. In such case, one can expect that the failure mechanism will be similar as in the previous construction. As the parameter

*is closely related to the character of failures, one can assume that the value*b

*will be approximately the same as for the previous components and use it as a known constant. Under this assumption, the finding of the remaining parameters*b

*and*a

x

_{0}from small amount values is more reliable. This approach is called ”Weibayes“ [7]. The assumed value

*is more reliable if it was determined from many tests. It is thus suitable to keep records from all tests – for possible use in the future!*b

## 4. Software for Bayesian methods

The problems from the above first three examples can be solved easily using Excel and standard Bayesian notation. Some simple programs can be found in the literature, for example [2, 3]. At ETH Zürich, a PC program Combinfo was created, which enables the combination of data from various sources [8], including vague information, such as probability estimates by experts or by judgment. The program allows assigning various weights to individual information. Bayesian methods are also incorporated into software packages for reliability analysis, such as www.reliability.com, www.weibull.com, www.reliasoft.com, or www.itemsoft.com.

## References

- 1.
Ang A H S, Tang W H. Probability Concepts in Engineering Planning and Design. Vol. 1, „Basic Principles“. New York: John Wiley; 1975. 574 p. - 2.
Martz H F, Waller R A. Bayesian Reliability Analysis. New York: John Wiley; 1982. 745 p. - 3.
Press S J. Bayesian statistics: Principles, models and applications. New York: John Wiley & Sons; 1989. 256 p. - 4.
Harr M E. Reliability-based design in civil engineering. Mineola, NY: Dover Publications; 1996. 291 p. - 5.
Holický M. Principles of verification of reliability and life endurance of structures (in Czech: Zásady ověřování spolehlivosti a životnosti staveb). Praha: ČVUT; 1998. ISBN 80-01-01880-6. 101 p. - 6.
Holický M, Marková J. Principles of reliability theory and risk evaluation (in Czech: Základy teorie spolehlivosti a hodnocení rizik). Praha: ČVUT; 2005. ISBN 80-01-03129-2. 115 p. - 7.
Abernethy R B. The New Weibull Handbook. 4 ^{th}ed. North Palm Beach, Florida: Robert B Abernethy; 2001. ISBN 0-9653062-1-6. - 8.
Scheiwiller A. Informationsverknüpfung im Bauwesen. IBK Bericht Nr. 241, ETH Zürich, Basel: Birkhäuser Verlag; 1999. 126 p.