Monitoring and data filtering I. Classical Methods Advanced - - PowerPoint PPT Presentation

monitoring and data filtering i classical methods
SMART_READER_LITE
LIVE PREVIEW

Monitoring and data filtering I. Classical Methods Advanced - - PowerPoint PPT Presentation

Monitoring and data filtering I. Classical Methods Advanced Quantitative Methods in Herd Management Dan Brge Jensen, IPH Dias 1 Outline Framework and Introduction Shewart Control chart Basic principles Examples: milk yield and


slide-1
SLIDE 1

Dias 1

Monitoring and data filtering

  • I. Classical Methods

Advanced Quantitative Methods in Herd Management Dan Børge Jensen, IPH

slide-2
SLIDE 2

Dias 2

Outline

Framework and Introduction Shewart Control chart

  • Basic principles
  • Examples: milk yield and daily gain
  • Alarms
  • --- Break

Moving Average Control Chart EWMA Control Chart Monitoring autocorrelation

  • Model for autocorrelation
  • Use EWMA
  • --- Break & exercises
slide-3
SLIDE 3

Dias 3

Framework

slide-4
SLIDE 4

Dias 4

Results from 2 herds

780 790 800 810 820 830 840 850 860 870 880 2 4 6 8 10 12 Quarter Gain (g) Expected Herd A Herd B

Is the conclusion the same in both herds? Class Question: what’s going on, and what to do? (2 minutes)

Average daily weight gain, Pig herds

slide-5
SLIDE 5

Dias 5

Introduction (2/3)

So far Control: compare key figures (k) with expected results κ = θ + es + eo Deviation: see if significant from a statistical point of view If deviation: adjustement plan or/and implementation Problem: we assume that results can be evaluated without considering results from the previous period

slide-6
SLIDE 6

Dias 6

Key figures regarded as a time series of observations, treated as a whole How to model the results? κt = θ + est + eot κt : observed value of the key figure θ : true underlying value est : sample error (biological variation) eot : observation error (observation method)

Introduction (3/3)

= θ + νt

slide-7
SLIDE 7

Dias 7

The Shewart Control Chart: basic principles (1/2)

Upper Control Limit (UCL) Center Line Lower Control Limit (LCL)

Sample number, or time Sample quality characteristic Here: all the points fall inside the CL. Process in control

κ1, κ2, ... κn θ'

slide-8
SLIDE 8

Dias 8

Center line = target value

  • CL = θ’

Determination of the control limits

  • UCLt = θ’ + a σt
  • LCLt = θ’ - a σt

Usually distance parameter a = 2 or 3

  • If a = 2 : ”2-sigma” control limit

We test the hypothesis H0: θ’ = θ

  • a = 2 corresponds to approx. 5% precision level

The Shewart Control Chart: basic principles (2/2)

slide-9
SLIDE 9

Dias 9

Target value: CL = θ’ = 25.60 kg for first lactation Overall herd SD over 24 weeks: 490 kg milk N.Cows at beginning: 275 Control limits: UCLt = θ’ + a σ t LCLt = θ’ - a σ t Standard deviation calculated according to number of cows behind the average

Example 7.1: milk yield – I’ll show you!

slide-10
SLIDE 10

Dias 10

Example 1: milk yield

Shewart control chart, 2-sigma CL

slide-11
SLIDE 11

Dias 11

Example 1: milk yield

Shewart control chart, 2-sigma CL

slide-12
SLIDE 12

Dias 12

Control and warning limits (1/3)

UCL and LCL determined by a (e.g. a=2 <-> p=0.05) Choice of significance level / distance parameter: tradeoff between number of False Positives and False Negatives! Possible Scenarios:

Alarm No Alarm System HAS changed System has NOT changed Alarm No Alarm System HAS changed True Positive System has NOT changed True Negative Alarm No Alarm System HAS changed True Positive False Negative System has NOT changed False Positive True Negative Type I Error Type II Error

Low a High a

slide-13
SLIDE 13

Dias 13

Class Questions (5 minutes):

If you have a HIGH observation frequency (e.g. every hour or every second) which sort of error should you MINIMIZE? And why? If you have a very LOW observation frequency (e.g. every quarter or every year) which sort of error should you MINIMIZE? And why?

Alarm No Alarm System HAS changed System has NOT changed Alarm No Alarm System HAS changed True Positive System has NOT changed True Negative Alarm No Alarm System HAS changed True Positive False Negative System has NOT changed False Positive True Negative

slide-14
SLIDE 14

Dias 14

Control and warning limits (2/3)

Sampling Frequency The more frequent κ is calculated, the higher a should be Average Run Length ARL=1/q ARL: expected number of obs between 2 out-of-control alarms. q: the probability of an arbitrary point exceeding the control limits Average Time to Signal ATS=ARL/ν v: sampling frequency, defined as observations per time unit

