MARKOV SWITCHING MODELS FOR HIGH-FREQUENCY TIME SERIES FROM AUTOMATIC MONITORING OF ANIMALS Luigi Spezia Cecilia Pinto Biomathematics & Statistics Scotland School of Biological Sciences Aberdeen, UK University of Aberdeen Aberdeen, UK Spezia and Pinto – Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Overview • Flapper skate’s depth profile • High-frequency time series Long memory process Non-linear time series • Markov switching autoregressive models • Results • Current research Spezia and Pinto – Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Dipturus intermedia Flapper skate’s depth profile Cecilia Pinto’s PhD project: Estimating the probability of recolonization of endangered marine species integrating demographic and movement parameters. School of Biological Sciences, University of Aberdeen Spezia and Pinto – Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Flapper skate’s depth profile Spezia and Pinto – Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Flapper skates’ depth profiles Spezia and Pinto – Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Flapper skates’ depth profiles pressure levels every two minutes → depth (metres) Spezia and Pinto – Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Flapper skates’ depth profiles Skate 7967 male juvenile 12 months T=254116 Skate 7972 male adult 6 months T=127360 Skate 7968 female adult 6 months T=107891 Skate 8828 male 12 days T=11404 Spezia and Pinto – adult Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Flapper skates’ depth profiles Spezia and Pinto – Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Flapper skates’ depth profiles -150 -100 -50 0 -250 -200 -200 -150 -100 depth Skate 7968 Skate 8828 -150 -100 -50 0 -50 0 -50 0 0.000 0.010 0.020 0.030 depth probability -250 Spezia and Pinto – 0.000 0.010 0.020 0.030 probability -200 0.000 0.010 0.020 0.030 -250 probability Skate 7972 0.000 0.010 0.020 0.030 probability Skate 7967 -250 -200 -150 -100 Markov switching models for high-frequency time series depth from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 depth Flapper skates’ depth profiles 30 40 0.8 50 0 10 20 30 time lag Skate 7968 Skate 8828 50 40 50 0.4 0.8 time lag 40 0.0 0.4 0.0 0 10 Spezia and Pinto – 20 autocorrelation 10 0.8 0 autocorrelation 0.4 0.0 0.4 autocorrelation 0.8 Skate 7972 0.0 autocorrelation Skate 7967 20 30 40 50 0 10 20 Markov switching models for high-frequency time series timeautomatic lag from monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 time lag 30 High-frequency time series High-frequency time series exhibit sample ACF that persists for a long time [i.e., long memory processes] Modelling strategy 1: fractional differentiation (d) et ∼ N(0; σe2) (1-B)dyt = et ∞ (1-B)dyt Γ(k-d) = ∑ k=0 Γ(k+1) Γ(-d) -0.5<d<0.5 Spezia and Pinto – Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 High-frequency time series High-frequency time series exhibit sample ACF that persists for a long time [i.e., long memory processes] Modelling strategy 1: fractional differentiation ARFIMA(p,d,q) φ(B)(1-B)dyt = θ(B)et -0.5<d<0.5 φ(B) = 1-φ1B-...-φpBp; Bjyt=yt-j; j=1,..,p θ(B) = 1+θ1B+...+θqBq Spezia and Pinto – Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 High-frequency time series Modelling strategy 2: non-linear time series with structural breaks produce realizations that appear to have long memory “structural change” and “long memory” are effectively different labels for the same phenomenon structural changes can be modelled as stochastic regime switching e.g., Markov switching autoregressive models (non-Normal and non-linear models) Spezia and Pinto – Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Markov switching autoregressive models ( {yt}; {xt} ) {xt}: m-state hidden Markov chain SX={1,2,…,m} P(xt=i| xt-1=j) = γj,i 0< γj,i <1 ∀ i,j ∈ SX Γ = [γj,i ] (m×m) {yt}: conditional autoregressive process of order p yt = µ(i) + φ1(i) yt-1 + φ2(i)yt-2 + … + φp(i)yt-p + et Spezia and Pinto – et ∼ N(0; λ(i)-1) Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Non-homogeneous Markov switching autoregressive models Γt = [γtj,i ](m×m) γtj,i = P(xt=i| xt-1=j) 0< γj,i <1 ∀ i,j ∈ SX; ∀ t=2,…,T Z=(zp+1,…,zt,…, zT)’ zt=(zt,1,…, zt,n)’ α=[αj,i] [αj,i]=(αj,i,0,αj,i,1,…,αj,i,n) ∀ t=p+1,…,T logit( γtj,i ) = ln( γtj,i / γtj,j ) exp(ztαj,i) γSpezia j,i = and+Pinto – Markov 1 ) ∑ exp(z tαj,iswitching t i≠j ∀ i,j ∈ SX ∀ i,j ∈ SX 1 γ j,i = models for high-frequency timeαseries 1 + ∑ exp(z t j,i) t from automatic monitoring of animals i≠j DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Non-homogeneous Markov switching autoregressive models γtj,i = P(xt=i| xt-1=j) 0< γj,i <1 Γt = [γtj,i ](m×m) ∀ i,j ∈ SX; ∀ t=2,…,T At each time t: Categorical covariate Dt defined on d categories Gh = [ghj,i ](m×m) d Γt = ∑ Gh × I(Dt=h) ghj,i = P(xt=i| xt-1=j, Dt=h) h=1,…,d ∀ i,j ∈ SX; ∀ t=2,…,T h=1 Spezia and Pinto – Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Prior specification m p(Gh) = ∏ p(Ghj•) Ghj•= (ghj,1,ghj,2,…,ghj,m) j=1 Ghj• ~ D (•) for all j=1,…,m and h=1,...,d µ(i) ∼ N (•; •), for all i=1,…,m λ(i) ∼ G (•; •), for all i=1,…,m p m p(φ) = ∏ ∏ p(φj(i)), j=1 i=1 φj(i) ∼ N (•; •), Spezia and Pinto – for all i=1,…,m and j=1,…,p Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Gibbs sampling • µ(i) ← Normal for all i=1,…,m • λ(i) ← Gamma for all i=1,…,m • φj(i) ← Normal for all i=1,…,m and j=1,…,p • Ghj• ← Dirichlet for all j=1,…,m and h=1,...,d • sample permutation • (x1,...xT) ← forward filtering – backward sampling algorithm Spezia and Pinto – Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Label switching Iteration k = 1,...,L: Burn-in Iteration k = L+1,...,L+M: Posterior mode {µ*, λ*, φ*, G*}=arg max p(µ(k), λ(k), φ(k), G(k)) Iteration k=L+M+1,…, L+M+N: Permutations η*=arg min ||ηj(µ(k), λ(k), φ(k), G(k)) - (µ*, λ*, φ*, G*)|| ηj∈H & (µ(k), λ(k), φ(k), G(k)) = η*(µ(k), λ(k), φ(k), G(k)) Spezia and Pinto – Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Bayesian inference 3 steps: model choice variable selection parameter estimation and hidden chain reconstruction m = 1,…,4; p = 0,…,6; 3 covariates ⇒ 224 competing models Spezia and Pinto – Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Bayesian inference 3 steps: model choice variable selection parameter estimation and hidden chain reconstruction m = 1,…,4; p = 0,…,6; 3 covariates ⇒ 224 competing models Γt = [γtj,i ](m×m) γtj,i = P(xt=i|1 xt-1=j) 3 covariates: Solar cycle S Lunar cycle L 2 Lunar phase L4 s ∈ {0; 1} l2 ∈ {0; 1} l4 ∈ {1; 2; 3; 4} Indicator Dt d ∈ {1,2,4,8,16} Spezia and Pinto – Markov switching models for high-frequency time series t = h × I(D =h) ghj,i =monitoring P(x =i| x =j, D =h) Γ G Gh = [ghj,i ](m×m)from automatic t t of t-1 animals t DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Bayesian inference 3 steps: model choice variable selection parameter estimation and hidden chain reconstruction m = 1,…,4; p = 0,…,6; 3 covariates ⇒ 224 competing models Pragmatic alternative: [1] best(m;p), with d=1 [2] best combination of covariates ⇒ 35 competing models Spezia and Pinto – Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Bayesian inference Model choice and variable selection: Bayes factors ln(marginal likelihood) computed by the method of Chib (2001) Skate 7967 (ma; ju;12 months) m=2;p=4; L4 Skate 7972 (ma; ad; 6 months) m=2;p=3; L4 Skate 7968 (fe; ad; 6 months) m=2;p=3; L4;L2 Skate 8828 (ma; ad; 12 days) m=2;p=4; L4;L2;S Spezia and Pinto – Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Results Spezia and Pinto – (black dots)forand fitted (red time line) series Markovactual switching models high-frequency from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Results Spezia and Pinto – of the Markov switchingACF models for residuals high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Results State 1 (68,337 visits, 54%) = low variability (resting, horizontal movement, slow ascending and descending) Spezia and Pinto – Markov switching models for high-frequency time series State 2 (59,019 visits, from 46%)automatic = high variability ascending and descending) monitoring(fast of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Results Spezia and Pinto – Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Extending the model ( {yt}; {xt} ) State-dependent autoregressive orders: p = (p1, p2,…, pm) {xt}: m-state hidden Markov chain {yt}: conditional autoregressive process of order px t yt = µ(i) + φ1(i) yt-1 + φ2(i)yt-2 + … + φp (i)yt-p + et i Spezia and Pinto – i et ∼ N(0; λ(i)-1) Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Extending the model Markov switching ARCH noises: ut ∼ N(0; 1) et = ht ut ht = η(i) + 2 α1(i)et-1 + 2 α2(i)et-2 +…+ 2 αq(i)et-q Local stationarity of each state-dependent ARCH process: η(i) > 0; α1(i),…,αq(i)≥0; q ∑ αj(i)≤1 j=1 Spezia and Pinto – Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Extending the model Markov switching ARCH noises: ut ∼ N(0; 1) et = ht ut ht = η(i) + 2 α1(i)et-1 + 2 α2(i)et-2 +…+ 2 αqi(i)et-qi with state-dependent autoregressive orders: q = (q1, q2,…, qm) [auxiliary variable MCMC method] Spezia and Pinto – Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Extending the model Model and variable selection: Bayesian Information Criterion (BIC) Deviance Information Criterion (DIC) on a single subspace. Spezia and Pinto – Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Extending the model Model and variable selection: Bayesian Information Criterion (BIC) Deviance Information Criterion (DIC) on a single subspace. Algorithm: From Gibbs sampling to … Spezia and Pinto – Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014 Summary Biologgers applied to animals produce long memory processes due to a non-linear dynamics. Flapper skate’s depth profile can be modelled effciently by Markov switching autoregressive models with a non-Homogeneous Markov chain, where the time-varying transition probabilities depend on the dynamics of categorical covariates. Depth values can be classiefied into two regimes representing two different classes of skates’ behaviours. Spezia and Pinto – Markov switching models for high-frequency time series from automatic monitoring of animals DYNSTOCH 2014 – University of Warwick, 10th-12th September,2014