1 Class Question: whats going on, and what to do? (2 minutes) - - PDF document

1
SMART_READER_LITE
LIVE PREVIEW

1 Class Question: whats going on, and what to do? (2 minutes) - - PDF document

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


slide-1
SLIDE 1

1

Dias 1

Monitoring and data filtering

  • I. Classical Methods

Advanced Herd Management Dan Børge Jensen, IPH

Dias 2

Outline

Framework and Introduction Shewart Control chart

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

Moving Average Control Chart EWMA Control Chart Monitoring autocorrelation

  • Model for autocorrelation
  • Use EWMA

Final exercises/Mandatory report

Dias 3

Framework

Functional limitations Herd constraints Optimization Biological variation Uncertainty Dynamics

slide-2
SLIDE 2

2

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

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

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-3
SLIDE 3

3

Dias 7

Exercise 7.1.1 (10 minutes)

Dias 8

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 θ'

Dias 9

Center line = target value

  • CL = θ’

Determination of the control limits

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

We test the null hypothesis H0: θ’ = θ

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

Usually distance parameter a = 2 or 3

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

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

slide-4
SLIDE 4

4

Dias 10

Target value: CL = θ’ = 25.60 kg ECM for first lactation cows Overall herd SD over 24 weeks: 490 kg milk

  • But our ECM is considered at a daily level!

N.Cows at beginning: 225 Control limits: UCLt = θ’ + a σ t LCLt = θ’ - a σ t Standard deviation calculated according to number of cows behind the average

Example 7.1: average daily milk yield – I’ll show you! (”Advanced topics”, page 45)

7 days per week

Dias 11

Example 1: milk yield

Shewart control chart, 2-sigma CL N.Cows at beginning: 225  σ 1 = 0.194  2*σ 1 = 0.39

Dias 12

Exercise 7.1.2 (15 minutes)

slide-5
SLIDE 5

5

Dias 13

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

Dias 14

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

Dias 15

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-6
SLIDE 6

6

Dias 16

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/ν

Dias 17

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?

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 (Montgomery, 2005): 1- One point outside the 3-Sigma limits 2- Two out of three consecutive points outside 2-Sigma limits 3- Four out of five consecutive points outside the 1-Sigma limit 4- Eight consecutive points on the same side of the expected level

slide-7
SLIDE 7

7

Dias 19

Illustration of pattern detection

From Example 1

! Rule 4

Dias 20

5 Minute Break

Dias 21

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-8
SLIDE 8

8

Dias 22

Example 2: daily gain of growing pigs

Shewart control chart, 2-sigma CL

Dias 23

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 of growing pigs

Dias 24

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-9
SLIDE 9

9

Dias 25

Moving Average Control Charts (2/2)

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

Dias 26

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

Dias 27

Exponentially Weighted Moving Average control charts (2/3)

First lactation, a=2, λ=0.68

slide-10
SLIDE 10

10

Dias 28

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

Dias 29

Exercise 7.1.3 (15 minutes)

Hints: k1 = k[1] zt = z[t] zt-1 = z[t-1]

Dias 30

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-11
SLIDE 11

11

Dias 31

A model for autocorrelation

Model

Predict next obs. Errors = Observed - predicted t

e e e ,..., ,

2 1

Forecast error Variance Forecast error Control chart!

Dias 32

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!”

Dias 33

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-12
SLIDE 12

12

Dias 34

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, e.g. EWMA We observed seasonality Next time: classical time-series monitoring of categorical data!

Dias 35

Break and exercises, until 17:00