slide-15
SLIDE 15

Dias 15

Control and warning limits (2.1/3)

Example: Process in control q = p a = 2 p = 0.05 ARL0 = 1/q = 1/p = 1/0.05 = 20 Obs/Alarm Quaterly obs ATS0 = ARL0/ν Two obs per second ATS0 = ARL0/ν

slide-16
SLIDE 16

Dias 16

Control and warning limits (3/3)

Alternative: use of warning limits

What is the cost of a False Negative?

What is the cost of a False Positive?

slide-17
SLIDE 17

Dias 17

5 Minute Break

slide-18
SLIDE 18

Dias 18

Pattern detection

What do we detect?

  • Level change, outliers, increase in variation (control limits)
  • Trend (increase, decrease), cyclic pattern, autocorrelation

Rules of thumb: 1- One point outside the control limits 2- Two out of three consecutive points outside the warning limits 3- Four out of five consecutive points at a distance of more than 1σ from the expected level 4- Eight consecutive points on the same side of the expected level

slide-19
SLIDE 19

Dias 19

Illustration of pattern detection

From Example 1

! Rule 4

slide-20
SLIDE 20

Dias 20

Target value: θ’ = CL = 775 g Precision estimates (σ) Random sampling: 20.2 g Control limits: UCL = 775 + aσ, a = 2 LCL = 775 − aσ, a = 2

Example 2: daily gain of growing pigs

slide-21
SLIDE 21

Dias 21

Example 2: daily gain

Shewart control chart, 2-sigma CL

slide-22
SLIDE 22

Dias 22

Process out of control 8 obs out of 16 Seasonnal variation is to be expected in slaughter pig production If there is an expected pattern: use of other monitoring techniques to take it into account e.g. other classical techniques (presented next) or state space models (chapter 8) If no expected pattern: further analysis / intervention

Example 2: daily gain

slide-23
SLIDE 23

Dias 23

Moving Average Control Charts (1/2)

The moving average is the average of the most recent n observations

, ) (

1 1

n n M

t t n t t

κ κ κ + + + =

− + −

K

n t ≥

with variance

n

2

σ

E.g. n = 4

M4(n) = 763 M5(n) = 756 M6(n) = 744 M7(n) = 750

slide-24
SLIDE 24

Dias 24

Moving Average Control Charts (2/2)

What can we conclude? Using n=4, a=3

slide-25
SLIDE 25

Dias 25

Exponentially Weighted Moving Average control charts (1/3)

The EWMA is a weighted average of all observations until now

1

) 1 (

− + =

t t t

z z λ λκ

with variance, for large t,

      − ≈ λ λ σ σ 2

2 2

t

z

The EWMA control chart is built the same way as the Shewart control chart The most recent observations are always given highest weights

slide-26
SLIDE 26

Dias 26

Exponentially Weighted Moving Average control charts (2/3)

First lactation, a=2, λ=0.68

slide-27
SLIDE 27

Dias 27

Exponentially Weighted Moving Average control charts (3/3)

Choice of lambda:

Small values favor detection of small shifts of θ ! Can take time to detect : small lambda = low weight to new obs

Shewart control chart is suggested for detecting large shifts Combination of EWMA + Shewart for both small and large shifts

slide-28
SLIDE 28

Dias 28

Check for autocorrelation

  • Milk Yield example

Present versus previous observation Positive autocorrelation Sample autocorrelation First lactation

First lactation milk yields First lactation milk yields

slide-29
SLIDE 29

Dias 29

A model for autocorrelation

Model

Predict next obs. Errors = Observed - predicted

t

e e e ,..., ,

2 1

Forecast error Variance Forecast error Control chart!

slide-30
SLIDE 30

Dias 30

Control chart – correlated data

The point of a model:

IF “everything is fine” THEN “things progress as expected” Therefore: IF “things progress UN-expectedly” THEN “Something is wrong!”

slide-31
SLIDE 31

Dias 31

EWMA for autocorrelated data

Use EWMA as one-step-ahead predictor for autocorrelated data t t

z ≈

+1

ˆ κ

1 −

− =

t t t

z e κ

Choose λ by minimizing the sum of the squared forecast errors

= t i i

e

1 2 The variance of the forecast errors is calculated as

t e

t i i e

∑ =

=

1 2 2

σ

slide-32
SLIDE 32

Dias 32

Concluding remarks

We have shifted focus from observing a key figure κ at time t to an entire time series (κ1, κ 2,... κ t) We tried to detect changes in process (alarms)

  • Raw data (Shewart control chart)
  • Averaged data (Moving / Exponentially Moving Average)

We observed autocorrelation: model, EWMA We observed seasonality Next time: other, slightly more advanced methods for modelling!

slide-33
SLIDE 33

Dias 33

Break and exercises, until 5 PM

Notice: Exercises at Grønnegårdsvej 7 Room A1-09.01