Supplement 1. The WinBUGS code for analysis of movement paths.

File List

singlet.txt   WinBUGS code for model "Single", a single Random Walk. Size 2 KB
double.txt   WinBUGS code for model "Double", two Random Walks. Size 2 KB
double_covar.txt   WinBUGS code for model "Double with Covariates". Size 3 KB
double_switch.txt   WinBUGS code for model "Double Switch". Size 3 KB
switch_covar.txt   WinBUGS code for model "Switch with Covariates". Size 3 KB
switch_constrained.txt   WinBUGS code for model "Switch Constrained". Size 3 KB
triple_switch.txt   WinBUGS code for model "Triple Switch". Size 2 KB
HierSwitch.txt   WinBUGS code for hierarchical version of Switch model. Size 3 KB
simulasw.m   Matlab code for movement simulation. Size 5 KB
PPcheck.m   Matlab code for posterior predictive check. Size 7 KB
elk_data.txt   Movement data for four elk. Size 87 KB
simulated.txt   Movement data simulated with simulasw.m. Size 46 KB
     
allfiles.zip   All files together. Size 58 KB

Description

WinBUGS code was run on version 1.4 available at http://www.mrc-bsu.cam.ac.uk/bugs/winbugs/contents.shtml. We use the following generic script:

display('log')
check('directory/model_name.txt')
data('directory/data_file.txt')
compile(4)
inits(1, 'directory/filename1_ini.txt')
inits(2, 'switch/filename2_ini.txt')
inits(3, 'switch/filename3_ini.txt')
inits(4, 'switch/filename4_ini.txt')
gen.inits()
set(parameter_names)
over.relax('yes')
update(50000)
stats(*)
quantiles(*)
coda(*,switch/output)

See the WinBUGS manual for details on how to run the analysis. Matlab code was run on student version 6.5.