Statistics Preprints Statistics

1998 A Bayesian on-line change detection algorithm with process monitoring applications Pradipta Sarkar Iowa State University

William Q. Meeker Iowa State University, [email protected]

Follow this and additional works at: http://lib.dr.iastate.edu/stat_las_preprints Part of the Statistics and Probability Commons

Recommended Citation Sarkar, Pradipta and Meeker, William Q., "A Bayesian on-line change detection algorithm with process monitoring applications" (1998). Statistics Preprints. 1. http://lib.dr.iastate.edu/stat_las_preprints/1

This Article is brought to you for free and open access by the Statistics at Iowa State University Digital Repository. It has been accepted for inclusion in Statistics Preprints by an authorized administrator of Iowa State University Digital Repository. For more information, please contact [email protected]. A Bayesian on-line change detection algorithm with process monitoring applications

Abstract This work has been motivated by some issues of process monitoring in casting applications. In die casting, as time passes, material is deposited on the inside wall of the die. This foreign material can cause an unacceptable level of porosity in the output of the casting process. After accumulated material reaches a certain level, some of the output of the casting process no longer meets the specifications and the process must be stopped to clean the die. Sudden changes in output quality are also common in casting processes. The degree of porosity of the output of the casting process changes suddenly if, for example, one opens the door of the production facility thereby changing the laboratory temperature, causing an immediate larger accumulation of foreign material. Also day-to-day variation in weather, changes in humidity, and other factors can be responsible for this kind of change.

Keywords Nondestructive testing, Nondestructive evaluation, Empirical and hierarchical Bayes, Rejection sampling, Trend

Disciplines Statistics and Probability

Comments This preprint has been published in Quality Engineering 10 (1998): 539- 549..

This article is available at Iowa State University Digital Repository: http://lib.dr.iastate.edu/stat_las_preprints/1

ABAYESIAN ON-LINE CHANGE DETECTION

ALGORITHM WITH PROCESS MONITORING

APPLICATIONS

Pradipta Sarkar William Q. Meeker

[email protected] [email protected]

Center for NondestructiveEvaluation

and

Department of Statistics

Iowa State University

Ames, Iowa 50011

.

1 Intro duction

1.1 Motivation: Casting Example

This work has b een motivated by some issues of pro cess monitoring in casting applications. In die

casting, as time passes, material is dep osited on the inside wall of the die. This foreign material

can cause an unacceptable level of p orosity in the output of the casting pro cess. After accumulated

material reaches a certain level, some of the output of the casting pro cess no longer meets the

sp eci cations and the pro cess must b e stopp ed to clean the die. Sudden changes in output quality

are also common in casting pro cesses. The degree of p orosity of the output of the casting pro cess

changes suddenly if, for example, one op ens the do or of the pro duction facility therebychanging

the lab oratory temp erature, causing an immediate larger accumulation of foreign material. Also

day-to-dayvariation in weather, changes in humidity, and other factors can b e resp onsible for this

kind of change.

1.2 On-line vs. O -line Change Detection Algorithm

Let y ;y ;::: b e a sequence of observed pro cess output values (such as the degree of p orosity) with

1 2

conditional density f (y jy ;:::;y ;  ). Let the unknown time of change b e t . In on-line change-

k k 1 1 0

detection algorithms, the ob jective is to detect a change as so on as p ossible, if not immediately after

it o ccurs. Detection of the change-time is p erformed by considering all past data and stopping at

the rst p oint in time at which there is sucient evidence that a change of imp ortance has o ccurred. 1

Mathematically, such a stopping-time rule can b e expressed as:

t =minf (y ;:::;y )  g

a n 1 n

n

where ; ;::: is a family of functions of n co-ordinates indexed by time and  is a threshold

1 2

sp eci ed to control the probability of detection errors. For example, may b e the probability

n

of exceeding the critical level at the n th insp ection. Another alternativewould b e to de ne

n

n

n

