Saana Isojunno and Patrick J. O. Miller. 2015. Sperm whale response to tag boat presence: biologically informed hidden state models quantify lost feeding opportunities. Ecosphere 6:6. http://dx.doi.org/10.1890/es14-00130.1


Supplement

R scripts for fitting the base- and full-model structures to sample data.
Ecological Archives C006-003-S1.

Copyright


Authors
File list (downloads)
Description


Author(s)

Saana Isojunno
School of Biology
University of St Andrews, Bute Building
St Andrews, Fife KY16 9TS United Kingdom
E-mail: [email protected]


File list

run_base_full_models.R (MD5: adc930d6094b52c44838c1530c662920)

base_model.txt (MD5: 36b6b952b0c31b1921cee7a53e48b83a)

full_model.txt (MD5: 211e7b9afd6bc402f307653661e168ab)

jags_data.Rd (MD5: b10e52de46c11eeb2477960681a631e6)

viterbi_funs.R (MD5: 7d6e8db0684738d8ea1722c95b8c7eba)

Description

The code included in run_base_full_models.R fits the 'base' and 'full' models described in the main text (Table 2). The base model (Model structure 2) is fitted with 5 states and fixed step length (FS). The full model (Model structure 9) is fitted with 6 states and time-varying step length (TS). The script then calls Viterbi_funs.R to estimate the Viterbi sequence of states based upon the posterior state-dependent parameter estimates. Running the script requires jags software (freely available at http://mcmc-jags.sourceforge.net/) and the r package 'R2jags'. Sample data, priors, and example R2jags fitting objects are supplied in jags_data.Rd which can be directly loaded into r. The text files contain the model structures in jags script. To run the script, place all the files into your r working directory.