Supplement 1. Script for the hierarchical model coded in BUGS language and technical specifications.

File List

hierarchical_model_NZ_birds.r (MD5: eeeb5ac11c7e8ceacd5bd6fc67d14473)

Script for the hierarchical model coded in BUGS language.


This supplement provides the code of the hierarchical model used in the main analyses. This code can be directly implemented in any BUGS software, although JAGS has proved the most efficient. The code is intended to be easily transferable to similar data sets.

Technical specifications for the main text analyses: three chains of 250 000 iterations were run, plus an adaptation period of 1000 iterations. A burnin period of 125 000 iterations was discarded, the remaining 125 000 were used for inference after thinning by 100. These chains took 15 days to run on a server with the following characteristics:

CPU: 2 x Intel Xeon X5670 2.93 GHz
RAM: 48 GB
Operating system: Microsoft Server 2008 - 64bit
Disk-capacity: 3.63 TB ( 2 x 2 TB disks in RAID-0 configuration)

The data need to be formatted as follows:

obs: a three-dimensional array [sites, replicates, species] for bird counts;

FOR, NATFOR, ALT, YR, VH, HOUR, HOUR2, HDET, SUBZON, TYH, OBSERV , ST: vectors for covariates, each with one value per site. HOUR2 corresponds to HOUR*HOUR. All continuous variables should be centered and scaled to improve convergence;

S: the number of species;

R: the number of sites;

K: the number of replicates;

nobs: the number of different observers;

nsubzone: the number of regions;

nyear: the number of survey years;

NST: the number of guilds (here two, exotic and natives);

NTYH: the number of different local habitats.