as max log  ; where  is the likeliho o d ratio for the observations from time j to time n (The

j j

1j n

likeliho o d ratio is generally de ned as the ratio of the probability of the data maximized over all

pro cess states to the probability when the pro cess is op erating correctly.)

O -line algorithms, on the other hand, can b e lo oked up on as p ostmortem analyses. They are

designed to collect data and test if there had b een anychange in the level of the pro cess sometime

during the past. If it is suggested that there was a change, these algorithms try to estimate the

unknown change time. In this pap er we will fo cus mainly on the on-line algorithms.

1.3 Overview

Section 2 provides a brief survey of literature and describ es the basic problem of detecting a change of

known magnitude. This basic problem is imp ortant for understanding the subsequentdevelopments

in the following sections. In section 3 we will generalize to more realistic situations of multiple

changes of unknown magnitude, and trend in the pro cess . Section 4 will b e devoted to the

discussion of rejection sampling and its use in Bayesian up dating of the distributions used in making

decisions. In section 5 we will use a simulated example to illustrate the b ehavior of the metho dologies

develop ed in sections 2 and 3. In section 6 we will formulate a decision theory-based metho d to

determine an optimum insp ection interval. Section 7 illustrates the metho dology of section 6 with

an example. Finally, in section 8, we discuss the p ossibility of extending the metho dology describ ed

in this pap er to a hierarchical Bayes formulation and provide some concluding remarks.

2 Brief Review of Literature

2.1 Bayes Typ e Algorithm for Detecting Changes in Pro cess Monitoring

ABayesian change detection approachhasseveral advantages over non-Bayesian approaches. It

is technically simple and is easier to implement and allows incorp oration of available engineering

information. There is a large amount of literature on Bayesian changep oint detection problems.

Smith (1975) presents the Bayesian formulation for a nite sequence of indep endent observations.

In particular he gives details for binomial and normal distribution mo dels. Some other works in this

area include

 Changep oint in univariate : Bo oth and Smith (1982), West and Harrison (1986).

 Gammatyp e random variables and Poisson pro cesses : Diaz (1982), Hsu(1982), Raftery and

Akman (1986). 2 process level -2024681012

0 20 40 60 80 100

time

Figure 1: Increase in pro cess mean, pro cess remaining the same .

 Changep oint in linear mo dels : Bacon and Watts (1971), Ferreira (1975), Holb ert and Bro emel-

ing (1977), Choy and Bro emeling (1980), Mo en, Salazar and Bro emeling (1985), Smith and

Co ok (1990).

 Hierarchical Bayes formulation of changep oint mo del : Carlin, Gelfand and Smith (1992).

Most of these references provide metho dology for o -line problems. We are interested in pro cess

control applications where on-line algorithms are needed. The next subsection describ es the simplest

p ossible on-line scenerio.

2.2 Single Jump - Before and After-Change Parameter Values Known

In the simplest case, the parameter values (e.g., mean pro cess level) b efore and after the change,

 =  and  =  resp ectively, are b oth known. Figure 1 shows a pro cess where the mean level

0 1

changes after 50 cycles, but pro cess variance remains the same. Figure 2 shows a pro cess where the

mean is constantbutvariance increases after 50 cycles. These kinds of changes are typical in many

industrial pro cesses. Detection of suchchanges has b een discussed in detail by several authors in

di erent contexts. Here we describ e brie y the solution to this problem to motivate our following

developments. Some of the pioneering work for this mo del is due to Girshick and Rubin(1952)

and Shirayaev(1961) and is describ ed nicely in Basseville and Nikiforov(1993). Our notation will

follow closely that in Basseville and Nikiforov(1993). Assume that the prior distribution of (discrete)

change time t is Geometric() and is given by,

0

k 1

P (t = k )=(1 ) ;k =1; 2;:::

0 3 process quality -4-20246

0 20 40 60 80 100

time

