Monitoringanddatafiltering II.DynamicLinearModels - - PDF document

monitoring and data filtering ii dynamic linear models
SMART_READER_LITE
LIVE PREVIEW

Monitoringanddatafiltering II.DynamicLinearModels - - PDF document

Monitoringanddatafiltering II.DynamicLinearModels AdvancedHerdManagement CcileCornou,IPH Dias1 Programformonitoringanddatafiltering Tuesday14


slide-1
SLIDE 1 Dias1

Monitoringanddatafiltering II.DynamicLinearModels

AdvancedHerdManagement CécileCornou,IPH

Dias2

Programformonitoringanddatafiltering

Tuesday14

LectureforpartI:useofcontrolcharts Exercise1withR

Friday24(today)

LectureforpartII:DynamicLinearModels(DLMs) Exercise2withR Introductiontomandatoryreport

Monday27(morning)

ApplicationofDLM Example (ExercisesandMR)

Tuesday28(afternoon)

KalmanFilteranditsrelationtoothertechniques(sumupofthemethodsintroduced) (Workonmandatoryreport)

Dias3

IntroductiontotheDLM

InChapter7 Timeseriesk1,...,kt Model kt =θ +est+eot Controlcharts:testwhetherθ =θ’ Fundamentalassumption:θ isconstantovertime Here themodelbecomeskt =ft (θt)+est+eot Wheretheunderlyingmean,ft (θt),isallowedtovaryovertime Observationequation: kt =ft (θt)+vt E(vt)=0,Var(vt)=Vt Systemequation: θt =gt (θt1)+wt E(wt)=0,Var(wt)=Wt

slide-2
SLIDE 2 Dias4

Outline

IntroductiontotheDLM

  • Updatingequations:KalmanFilter
  • Interpretationandexample
  • Convergingbehaviourofaconstantmodel
  • Incorporateexternalinformation:Intervention
  • DiscountfactorasanaidtochooseW

GeneralformoftheDLM Examples Concludingremarks

Dias5

FirstorderunivariatepolynomialDLM

ASimpleDLM kt andθt areunivariatescalars,andft andgt areidentityfunctions TimeseriesKt =(k1,...,kn) Observationequation: kt =θt +vt,vt ~ N(0,Vt) Systemequation: θt =θt 1 +wt,wt~ N(0,Wt) Priorbeliefattime0(noobsmade)forunderlyingmeanexpressed byameanm0 andavarianceC0 (θ0 |D0)~ N(m0,C0) Conditionaldistributiongivenallinformationattimetis (θt |Dt)~ N(mt,Ct) Thetruevalueisnotanylongerassumedtobeconstant. Basically,wewishtodetect”large” changesinθ

Dias6

UpdatingoftheDLM

Updatingequations:KalmanFilter (a)Posteriorforθt 1 : (θt 1 |Dt 1)~ N(mt 1,Ct 1) (b)Priorforθt : (θt |Dt 1)~ N(mt 1,Rt) Rt =Ct 1 +Wt (c)1 stepforecast: (kt |Dt 1)~ N(ft,Qt) ft =mt 1 Qt =Rt +Vt (d)Posteriorforθt : (θt |Dt)~ N(mt,Ct) mt =mt 1 +At.et Ct =At.Vt At =Rt /Qt et =kt – ft

slide-3
SLIDE 3 Dias7

Interpretationandexample

Posteriordistributionofθt givenDt mt istheestimatedvalueofθt basedonallavailabledata(andCt isitsvariance) Analternativerepresentationofmt is mt =At kt+(1 At)mt 1 VerysimilartotheEWMAofChapter7 Here,theweightfactoriscalledAdaptivecoefficientanddependsonthe variancecomponents At =(Ct 1 +Wt)/(Ct 1 +Wt+Vt) LargeobservationalvarianceVtleadstosmalladaptivecoefficient Observationalvariancereflects’reliability’ ofanobservation: littleweightisputonthenewobservationifthisoneisnotveryreliable

Dias8

Constantmodel

IfbothVt andWtareconstantsothatVt=VandWt=WwerefertotheDLM asaconstantmodel DailyGainexample Vt=V=50andWt=W=5 Convergenceofvariances(Rt,Qt andCt) andoftheadaptivecoefficientarepropertyofaconstantmodel mt =Akt+(1 A)mt 1 Here,mt isidenticaltotheEWMA,withweighingfactorlambda=A

Dias9

Incorporateexternalinformation

