Description of state-space model structure, fitting, performance and parameter estimates Model structure and fitting The first component of the state-space model is the process equation, which in our case describes how the movement process evolves over time. The process equation used here is the firstdifference correlated random walk model with switch between behavioral states (DCRWS) developed by [1]. The equation describing the dynamics of the DCRWS movement process was specified as: (1) where d t is the difference between positions x t and x t-1 (i.e., two-dimensional vectors of coordinates); d t-1 is the difference between positions x t-1 and x t-2 ; bt is the behavioral state at ( ) time t ; T qbt is a transition matrix describing the rotational component of the movement, where q bt is the mean turn angle under behavioral state bt ; g bt is the degree of correlation (0 < g bt < 1) in both direction and speed under behavioral state bt ; and N 2 is a bivariate normal distribution with mean zero vector and covariance matrix represented by that describes the variability in the movement process. Two behavioral states termed here as transiting (b = trs) and exploratory (b = exp) were estimated. The transiting behavior is characterized by relatively fast moves and persistency in direction; the exploratory behavior is characterized by relatively slow moves with frequent changes in direction. A total of four transitions between behavioral states are possible but only 1 two of these need to be estimated. The probabilities of these two transitions are termed a trs|trs , which is the probability of a fish transiting at time t , given that it was also transiting at time t -1 ; and a trs|exp , which is the probability of a fish transiting at time t , given that it was at the exploratory state at time t -1. The second component of the state-space model is the observation equation, which describes how the unobserved states predicted by the process equation relate to the observed data. The observation equation enabled us to account for the irregularity, variable quality, and error in the position data. The irregularly observed data were modeled directly within the statespace framework with the use of an index i for observed positions between time t and t +1, where i = (0, 1, 2, … , nt ). An estimate for each of the irregularly observed positions, y t,i , was interpolated as: (2) where ji (0 < ji <1) is the proportion of the regular time interval between x t-1 and x t at which the ith observation is made and is a t-distributed random variable (see details below) representing the error in the positions estimated by the telemetry system. The ji values were calculated from the data based on date and time stamps associated with each observed position, and ji for regular time intervals where observations were missing were set to 0.5 and i = 1. Independent t-distributions, which have been shown to be robust to extreme values [1], were used to model the easting and northing components of error in Eq. 2. That is, for each component et,q ~ t (mt,q , t t,q , nt,q ) , where q ( q = 1, … , 7) is the quality class (see below) of the position estimate, is the location parameter, is the scale parameter and are the degrees of freedom. Rather than estimate 42 parameters for the t-distributions within the state- 2 space model, the parameters of the t-distributions were fixed to values estimated from errors in the easting and northing components of the position estimates of three beacon tags with fixed known location (Additional file 1). Because of the potential for error in position estimates to vary over time (e.g, due to environmental conditions, movement of log boom receivers), a scaling parameter ( ) was used to inflate or deflate the parameter of the t-distributions as needed for each track. The bull trout elevation (computed by subtracting fish depth from reservoir elevation) and body temperature data were also modeled within the state-space framework to account for missing data and errors in sensor readings. The process equation used in this case was an autoregressive model of order 1 (AR1) and was specified as: wt,s = rwt-1,s + ut,s (3) where wt,s and wt-1,s are the values of the variable s (s = fel [fish elevation] or s = btp [body temperature]) at time t and t -1, respectively; r is the degree of correlation between the values of s ; and ut,s is a random variable representing the process variability in s , with ut,s ~ N ( 0, ws ) . The observation equation used for interpolating the irregularly observed fish elevation and body temperature data, zt,i,s , is similar to Eq. 2 and was specified as: zt,i,s = (1- ji ) wt-1,s + ji wt,s + zt,s (4) where z t,s is a random variable representing the error in the sensor readings for s , with z t,s ~ N ( 0, ht,s ) . A Bayesian approach was used to fit the state-space models to the data with the software JAGS [2] and R [3], utilizing codes modified from the R package “bsam” [4]. The model was 3 fitted using a hierarchical framework, with the parameters of all models being estimated for the entire dataset, except the scaling parameter y , which was estimated individually for each track. Uninformative priors were specified for all parameters, except for the movement parameters g b and q b , and for the variance of the sensor error distributions hs . The priors for the movement parameters were: qtrs ~ 2p Beta ( 20, 20) - p ; qexp ~ 2p Beta (10, 10) ; gtrs ~ Beta ( 2, 1.5) ; and gexp ~ gtrs Beta (1, 1) . These priors are based on the fact that turn angles typically are close to zero and correlation is high while transiting, whereas turn angles are typically greater than zero and correlation is low while in the exploratory state [1, 5]. The priors for the variance of the sensor error distributions were hrel ~ U(0, 2.26) and hbtp ~ U(0, 0.12) . These priors were based on the accuracy of the sensors reported by the tag manufacturer, with the upper limit equaling æ sensor accuracy ö ç ÷ . è ø 2.33 2 The model was fitted to the data using a total of 250 000 Markov Chain Monte Carlo (MCMC) samples per chain (two chains were used), with the first 200 000 discarded as a burn-in and the remaining 50 000 samples thinned out to 500 by retaining every 100th sample [6]. During the MCMC sampling, a sample from the posterior distribution of positions was retained only if it occurred at a location where the elevation of the forebay bottom (from bathymetry data) was lower than the reservoir water elevation for the date the track was observed (indicating that the sample was in water); and the associated sample from the posterior distribution of fish elevation was greater than the elevation of the forebay bottom at the same location (indicating that the sample was above the bottom). The posterior distribution for fish elevation was truncated at the reservoir water elevation value for the date a track was observed to force the sample to be underwater. Sampling was repeated if a sample did not meet these conditions. The approach 4 effectively created a dynamic 3-dimensional land mask (grid size resolution used: 6 × 6 m) that informed the model of locations to where a fish could not move. The median and 2.5% and 97.5% percentiles (i.e., to form 95% credible intervals) of the distribution of model parameters, fish positions, elevations, body temperatures, and behavioral states were calculated from the resulting 1 000 MCMC samples. The proportion of behavioral states estimated as exploratory at each position was computed and interpreted as as the probability of bull trout being in the exploratory state (Pexp). Convergence of the MCMC chains was assessed graphicaly using trace, density and autocorrelation plots for the model parameters, and QQ-plots of the standard Normal Z-scores of the Geweke’s simple test for convergence applied to all fish positions, behavioral state, elevations and body temperatures [4]. Model performance The performance of the DCRWS state-space model was assessed by comparing the estimates of positions and behavioural states for three test tags with those obtained from a differential GPS (DGPS) device (GeoXH, Trimble, Sunnyvale, CA, USA). The DGPS device was mounted on a styrofoam platform that was floated across the forebay along with the three test tags hanging from a line attached to the platform (Figure 1a). The assessment revealed mean absolute error of 12.8 m (± 5.9 m) in the DCRWS estimates. This represents a modest improvement (~1.5–5 m) compared with the mean absolute error of 17.8 m (± 18.6 m) using all observations or of 14.2 m (± 11.8 m) using those observations with reliability number above the threshold of 2.5 [7]. However there was substantial improvement in the variability of the error – the % coefficient of variation for the 5 DCRWS estimates was substantially smaller (46.1%) than those computed from all observations (104.5%) and from observations with reliability number > 2.5 (83.1%). The DCRWS model estimated the “behavioral state” of the test tags adequately, yielding a high Pexp value for locations where the tags were allowed to drift and low Pexp value for locations where the tags were moved in a persistent direction (Figures 1b–d). Indeed state-space models have been previously shown to effectively estimate behavioral states from movement data [8]. Parameter estimates Parameter estimates of the DCRWS state-space model indicated good separation between bull trout transiting and exploratory behavioral states, with no overlap between the 95% credible intervals for turning angles (i.e., q trs and qexp ) and between correlations (i.e., g trs and gexp ) in direction and speed for each behavioral state (Table 1). Arbitrarily defining locations with Pexp < 0.25 as transiting and Pexp > 0.75 as exploratory revealed more variable turning angles and much lower speeds (in body lengths per second) for the exploratory state (Figures 2a−b). Estimates of speed in the transiting and exploratory states were consistent with speeds measured for bull trout in laboratory and field studies [9, 10]. The probability of bull trout remaining in the same behavioral state was high (see a trs|trs and 1- atrs|exp in Table 1). The estimates of scaling parameters y ranged from 0.04 to 603.89 (median of 2.22) across tracks. Parameter estimates of the AR1 models revealed high correlation between sequential values for fish elevation and body temperature, indicating strong persistence in these variables (Table 1). Converting fish elevation to depth revealed that bull trout typically remained within 15 m of the surface, were usually deeper during the summer and fall, and closer to the surface in the 6 spring and winter (Figure 2c). Body temperatures were typically between 0 °C and 12 °C, being highest in the fall and summer, and lowest in the winter (Figure 2d). Variability in body temperatures was greatest in the spring and lowest during the winter (Figure 2d). References 1. Jonsen ID, Mills-Flemming J, Myers RA: Robust state-space modeling of animal movement data. Ecology 2005, 86:2874–2880. 2. Plummer M: JAGS: a program for analysis of Bayesian graphical models using Gibbs sampling. In Procedings of the 3rd International Workshop on Distributed Statistical Computing (DSC 2003): 20–22 March 2003; Vienna. Edited by Hornik K, Leisch F, Zeileis A. 2003. 3. R Development Core Team: R: A language and environment for statistical computing. [http://www.r-project.org] 4. Jonsen ID, Basson M, Bestley S, Bravington MV, Patterson TA, Pedersen MW, Thomson R, Thygesen UH, Wotherspoon SJ: State-space models for bio-loggers: A methodological road map. Deep Sea Res Part II 2013, 88-89:34–46. 5. Pedersen MW, Patterson TA, Thygesen UH, Madsen H: Estimating animal behavior and residency from movement data. Oikos 2011, 120:1281–1290. 6. Lunn D, Jackson C, Best N, Thomas A, Spiegelhalter D: The BUGS Book: A Practical Introduction to Bayesian Analysis. Boca Raton: CRC Press; 2013. 7. Niezgoda G, Benfield M, Sisak M, Anson P: Tracking acoustic transmitters by code division multiple access (CDMA)-based telemetry. Hydrobiologia 2002, 483:275–286. 7 8. Beyer HL, Morales JM, Murray D, Fortin M-J: The effectiveness of Bayesian state-space models for estimating behavioural states from movement paths. Methods Ecol Evol 2013, 4:433–441. 9. Mesa MG, Welland LK, Zydlewski GB: Critical swimming speeds of wild bull trout. Northwest Sci 2004, 78:59–65. 10. Taylor MK, Hasler CT, Findlay CS, Lewis B, Schimidt DC, Hinch SG, Cooke SJ: Hydrologic correlates of bull trout (Salvelinus confluentus) swimming activity in a hydropeaking river. River Res Appl, in press. 8 Table 1 Posterior medians and 95% credible interval for the parameters of the DCRWS model and the AR1 models for fish elevation and body temperature Percentile Parameter 2.5% 50% 97.5% q trs -0.03 -0.01 0.01 qexp 3.17 3.24 3.31 gtrs 0.89 0.91 0.93 gexp 0.43 0.47 0.52 a trs|trs 0.76 0.78 0.81 a trs|exp 0.13 0.16 0.18 s easting 30.52 32.62 34.89 s northing 28.11 30.26 32.50 rfel 0.99 0.99 0.99 wfel 0.71 0.73 0.75 hfel 1.13 1.15 1.17 rbtp 0.99 0.99 0.99 wbtp 4.2 × 10−2 4.3 × 10−2 4.4× 10−2 hbtp 4.9 × 10−4 5.0 × 10−4 5.1 × 10−4 DCRWS AR1 (fish elevation) AR1 (body temperature) 9 q is the mean turning angle; g is the degree of correlation in direction and speed; a is the conditional probability of switching between behavioral states; s is the process variance in movement; r is the degree of correlation in fish elevation and body temperature; w is the process variance in fish elevation and body temperature; h is the variance in sensor reading errors. trs: transiting; exp: exploratory; fel: fish elevation; btp: body temperature. 10 Figure 1 Assessment of the state-space model ability to estimate true positions and behavioral states. (a) Track recorded by the DGPS, with dashed circles denoting locations where the tags were allowed to drift to simulate the exploratory behavior. (b−d) State-space estimates of true tag positions and associated Pexp (filled circles). The grey line denotes the track estimated by the acoustic telemetry system and the black solid line denotes the track recorded by the DGPS. In all panels, the dashed line denotes the water 11 line at the time the tracking data were recorded; the black rectangle denotes the top of the powerhouse; and the black polygon denotes part of the dam. 12 Figure 2 State-space model estimates. (a) Speed (body lengths per second) and (b) turning angle by behavioral state, (c) depth and (d) body temperature by season. 13