Figure 2: Increase in pro cess variance, pro cess mean remaining the same . porosity -1 0 1 2 5101520 time Bayesian Updating

rho=0.10 rho=0.25 rho=0.50 Posterior probability 0.0 0.4 0.8 5101520

Inspection time

Figure 3: Bayesian up dating when pro cess mean changes. Top : Porositylevel, Bottom: Up dated

probability that the pro cess parameter has changed 4 porosity -1.0 0.0 1.0 2.0 5101520 time Bayesian Updating

rho=0.10 rho=0.25 rho=0.50 Posterior probability 0.0 0.2 0.4 0.6 0.8 0 5 10 15 20

Inspection time

Figure 4: Bayesian up dating when there is no change in the pro cess mean.Top : Porositylevel,

Bottom: Up dated probability that the pro cess parameter has changed

where  is the probabilityofchange in each pro duction cycle, an estimate of whichisavailable from

pro cess history. Let 0 and 1 denote, resp ectively, the pro cess states b efore and after the change.

The asso ciated transition matrix is given by

! !

p(0j0) p(1j0) 1  

P = = :

p(0j1) p(1j1) 0 1

Here p(ijj ) is the transition probability from state j to state i at each t ;i =1; 2;:::.We will denote

i

by p(0) = 1  and p(1) =  the prior probabilities asso ciated with the states 0 and 1 resp ectively

at time 0. Then p osterior probability that the pro cess is at state 1 at the k th insp ection/pro duction

cycle can b e calculated using the Bayes rule and is given by,

 (1)f (y ;  )+ (1  (1))::f (y ;  )

k 1 k 1 k 1 k 1

;  (1) =

k

 (1)f (y ;  )+ (1  (1))::f (y ;  )+ (1  (1))(1 )f (y ;  )

k 1 k 1 k 1 k 1 k 1 k 0

where y is the observation at the k th insp ection/pro duction cycle and f (y ;  ) is the likeliho o d at

k k

the k th cycle ,  =  ; :

0 1

The stopping-time rule is :

t =minf (1)  g:

a k

k

That is, a change is detected when the p osterior probabilityofachange  (1) exceeds  for the rst

k

time. The value of  is chosen to satisfy certain criteria, such astohave a sp eci ed probabilityof

having a false detection (i.e., a detect when the  =  ).

0 5 process level 0 5 10 15 20 25

0 50 100 150 200 250 300

time

Figure 5: Multiple jumps in the pro cess level.

3 Mo dels for Pro cess Degradation

Generally prior information ab out the distribution of the change time is available from the past

history of the pro cess. In the following description the pro cess characterization parameter  is a

scalar. The theory,however, can b e extended easily to the case when the parameter is a vector of

twoormorequantities.

3.1 Multiple-Jump Case

In practice, the multiple-jump situation is more common than the single jump situation. Although it

is usual in the industrial pro cess control applications to know the b efore-change parameter value (for

example, when a pro cess starts, typically the machine parameters are set to some xed ideal values),

once a pro cess is running, more than one jump might o ccur b etween two consecutive insp ection

p oints. Also the pro cess is generally not insp ected at every pro duction cycle, but it is done at some

xed time interval. Thus, it is necessary to mo dify and extend the simple mo del of the previous

section. When a pro cess jumps several times, in an on-line approach, our goal is to detect a change of

an imp ortant magnitude as so on as p ossible after the underlying pro cess characterization parameter

has reached a critical level.

Let us denote the pro duction cycle times by t ;t ;:::. Supp ose that the actual measurements of

1 2

(1) (2) (k ) (k )

pro cess output are taken at t ;t ;:::.Thus t = t for some j  k ,say t = t ;k  1. Let 

j i 0

k

(known) b e the target for the pro cess. Also, when the pro cess starts or it is readjusted, we assume

that its level is reset to  :

0

Ateach pro duction cycle the pro cess level either jumps (with probability q ) or remains at the same 6

level (with probability1 q ), and if there is a jump, the magnitude of the jump is a random variable

