monitoring and data filtering ii dynamic linear models
play

Monitoring and data filtering II. Dynamic Linear Models Advanced - PDF document

Monitoring and data filtering II. Dynamic Linear Models Advanced Herd Management Ccile Cornou, IPH Dias 1 Outline Introduction to the DLM (West and Harrison, chapter 2) Updating equations: Kalman Filter Discount factor as an aid


  1. Monitoring and data filtering II. Dynamic Linear Models Advanced Herd Management Cécile Cornou, IPH Dias 1 Outline Introduction to the DLM (West and Harrison, chapter 2) • Updating equations: Kalman Filter • Discount factor as an aid to choose W • Incorporate external information: Intervention General form of the DLM Examples Concluding remarks Dias 2 1

  2. Introduction to the DLM A Simple DLM Time series Y t = (y 1 , ... , y n ) Observation equation: y t = µ t + v t , v t ∼ N(0, V t ) • Like before: v t = e s + e o The symbol µ t is the underlying true value at time t . • System equation: µ t = µ t -1 + w t , w t ∼ N(0, W t ) The true value is not any longer assumed to be constant . A fair assumption in animal production Basically, we wish to detect ”large” changes in µ t Dias 3 Introduction to the DLM A DLM with a trend Time series Y t = (y 1 , ... , y n ) Observation equation: y t = µ t + v t , v t ∼ N(0, V t ) System equation: µ t = µ t-1 + β t-1 + w 1t , w 1t ∼ N(0, W 1t ) β t = β t-1 + w 2t , w 2t ∼ N(0, W 2t ) Dias 4 2

  3. Introduction to the DLM Updating equations: Kalman Filter (a) Posterior for µ t-1 : ( µ t-1 | D t-1 ) ∼ N(m t-1 , C t-1 ) (b) Prior for µ t : ( µ t | D t-1 ) ∼ N(m t-1 , R t ) where R t = C t-1 + W t (c) 1-step forecast: (Y t | D t-1 ) ∼ N(f t , Q t ) where f t = m t-1 and Q t = R t + V t (d) Posterior for µ t : ( µ t | D t ) ∼ N(m t , C t ) with m t = m t-1 + A t .e t and C t = A t .V t where A t = R t / Q t and e t = Y t - f t ( µ 0 | D 0 ) ∼ N(m 0 , C 0 ) Initial Information: Dias 5 Introduction to the DLM Discount factor as an aid to choosing W t To run the model (assume with constant parameters) we need: m 0 , C 0 , V , W Discount factor can be used if W is unknown we know that W is a fixed proportion of C (West & Harrison 2.4.2) R t = C t-1 / δ R t = C t-1 + W → Typically 0.8 < δ < 1 Dias 6 3

  4. Introduction to the DLM Incorporate external information: intervention Types of external information: 1. 1. Known effect, experienced before (ex: change in breed for which we know the different performances) → We want the model to adapt to the new known conditions • 2. Unknown effect (ex: wave of heat, introduction of new animals in a group) → We want the model to adapt to the new unknown conditions • 3. Unknown effect we want to measure (ex: change of feed composition, new veterinary treatments) → We want to measure the effect of a volontary change Dias 7 Introduction to the DLM Intervention - 1. Known effect We want the model to adapt to the new known conditions Ex: Kurrit example from West and Harrison (2.3.2) Estimated mean after change: 286 (vs. 143) Expected change = 143 (286 – 143) Uncertainty: from 80 (pessimistic) to 200 (optimistic) σ = 30 ( = (200 – 80) / 4) : 4 st.dev (95% interval) Variance associated (Uncertainty) = 30 2 = 900 (ω 10 | D 9 , S 9 ) ∼ N (143, 900) Revised one-step ahead forecast: ( µ t | D t-1 ) ∼ N(m t-1 , R t ) ( µ 10 | D 9 , S 9 ) ∼ N (286, 920) m 9 = 286 and R 10 = C 9 + W 10 = 20 + 900 = 920 Dias 8 4

  5. Introduction to the DLM Intervention - 2. Unknown effect (1/2) We want the model to adapt to the new unknown conditions Ex 1: wave of heat We can not adjust because we do not know the exact effect Ex 2: introduction of new animals in a group Consider a method aimed to detect oestrus by monitoring animal behaviour Incoming animals may modify the behaviour of the group Here, intervention aimed to increase model adaptation to new behaviour so to avoid ”alarms” due to a known event Dias 9 Introduction to the DLM Intervention - 2. Unknown effect (2/2) In practice we can temporarily reduce the value of the discount factor so the evolution variance increases We put more weight on the new observations and ”forget about the past” See also eating rank Dias 10 5

  6. Introduction to the DLM Intervention - 3. Unknown effect We want to measure the effect of a volontary change Ex: A new feed is used and we want to estimate the associated change in daily gain We know that the new feed is used from time τ (0 < τ < n) y t = µ t + λ t I t + v t , v t ∼ N(0, V t ) µ t = µ t -1 + w t , w t ∼ N(0, W t ) With: λ t = 0 when t < τ I t : intervention effect that we want to measure λ t = 1 when t > τ Dias 11 The general DLM Generalisation from the 1.order pol. Model • Simple, most widely used DLM • Matrix notation allows to present the DLM in a general form and to treat more complex cases Three examples of application • Monitoring activity level • Monitoring activity types (MPKF) • Monitoring eating behaviour Dias 12 6

  7. Modeling of the variable Dynamic Linear Models (DLMs) combined with Kalman Filter (KF) Let Y t = ( y 1 , … , y n )’ be a vector of key figures observed at time t . Let θ t = ( θ 1 , … , θ m )’ be a vector of parameters describing the system at time t. General form of the DLM Observation Equation: Y t = F’ t θ t + ν t , ν t ~ N(0,V t ) System Equation: θ t = G t θ t-1 + ω t , ω t ~ N(0,W t ) DLM combined with Kalman Filter: estimate the underlying state vector θ t by its mean vector m t and its variance-covariance matrix C t . Elements from KF used in monitoring deviations: • f t : One step forecast mean • e t : One step forecast error (e t = Y t – f t ) • Q t : One step forecast variance Dias 13 Monitoring Deviations from the model V-mask (parameters d and Ψ) Applied on the cumulative sum (cusum) of the standardized errors u t = e t /√Q t t = ∑ = + C u u c t t t t − 1 t = 1 Tabular Cusum (parameters K and H) Create a cusum: accumulate u i , using a reference value (K) Alarm when cusum exceeds a decision interval (H) Dias 14 7

  8. Example 1. Monitoring activity level Context Development of Group housing in EU results of Council Directive 2001/88/EEC Difficulties identifying and accessing individual sow Idea Store data in a chip and transmit info to the farmer’s PC Sensor in the chip allows to monitor activity of the sow Assumption Body Activity of sows is expected to change around the onset of oestrus Objective Develop an automated oestrus detection method for group housed sows using sows’ acceleration measurements Method Use of Dynamic Linear Models to model the sows’ activity Use of control methods that detects model deviations at the onset of oestrus Dias 15 Oestrus Detection Oestrus Detection I (from day 4) • BPT (3 x / day) in the mating section Sow not inseminated Transfered to gestation section Oestrus Detection II (from day 21) • BPT (3 x / day) in the gestation section Golden Standard Detect whether activity pattern changes at onset of oestrus Weaning Transfer Acceleration measurements d7 d21 d0 BPT I d10 BPT II d30 Dias 16 8

  9. Data collection Place, Animals, Housing and Feeding • 1 production herd, March 2005 • 5 sows in group of 100 • 20 days Activity Measurements • Acceleration in 2 and 3 dimensions • Four measurements per second • Transfer PC via Blue Tooth Video Recordings • Four cameras used as web cam Oestrus Detection • Golden standard Detect whether activity pattern changes at onset of oestrus Dias 17 Definition of the DLM Use hourly averages of the length of the acceleration vector 2 + acc y 2 + acc z 2 ) Y t = acc = √ (acc x µ ( ) F ' = G t = I θ = t 1 , 0   t t   0     V t = unknow and constant W t = 0 (In normal condition: no change in activity) Model initialized by mean of Reference Analysis Model observations (Y t ) weighted by number of observations per hour Missing observation: e t =0 Dias 18 9

  10. Illustration Model Cusum V-mask Tabular Cusum Dias 19 Example 2. Monitoring sows’ activity types Daily Anoestrus Assumption Sow’s behaviour is affected by physiological state / illness Daily Oestrus • Oestrus: increase in activity • Lameness: walking Accelerometer: measured any time / during whole reproductive cycle Objective Develop a method that automatically classify sows’ activity types Model selected activity types using DLM Classify each activity type using a Multi Process Kalman Filter Dias 20 10

  11. Time series and activity types Activity types Extracts from time series of acceleration are associated to five activity types • Feeding (FE) 3 dimensions: X,Y, Z • Rooting (RO) 2 + acc y 2 + acc z 2 ) • Walking (WA) ACC = √ (acc x • Lying sternally (LS) • Lying Laterally (LL) Two data sets Activity filled whole data set / no overlapping Learning data set: 10 minutes of each activity type X Estimate the model parameters Y Test data set: 10 x 2 minutes of each activity type Z Implement the classification method ACC Dias 21 Acceleration data Dias 22 11

  12. Modeling each activity type Use averages per second of acceleration data µ t   π π 2 2 θ = s G t = I   F t = t t '  1 , sin , cos      t t T T           c         t   Model includes a periodic movement – cyclic components V and W: estimated using the EM algorithm Learning data set 20 DLMs 5 activities x 4 axes (X, Y, Z, ACC) Dias 23 Classification method Multi Process Kalman Filter of class I At time t : Each DLM is analysed using the updating equations of the Kalman Filter: • One step forecast mean f t • One step forecast variance Q t Posterior Probabilities are estimated for each DLM ∝ φ × p i i p 1 i ( ) ( ) ( ) t t t − Dias 24 12

Recommend


More recommend