Monitoring�and�data�filtering II.�Dynamic�Linear�Models Advanced�Herd�Management� Cécile�Cornou,�IPH Dias�1 Program�for�monitoring�and�data�filtering Tuesday�14 Lecture�for�part�I�:�use�of�control�charts Exercise�1�with�R Friday�24�(today) Lecture�for�part�II�:�Dynamic�Linear�Models�(DLMs) Exercise�2�with�R Introduction�to�mandatory�report Monday�27�(morning) Application�of�DLM� Example (Exercises�and�MR) Tuesday�28�(afternoon) Kalman�Filter�and�its�relation�to�other�techniques�(sum�up�of�the�methods�introduced) (Work�on�mandatory�report�) Dias�2 Introduction�to�the�DLM In�Chapter�7 Time�series�k 1 ,�...�,�k t Model�� k t =� θ +� e st� +� e ot Control�charts:�test�whether� θ =�θ’ Fundamental�assumption:� θ is�constant�over�time Here the�model�becomes��������������� k t =�f t ( θ t )�+� e st� +� e ot Where�the�underlying�mean,� f t ( θ t ),� is�allowed�to�vary�over�time Observation�equation: k t =�f t ( θ t )�+� v t E(v t )=0,���Var(v t )=�V t System�equation: θ t =�g t ( θ t�1 )�+�w t E(w t )=0,���Var(w t )=�W t Dias�3
Outline Introduction�to�the�DLM • Updating�equations:�Kalman�Filter • Interpretation�and�example • Converging�behaviour�of�a�constant�model • Incorporate�external�information:�Intervention • Discount�factor�as�an�aid�to�choose�W General�form�of�the�DLM Examples Concluding�remarks Dias�4 First�order�univariate�polynomial�DLM A�Simple�DLM k t and� θ t are�univariate�scalars,�and�f t and�g t are�identity�functions Time�series�K t =�(k 1 ,�...�,�k n )� Observation�equation:� k t =� θ t +� v t ,���� v t ~ N(0,�V t ) System�equation: θ t =�� θ t 1 +� w t ,���w t� ~ N(0,�W t ) Prior�belief�at�time�0�(no�obs�made)�for�underlying�mean�expressed� by�a�mean�m 0 and�a�variance�C 0� ( θ 0 |�D 0 )�~ N(m 0 ,�C 0 ) Conditional�distribution�given�all�information�at�time�t�is ( θ t |�D t )�~ N(m t ,�C t ) The�true�value�is� not�any�longer�assumed�to�be�constant . Dias�5 Basically,�we�wish�to�detect�”large” changes�in� θ Updating�of�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 )� R t =�C t 1 +�W t (c)�1 step�forecast:� (k t |�D t 1 )�~ N(f t ,�Q t )� f t =�m t 1 Q t =�R t +�V t (d)�Posterior�for� θ t :� ( θ t |�D t��� )�~ N(m t ,�C t )� m t =�m t 1 +�A t .e t C t =�A t .V t A t =�R t /�Q t e t =�k t – f t Dias�6
Interpretation�and�example Posterior�distribution�of� θ t given�D t� m t is�the�estimated�value�of� θ t based�on�all�available�data�(and�C t is�its�variance)� An� alternative�representation�of�m t is m t =�A t k t +�(1� A t )�m t 1 Very�similar�to�the�EWMA�of�Chapter�7 Here,�the�weight�factor�is�called� Adaptive�coefficient� and�depends�on�the� variance�components A t =�(�C t 1 +�W t� )�/�(C t 1 +�W t� +�V t� )� Large�observational�variance�V t� leads�to�small�adaptive�coefficient Observational�variance�reflects�’reliability’ of�an�observation:� little�weight�is�put�on�the�new�observation�if�this�one�is�not�very�reliable� Dias�7 Constant�model If�both�V t� and�W t�� are�constant�so�that�V t� =V�and�W t� =W�we�refer�to�the�DLM� as�a� constant�model Daily�Gain�example V t� =�V�=�50���and�W t� =W�=�5 Convergence�of�variances�(R t� ,�Q t� and�C t� )� and�of�the�adaptive�coefficient�are�property�of�a�constant�model m t =�A�k t +�(1� A)�m t 1 Here,�m t is�identical�to�the�EWMA,�with�weighing�factor�lambda=A Dias�8 Incorporate�external�information 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�9
Incorporate�external�information Intervention��. 1.�Known�effect We�want�the�model�to�adapt to�the�new�known conditions Ex: Productivity�in�broilers V=�10000�and�W=�100 Until�batch�10:�Ross�208;�from�batch�11:�Ross�308 � ~ N�(K � ,�W � )� where�K � =�70�and�W � =�100 Revised�prior:�(θ t’ |�D t’ 1 )�~ N(m t’ 1� +�K � ,�R t’ ),�������R t’ =�C t’ 1 +� W t’ +�W � m 10 =�m 10 +�70�=�1883�+�70�=�1953 And From�Table�8.3�p.89 R 11 =�C 10 +�W 11� +�W � =�1201+�100�+100�=�1401 Dias�10 Incorporate�external�information 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 We�want�to�avoid�’unwanted’ alarms Ex�3:�broiler�example�with�no�prior�information In�practice�we�use�a�larger�evolution�variance Dias�11 Incorporate�external�information Intervention��. 2.�Unknown�effect�(2/2) � » N�(0,�20000) Intervention�b Change�in�production�should�be�modeled�as�intervention If�any�prior�information�is�available:�use�it�! Dias�12
Incorporate�external�information 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: I t :�intervention�effect�that�we�want�to�measure λ t = 0 when�t�<� τ λ t = 1 when�t�>� τ Dias�13 Specification�of�variance�components� 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 R t =�C t 1 +�W���� → R t =�C t 1 /� δ For�a�process�in�control�we�use� the�value�of�delta�that�minimize� the�sum�of�the�squares�of�the� forecast�errors�e t Dias�14 Specification�of�variance�components� Daily�gain�example High�value� of�delta:�small�system�(evolution)�variance�W,�slow�adaptation�to�new� information Low�value� of�delta:�very�adaptive�model� NB:� lower�delta�can�be�used�for�modeling�intervention�! Dias�15
Recommend
More recommend