with cumulative distribution function H (:; ): So the jump at the i th pro duction cycle is Y = X 

i i i

~

where the  's are indep endent Bernoulli random variables with P ( =1)=q; P ( =0)=1 q;

i i i

and

iid

 H (:; ); X

i

~

(k )

The level of the pro cess after the k th measurement is denoted by  . This quantity can b e

calculated recursively as

i i

k k

X X

(k ) (k 1)

   =  + Y =  + Y :

i 0 j j

k

j =1 j =i +1

k1

The p osterior densityof (expressing the state of knowledge given the available past data) after

k th measurement is given by

R

(k 1) (k 1) (k 1) (k 1)

 ( ) :g( j ) :f(y ;  ) d

k

(k ) (k )

RR

; (1)  ( )   ( jy )=

k

(k 1) (k 1) (k 1) (k 1)

 ( ) :g( j ) :f(y ;  ) d d

k



f (y ;  )g ( )

k

R

=



f (y ;  )g ( )d

k

R

(k 1) (k ) (k 1)  (k 1) (k 1) (k 1) (k 1)

where g (j ) is the p df of  given  and g ( )=  ( )g ( j )d ; is

the new prior just b efore the k th measurement. The stopping rule is formulated as in section 2.2.

3.2 Several Jumps Approximation to Trend

Nowwe consider the case when the pro cess has a sto chastic trend. In such a situation weare

interested in detecting the change b efore the pro cess deviates to o much from the target, typically

when the pro cess level go es b eyond a critical level. This case can b e thoughtofasacombination

ofanumb er of small jumps with random size. This is a sp ecial sub case of the several jumps case

with q =1: Wemodeleachjumpasagamma( ; ) increment. Then the sum of several jumps also

follows a gamma distribution:

0 1

i

k

X

@ A

Y  Gamma ((i i ) ; ) ; (2)

j k k 1

j =i +1

k1

  h  i 

[ i i ]

k k1

(i i ) 1

k k1



(k 1) (k 1) (k 1) (k 1)

: exp (  ) :   g  j ; > : =

([i i ] )

k k 1

The p osterior density can b e up dated as usual using Bayes rule. The stopping rule is as b efore.

(k ) (k 1)

Although the availability of a closed form expression for the conditional densityof given 

makes the calculation relatively simpler, obtaining an analytical solution for the p osterior densityis

imp ossible and even a numerical solution is computationally demanding. This has led us to use a

simulation based approach using rejection sampling to compute the p osterior distribution of  . This

approach will b e describ ed in the next section. 7 process level 0 102030

0 50 100 150 200 250 300

time

Figure 6: Multiple jumps approximation to trend.

4 Simulation Based Approach for Up dating the Prior Dis-

tribution

The calculation of the p osterior densityof involves several integrals, as shown in equation (1).

Computational needs will b e considerably higher if the parameter  isavector. Suchmultidimen-

sional numerical integration is dicult to carry out, requiring close attention to numerical metho ds

and substantial amounts of computer time. Also since our problem is an on-line algorithm, nding

the range of numerical integration at a later stage is not an easy task. This has led us to use the

simulation based technique of rejection sampling, describ ed by Smith and Gelfand(1992), to evaluate

suchintegrals. Needed calculations are easy to program and can b e carried out quite eciently by

using any standard mathematical/numerical software package. The metho d of rejection sampling

used here is describ ed in detail in the app endix.

We initially generate a large numberofobservations from the prior distribution g ( ) . Then we

propagate those observations according to our random gamma-distributed increment mo del given



by equation (2), providing a large sample from the propagated prior density,say g ( ); at the next

insp ection. Then we combine this propagated prior with the likeliho o d to obtain a large sample from

the p osterior. For the trend case q =1; so in order to get the propagated prior we add a random

gamma incrementtoeach observation at each pro duction cycle.

To obtain the p osterior distribution, we use rejection sampling. Rejection sampling can b e viewed

