Dias 1
Monitoring and data filtering
- I. Classical Methods
Advanced Quantitative Methods in Herd Management Dan Børge Jensen, IPH
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
Dias 1
Advanced Quantitative Methods in Herd Management Dan Børge Jensen, IPH
Dias 2
Outline
Framework and Introduction Shewart Control chart
Moving Average Control Chart EWMA Control Chart Monitoring autocorrelation
Dias 3
Framework
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
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
Dias 8
Center line = target value
Determination of the control limits
Usually distance parameter a = 2 or 3
We test the hypothesis H0: θ’ = θ
The Shewart Control Chart: basic principles (2/2)
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!
Dias 10
Example 1: milk yield
Shewart control chart, 2-sigma CL
Dias 11
Example 1: milk yield
Shewart control chart, 2-sigma CL
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
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
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
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/ν
Dias 16
Control and warning limits (3/3)
What is the cost of a False Negative?
What is the cost of a False Positive?
Dias 17
5 Minute Break
Dias 18
Pattern detection
What do we detect?
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
Dias 19
Illustration of pattern detection
From Example 1
! Rule 4
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
Dias 21
Example 2: daily gain
Shewart control chart, 2-sigma CL
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
Dias 23
Moving Average Control Charts (1/2)
The moving average is the average of the most recent n observations
1 1
t t n t t
− + −
with variance
n
2
σ
M4(n) = 763 M5(n) = 756 M6(n) = 744 M7(n) = 750
Dias 24
Moving Average Control Charts (2/2)
What can we conclude? Using n=4, a=3
Dias 25
Exponentially Weighted Moving Average control charts (1/3)
The EWMA is a weighted average of all observations until now
1
−
t t t
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 26
Exponentially Weighted Moving Average control charts (2/3)
First lactation, a=2, λ=0.68
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
Dias 28
Check for autocorrelation
Present versus previous observation Positive autocorrelation Sample autocorrelation First lactation
First lactation milk yields First lactation milk yields
Dias 29
A model for autocorrelation
Predict next obs. Errors = Observed - predicted
t
2 1
Dias 30
Control chart – correlated data
IF “everything is fine” THEN “things progress as expected” Therefore: IF “things progress UN-expectedly” THEN “Something is wrong!”
Dias 31
EWMA for autocorrelated data
Use EWMA as one-step-ahead predictor for autocorrelated data t t
+1
1 −
t t t
Choose λ by minimizing the sum of the squared forecast errors
= t i i
1 2 The variance of the forecast errors is calculated as
t i i e
1 2 2
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)
We observed autocorrelation: model, EWMA We observed seasonality Next time: other, slightly more advanced methods for modelling!
Dias 33
Break and exercises, until 5 PM