Incorporateexternalinformation:intervention Typesofexternalinformation: 1. 1.Knowneffect,experiencedbefore(ex:changeinbreedfor whichweknowthedifferentperformances) → Wewantthemodeltoadapt tothenewknown conditions

  • 2.Unknowneffect(ex:waveofheat,introductionofnewanimals

inagroup) → Wewantthemodeltoadapt tothenewunknown conditions

  • 3.Unknowneffectwewanttomeasure(ex:changeoffeed

composition,newveterinarytreatments) → Wewanttomeasuretheeffect ofavolontarychange

slide-4
SLIDE 4 Dias10
  • Intervention. 1.Knowneffect

Wewantthemodeltoadapt tothenewknown conditions Ex: Productivityinbroilers V=10000andW=100 Untilbatch10:Ross208;frombatch11:Ross308

~ N(K ,W )

whereK =70andW =100 Revisedprior:(θt’ |Dt’ 1)~ N(mt’ 1+K ,Rt’),Rt’ =Ct’ 1 + Wt’ +W m10 =m10 +70=1883+70=1953 And R11 =C10 +W11 +W =1201+100+100=1401

Incorporateexternalinformation

FromTable8.3p.89

Dias11

Incorporateexternalinformation

  • Intervention. 2.Unknowneffect(1/2)

Wewantthemodeltoadapt tothenewunknown conditions Ex1:waveofheat Wecannotadjustbecausewedonotknowtheexacteffect Ex2:introductionofnewanimalsinagroup Consideramethodaimedtodetectoestrusbymonitoringanimalbehaviour Incominganimalsmaymodifythebehaviourofthegroup Wewanttoavoid’unwanted’ alarms Ex3:broilerexamplewithnopriorinformation Inpracticeweusealargerevolutionvariance

Dias12

Incorporateexternalinformation

  • Intervention. 2.Unknowneffect(2/2)

» N(0,20000) Changeinproductionshouldbemodeledasintervention Ifanypriorinformationisavailable:useit!

Interventionb

slide-5
SLIDE 5 Dias13

Incorporateexternalinformation

  • Intervention. 3.Unknowneffect

Wewanttomeasuretheeffect ofavolontarychange Ex:Anewfeedisusedandwewanttoestimatetheassociatedchangein dailygain Weknowthatthenewfeedisusedfromtimeτ (0<τ <n) yt =µt +λt It +vt, vt ~ N(0,Vt) µt =µt 1 +wt, wt ~ N(0,Wt) With: It :interventioneffectthatwewanttomeasure λt = 0 whent<τ λt = 1 whent>τ

Dias14

Specificationofvariancecomponents

Discountfactor(δ δ δ δ) asanaidtochoosingWt Torunthemodel(assumewithconstantparameters)weneed: m0,C0,V, W Discountfactorδ δ δ δ canbeusedifWisunknown weknowthatWisafixedproportionofC Rt =Ct 1 +W→ Rt =Ct 1 /δ Foraprocessincontrolweuse thevalueofdeltathatminimize thesumofthesquaresofthe forecasterrorset

Dias15

Specificationofvariancecomponents

Dailygainexample Highvalueofdelta:smallsystem(evolution)varianceW,slowadaptationtonew information Lowvalueofdelta:veryadaptivemodel NB:lowerdeltacanbeusedformodelingintervention!

slide-6
SLIDE 6 Dias16

ThegeneralDLM

Generalisationfromthe1.orderpol.Model

  • Simple,mostwidelyusedDLM
  • MatrixnotationallowstopresenttheDLMinageneralformandtotreat

morecomplexcases Updatingequations,variancespecification,referenceanalysis Forecastingandsmoothing Modelingpatterns growth seasons dailypattern Monitoringdeviations

Dias17

ThegeneralDynamicLinearModel

Definition InageneralDLM,observationsmaybemultivariate(i.e.vectors) LetYt =(y1,… ,yn)’ beavectorofkeyfiguresobservedattimet. Letθt =(θ1,… ,θm)’ beavectorofparametersdescribingthesystemattimet. GeneralformoftheDLM ObservationEquation: Yt =F’t θt+νt ,νt ~N(0,Vt) SystemEquation: θt =Gt θt 1 +ωt,ωt ~N(0,Wt) Ft isthedesignmatrix,andGt isthesystemmatrix DLMcombinedwithKalmanFilter:estimatetheunderlyingstatevectorθtbyits meanvectormt anditsvariance covariancematrixCt.

Dias18

ThegeneralDynamicLinearModel

Updatingequations KalmanFilterforthegeneralDLMisverysimilarasforthesimpleDLM Elementsarevectorsandmatrices Variancespecification Inthecaseofunknownsystemvariance,discountfactorscanbeused Specialalgorithmincaseofunknownobservationalvariance Referenceanalysis IfnopriorinformationisavailableforD0 ={m0,C0} Useasfewaspossibleobservations(n)forinitializationofthemodel: n=p (ifVisknown)orn=p+1 (ifVisunknown) Wherep isthesizeoftheparametervectorθ Cannotdetectchangesoverthefirstnobservations, thereforeWt=0fort=1,...,n.