as a random lter. Points pass through the lter with probability equal to the relativelikeliho o d

of the p oint, as determined by the likeliho o d function of the data. The result is a random sample

from the p osterior distribution that can b e used to approximate this distribution. Details are given 8

in the app endix.

WehavewrittenaFORTRAN program using NAG routines (The Numerical Algorithms Group

Limited, 1993) to calculate the up dated at each insp ection and the proba-

bility that the pro cess is b eyond the critical level. Wehave used S-Plus (Statistical Sciences, 1995)

to obtain graphical output. The program requires the following inputs:

1. An initial prior distribution for  ,

2. The insp ection interval,

3. Parameters for the gamma increment distribution,

4. The distribution of measurement errors,

5. The observations at the actual insp ections,

6. The critical level for the pro cess output level.

The initial prior distribution for  can b e estimated from the knowledge ab out the precision of the

pro cess (eg., how precise the machine is) and the measurement error distribution can b e estimated

from the past measurement errors. The parameters of the gamma increment mo del can also b e

estimated from past pro cess data history.

5 Example of Pro cess Monitoring

We consider a pro cess that jumps by a random amountatevery pro duction cycle. The size of the

jump at each cycle follows a gamma distribution with mean 0.2 and variance 0.1. The initial level of

the pro cess is 0. The critical level is  =5:1. When the pro cess is reset, the pro cess output variable

c

has a normal distribution with mean 0 and standard deviation 0.25. This variation is exp ected to

be low and may b e caused, for example, by the errors in adjusting the pro cess equipment. We

describ e the measurement error with a normal distribution with mean 0 and standard deviation

0.5. In our illustration the pro cess is insp ected at every 10th pro duction cycle. Supp ose that the

observed values were y =2:8;y =3:8;y =3:9;y =4:1 resp ectively,asmarked by small

(1) (2) (3) (4)

t t t t

squares in Figure 7. After each observed value of y is rep orted, the Bayesian up dating formula is

used to obtain the current p osterior distribution. If the p osterior probalitityof    exceeds 0.1,

c

the pro cess is stopp ed and readjusted.

At each insp ection, the dotted and the solid curves in Figure 7 denote the prior and p osterior

distributions resp ectively.At the rst insp ection our observation is towards the right tail of the

prior suggesting that the pro cess is a bit higher than predicted by the prior. The Bayesian up dating

scheme accounts for this and we get a p osterior that is centered to the right of the prior mean. At

the second insp ection our observed value is a little lower than the center of the prior. This is also

re ected in the p osterior : although the prior probability of exceeding the critical level is greater

than 0.1, the p osterior distribution has a negligible probabilityabove the critical level. This implies

that in the light of our observations at the rst two insp ections, wedonotyet need to adjust the

pro cess. After the third insp ection, the p osterior distribution again do es not suggest that the pro cess

should b e adjusted. Note that in this case the prior probability of exceeding the critical level is more

than 0.5. When combined data, however, there is not much evidence (probability = 0.06) that the 9 Posterior Prior and 0510

0 10203040

Cycle

Figure 7: Bayesian Up dating for Trend Case : Gamma Jump at Each Pro duction Cycle.

pro cess output level has reached the critical limit. At the fourth insp ection our observation is at the

left tail of the prior, but the p osterior indicates a probabilityof0.26that  has crossed the critical

level. At this p oint the decision is to stop the pro cess for adjustment.

6 Optimization of the Insp ection Interval

In this section, for a given cost structure, weinvestigate the e ect that the insp ection interval has

on total cost.This allows cho osing the insp ection interval to minimize the average cost over a long

p erio d of time.

For a given critical level  we calculate the long run average cost for di erent insp ection intervals.

c

The optimum insp ection interval is the one that minimizes the long run average cost of pro duction.

We also use a simulation-based approach for this calculation.

First we x an insp ection interval, say k .We generate 1000 values from the prior distribution

and let the pro cess degrade for the rst k pro duction cycles. Atthek th cycle one of these degraded

 

numbers, say  is randomly selected and a numb er, say y is generated from the likeliho o d f (:;  ):

This y is treated as the pseudo observed value at the k th pro duction cycle (or equivalently, the rst

insp ection) and is used for up dating the prior to get a p osterior. Ateach insp ection wehavetwo

options: continue the pro cess or adjust the pro cess. If the up dated probability of exceeding the

cuto value  is more than the (predetermined) threshold level (e.g., 0.1) the pro cess is readjusted.

c

Thus wehave a prior corresp onding to a pro cess restart instead of the usual up dated p osterior. Then

the p osterior is considered as the new prior and is allowed to degrade for the next k cycles after

which another pseudo observation is generated by the ab ovemechanism. Up dating is p erformed 10

again and the pro cedure is rep eated for a large numb er (say N ) of pro duction cycles.

Three typ es of costs are asso ciated with the pro cess :

 C : cost p er unit of (squared) deviation b etween  and the target  :

d 0

 C : cost of a single adjustment of the pro cess.

a

 C : cost of a single insp ection.

i

Total cost over N cycles is calculated as,

Total cost = Cost of deviation + Cost of adjusting the pro cess + Cost of insp ection.

Cost of deviation at a particular cycle is C times the sum of the squared deviations of the (p ossibly)

d

degraded numb ers from the target. Summing these over all N cycles gives the total cost of deviation.

Total cost of insp ection is C  [N=k] ; where [z ] denotes the largest integer not exceeding z .Total

i

cost of adjustment= C  numb er of adjustments (in N cycles). The long run average cost p er

a

unit time is the ratio of the total cost over N cycles to N , the total numb er of cycles, provided N

is suciently large. We calculate the long run average costs for di erentvalues of k and cho ose the

value of k that minimizes total cost.

7 Examples of Insp ection Optimization

The long run exp ected cost based decision criteria, as discussed in the previous section, can b e

illustrated with the following example. We generated 10,000 observations from the pro cess describ ed

in the previous example. But this time wevaried the insp ection intervals. The costs of deviation

(p er unit time), adjustment and insp ection were xed at 10, 200, and 100 resp ectively.

Table 1: Comparison of Long Run Average Costs for Di erent Insp ection Intervals

Insp ection Interval Long Run Average Cost

1 185.92

2 141.24

3 123.64

4 118.91

5 119.29

6 121.98

7 122.06

8 124.80

9 124.88

10 130.29

We can see from the table 1 that the long run exp ected cost is minimized when the insp ection

interval is 4 (the gure for 5 is very close). So the optimum insp ection interval should b e 4 or 5. 11

Table 2: Comparison of Short Run Average Costs for Di erent Insp ection Intervals : 50 Cycles Per

Hour, 8 Hrs. Shift

Insp ection Interval Short Run Average Cost s.d. 25 p ercentile 75 p ercentile

1 182.57 9.39 179.52 187.81

2 137.30 6.67 132.74 142.35

3 121.78 8.08 117.16 126.75

4 118.81 10.24 114.42 123.92

5 115.97 8.32 109.82 120.91

6 114.69 10.29 107.60 121.06

7 117.93 9.35 110.38 123.92

8 120.01 11.85 114.24 127.31

9 123.53 10.57 116.62 130.65

10 126.55 10.37 119.44 133.08

If we insp ect to o often, cost of insp ection will dominate the gure for average cost. On the other

hand, if we do not insp ect frequently enough, the cost of deviation will b e dominant. Thus optimum

insp ection interval is the one that balances these costs.

Table 2 is a comparison of short run average costs for di erent insp ection intervals. In many

practical situations a pro cess runs for a shift of 8 or 9 hours and then the pro cess is adjusted b efore

the next shift starts. This that the long run average cost may not b e a feasible idea in many

practical situations. To illustrate this situation we consider a pro cess that runs for 8 hours with 50