slide-7
SLIDE 7 Dias19

ThegeneralDynamicLinearModel

Forecasting Possibletomakeforecastsforthe futureproductiongivenall previousobservations Rathervaguesforecasts Smoothing Retrospectiveanalysis Here:cleareffectofthenewstrain Smoothedestimatesmorestables thanfilteredmeans

Dias20

Alineargrowthmodel Introduceatrendcomponentallowingtheobservationstofollowagrowthpattern kt =θt+νt , νt ~N(0,Vt)

(1)

θ1t =θ1,t 1 +θ2,t 1 +ω1t, ω1t ~N(0,W1t)

(2)

θ2t =θ2,t 1 +ω2t, ω2t ~N(0,W2t)

(3)

Theunderlyingmeanisthesumofthepreviousmean,anincrementalgrowthand arandomterm(2). Theincrementalgrowthisexpectedtofluctuateovertime(3).

ModelingpatternswithaDLM

Dias21

Alineargrowthmodel Parametervector Designmatrix Observationequation kt =F’ t θt+νt , νt ~N(0,Vt) Systemmatrix Covariancematrix Systemequation θt =Gt θt.1 +ωt, ωt ~N(0,Wt)

ModelingpatternswithaDLM         = 0 1

t

F         =

t t t 2 1

θ θ θ         = 1 1 1

t

G         =

t t t

W W W

2 1
slide-8
SLIDE 8 Dias22

Alineargrowthmodel:exampleofdailyfeedintake Specificationofthepriors Observationalvariance: S0 =90000 (i.e.300gstandarddeviation) Evolutionvariance: delta=0.98

ModelingpatternswithaDLM         = 100 10000 C         = 25 600 m

Dias23

Cyclicpatterns:modelingbyseasonalparameters Parametervector Designmatrix

θ1 isthegenerallevel Ft isaccordingtothegivenseason θ2 ... θ5 describetheeffectofeachquarter(season) Observationequation kt =F’ t θt+νt , νt ~N(0,Vt) Gt isanidentitymatrix(5x5) Wt =I5 xwt,whereI5 istheidentitymatrix(5x5) Systemequation θt =Gt θt.1 +ωt, ωt ~N(0,Wt)

ModelingpatternswithaDLM                 =

5 4 3 2 1

θ θ θ θ θ θt

( ) ( ) ( ) ( )

       = ' 1 1 , ' 1 1 , ' 1 1 , ' 1 1

t

F

Dias24

Cyclicpatterns:dailygainseasonalvariation Specificationsofthemodel Initialisation Vt =20.22 =408.04 m0 =(762, 11, 49, 22,83)’ Wt =64xI5 C0 =100xI5

ModelingpatternswithaDLM

slide-9
SLIDE 9 Dias25

Underlyingunobservablestatevectorθt isestimatedinthebestpossibleway Characterizeindividual/groupsofanimals(DailyGainexample) Usemodelforforecastanddecisionsupport Makeretrospectiveanalysis:smoothing(Changeofbroilers) Detectout of controlsituation:monitoringdeviationsfromthemodel

ApplicationsofDLMsinAnimalHusbandry

Dias26

ElementsfromKFusedinmonitoringdeviations:

  • ft :Onestepforecastmean
  • et :Onestepforecasterror(et =Yt – ft)
  • Qt :Onestepforecastvariance

Monitoringmethods:

  • Shewartcontrolchart
  • V mask
  • Tabularcusum
  • MultiProcessKalmanFilter(Monday’slecture)

MonitoringDeviationsfromthemodel

Dias27

MonitoringDeviationsfromthemodel

V.mask(parametersdandΨ) Appliedonthecumulativesum(cusum)ofthestandardizederrors ut =et/√Qt

1 1 − =

+ = = ∑

t t t t t t

c u u C

TabularCusum(parametersKandH) Createacusum:accumulateui,usingareferencevalue(K) Alarmwhencusumexceedsadecisioninterval(H)

slide-10
SLIDE 10 Dias28

Concludingremarks

DifferentsModelswerepresented

  • Simplelocallevelmodel
  • DLMinitsgeneralform
  • Examples

Thegeneralformofthemodelallowstoincludecyclicpatterns(asfor eatingactivity,dailygain) Notnecessarilyasgraphs– automaticalarms(asV mask,MPKF) Claudiawillpresentanexamplebasedonvisitstotheboarwith an applicationofaMPKFoftypeII Manyhandlestoadjust– dangerous Alwayscombinewithyourknowledgeonanimalproduction