cycles p er hour. For each xed insp ection interval, we generate 200 such realizations of the pro cess

and calculate the average cost over 8 hour p erio d. Table 2 shows that the optimum insp ection

interval is 6, but the average costs when the insp ection intervals are 4, 5, 6 or 7 are very close.

So although the results of table 1 and table 2 are not same, they are close. We do not lose much

by approximating the short run average cost by long run average cost to make decision ab out the

insp ection interval.

8 Concluding Remarks And Directions for Future Develop-

ments

Although wehave illustrated the multiple jump case for \jumps in mean level" of the pro cess, the

simulation-based algorithm is general enough to handle changes in other parameters of the pro cess

as well. Some other typ es of changes that one maybeinterested in include :

 Multiple changes in the pro cess variance, pro cess level (mean) remaining the same.

 Trend in the pro cess level (mean) asso ciated with an increase in the pro cess variance. This is

also of interest in mo deling some nancial time series. 12

Wehave so far assumed the pro cess parameters to b e either known or estimated from the past

history.Ifwe estimate them from the past history the analyses b ecome empirical Bayesian in nature.

If no information ab out the gamma parameters and/or the likeliho o d parameters is available, our

mo del can b e readily extended to a hierarchical Bayesian one by assigning di use prior distributions

to these parameters. See Gelman, Carlin, Stern and Rubin(1995).

Also note that the equation (1) is very general, it do es not involveany particular density for

(k 1)

g (:j ). In the trend example wehave assumed gamma increments, but there is nothing sp ecial

to this distribution. We could have mo deled the jumps as any other sequence of indep endent random

variables.

Acknowledgements

This work was supp orted by the program for Integrated Design, NDE and Manufacturing Sciences

under U.S. DepartmentofCommerce, National Institute of Standards and Technology Co op erative

Agreement No. 70NANB4H1535.

App endix : Rejection Sampling

Supp ose that wehave random variates from an absolutely continuous density m (x). But what we

1

really want is a sample from m (x), a probability density that is absolutely continuous with resp ect

2

to m (x): Rejection sampling is a useful to ol in such situation. This metho dology can b e extended

1

to the case when m (x) is not known completely, but is known to b e prop ortional to some function

2

R

m (x), [i.e., m (x)=m (x)= m (x)].

3 2 3 3

The algorithm pro ceeds as follows :

1. Find a p ositive constant M suchthatm (x)=m (x)  M , for all x:

3 1

2. Generate x from m (x):

1

3. Generate u from Uniform(0,1).

4. If u  m (x)=(M  m (x)) accept x, otherwise go to step 2.

3 1

For details see Smith and Gelfand(1992).

The rejection sampling algorithm can b e used very e ectively to sample from the p osterior

distribution (Meeker and Escobar, 1998). When formulated in terms of the relativelikeliho o d, the

algorithm has more intuitive app eal. Let L( ; y ) denote the likeliho o d of ; and supp ose that the

^

maximum of the likeliho o d is attained at : Then the relative likeliho o d is de ned as

L( ; y )

R( )= :

^

L( ; y )

We note that the p osterior distribution of  canbewrittenas

R( )h ( ) L(dataj )h ( )

0 0

R R

= ; h ( jdata) =

1

L(dataj )h ( )d R( )h ( )d

0 0

where h ( ) is the prior p df of : So m = h ( );m = R( )h ( );m =m = R( )  1(= M ): Hence

0 1 0 3 0 3 1

the rejection sampling algorithm in terms of relativelikeliho o d can b e formulated as follows : 13

1. Generate  from the prior.

2. Generate u from Uniform(0,1).

3. If u  R( ), accept  , otherwise go to step 1.

(k )

We use this approach to generate a large sample from the p osterior distribution  ( jy ):

k

References

Bacon, D. W. and Watts, D. G. (1971), Estimating the Transition b etween TwoIntersecting

StraightLines. Biometrika, 58, 525-534.

Basseville, M. and Nikiforov, I.V. (1993), Detection of Abrupt Changes, Theory and Applications,

Prentice Hall, Englewo o d, New Jersey.

Bo oth, N. B. and Smith, A. F. M. (1982), A Bayesian Approach to Retrosp ective Identi cation of

Change Points, J. Econ., 19, 7-22.

Carlin, B. P., Gelfand, A. E. and Smith, A. F. M. (1992) Hierarchical Bayesian Analysis of

Changep oint Problems, Applied Statistics, 41, 389-405.

Choy, J. C. and Bro emeling, L. (1980), Some Bayesian Inferences for a Changing Linear Mo del.

Technometrics, 22, 71-77.

Diaz, J. (1982), Bayesian Detection of a Change of Scale Parameter in Sequences of Indep endent

Gamma Random Variables. Journal of Econometrics, 19, 23-29.

Ferreira, P. E. (1975), A Bayesian Analysis of a Switching Regression Mo del : A Known Number

of Regimes. Journal of the American Statistical Association, 70, 370-374.

Gelman, A., Carlin, J., Stern, H. and Rubin, D. (1995), Bayesian Data Analysis, Chapman and

Hall, New York.

Girshick, M. A. and Rubin, H. (1952), A Bayes approach to a qualitycontrol mo del.Annals of

Mathematical Statistics, 23, pp.114-125.

Holb ert, D. and Bro emeling, L. D. (1977), Bayesian Inference Relate to Shifting Sequences and

Two-Phase Regression. Communications in Statistics, Part A{Theory and Methods, 6,

265-275.

Hsu, D. A. (1982), A Bayesian Robust Detection of Shift in the Risk Structure of Sto ck Market 14

Returns. Journal of the American Statistical Association, 77, 29-39.

Meeker, W. Q. and Escobar, L. A. (1998), Statistical Methods for Reliability Data,To b e published

by John Wiley & Sons, New York.

Mo en, D. H., Salazar, D. and Bro emeling, L. D. (1985), Structural Changes in Multivariate

Regression Mo dels. Communications in Statistics, Part A{Theory and Methods, 14,

1757-1768.

The Numerical Algorithms Group Limited (1993), The NAGFortran Library Manual, Mark 16.

Raftery, A. E. and Akman, V. E. (1986) Bayesian Analysis of A Poisson Pro cess with a Change

Point. Biometrika, 73, 85-89.

Shirayaev, A. N. (1961), The problem of the most rapid detection of a disturbance in a stationary

pro cess. Soviet Math. Dokl., no 2, pp.795-799.

Smith, A. F. M. and Co ok, D. G. (1990), Straight Lines with a Change- Point. Applied Statistics,

29, 180-189.

Smith, A. F. M. and Gelfand, A. E. (1992), Without Tears: A

Sampling-Resampling Persp ective. The American Statistician, 46, 84-88.

Statistical Sciences (1995), S-PLUS Guide to Statistical and Mathematical Analysis, Version 3.3,

Seattle : Stat Sci, a Division of MathSoft Inc.

West, M. and Harrison, P. J. (1986) Monitoring and Adaptation in Bayesian Forecasting Mo dels.

Journal of the American Statistical Association, 81, 741-750.

Zacks, S. (1983) A Survey of Classical and Bayesian Approaches to the Change-Point Problems :

Fixed Sample and Sequential Pro cedures of Testing and Estimation, Recent Advances in

Statistics, 245-269, Academic Press, New York.

Pradipta Sarkar is a PhD (Statistics) candidate at Iowa State University. He received his Masters

degree in Statistics with sp ecialization in Statistical QualityControl and Op erations Researchfrom

Indian Statistical Institute. William Meeker is Professor of Statistics and Distinguished Professor

of Lib eral Arts and Sciences at Iowa State University.HeisaFellow of the American Statistical

Asso ciation and past Editor of Technometrics. 15