DOI: 10.5061/dryad.4j0zpc8nz
title: Data from: Improving population analysis using indirect count data: A case study of chimpanzees and elephants

description: Estimating spatiotemporal patterns of population density is a primary
 objective of wildlife monitoring programs. However, estimating density is
 challenging for species that are elusive and/or occur in habitats with
 limited visibility. In such situations, indirect measures (e.g., nests,
 dung) can serve as proxies for counts of individuals. Scientists have
 developed approaches to estimate population density using these “indirect
 count” data, although current methods do not adequately account for
 variation in sign production and spatial patterns of animal density. In
 this study, we describe a modified hierarchical distance-sampling model
 that maximizes the information content of indirect count data using
 Bayesian inference. We apply our model to assess the status of chimpanzee
 and elephant populations using counts of nests and dung, respectively,
 that were collected along transects in 2007 and 2021 in western Uganda.
 Compared to conventional methods, our modeling framework produced more
 precise estimates of covariate effects on expected animal density by
 accounting for both long-term and recent variations in animal abundance
 and enabled the estimation of the number of days that animal signs
 remained visible. We estimated a 0.98 probability that chimpanzee density
 in the region had declined by at least 10% and a 0.99 probability that
 elephant density had increased by 50% from 2007 to 2021. We recommend
 applying our modified hierarchical distance sampling model in the analysis
 of indirect count data to account for spatial variation in animal density,
 assess population change between survey periods, estimate the decay rate
 of animal signs, and obtain more precise density estimates than achievable
 with traditional methods.
description: # Data from: Improving population analysis using indirect count data: a
 case study of chimpanzees and elephants
 [https://doi.org/10.5061/dryad.4j0zpc8nz](https://doi.org/10.5061/dryad.4j0zpc8nz) ## Description of the data and file structure title: "Improving population analysis using indirect count data: a case study of chimpanzees and elephants" \# General description This dataset (five folders) contains indirect count data for chimpanzees (i.e, nests) and elephants (i.e., dung) for the 2007 and 2021 survey periods, covariates, and model outputs. The datasets were used to estimate the population density of chimpanzees and elephants, and their trend in Maramagambo and Kalinzu Forest Reserves located in western Uganda (east Africa) across two survey periods (i.e., 2007 and 2021). All the datasets are in .csv format and .Rdata format (i.e., output from R programing software). \# Methods \* Data collection/generation: see manuscript and associated code for details ``` : All code is available at Zenodo ``` **Authors' contact Information** **Name:** Samuel Ayebare \* Affiliations: 1 - Department of Integrative Biology, Michigan State University, East Lansing, MI, USA                         2 - Ecology, Evolution, and Behavior Program, Michigan State University, East Lansing, MI, USA                         3 - Wildlife Conservation Society (WCS)- Uganda Programme \* Email: [ayebares@msu.edu](mailto:ayebares@msu.edu) \* Alternate Email: [samwiiry@gmail.com](mailto:samwiiry@gmail.com) **Name:** Neil A. Gilbert \* Affiliations: 1 - Department of Integrative Biology, Michigan State University, East Lansing, MI, USA                         2 - Ecology, Evolution, and Behavior Program, Michigan State University, East Lansing, MI, USA \* Email: [neil.allen.gilbert@gmail.com](mailto:neil.allen.gilbert@gmail.com) **Name:** Andrew J. Plumptre Affiliations: 1 - KBA Secretariat, c/o BirdLife International, David Attemborough Building, Pembroke Street, Cambridge, UK                       2 - Conservation Science Group, Zoology Dept, Cambridge University, Pembroke St, Cambridge, UK \* Email: [aplumptre@keybiodiversityareas.org](mailto:aplumptre@keybiodiversityareas.org) **Name:** Simon Nampindo \* Affiliation: 1 - Wildlife Conservation Society (WCS)- Uganda Programme \* Email: [snampindo@wcs.org](mailto:snampindo@wcs.org) **Name:** Elise F. Zipkin \* Affiliations: 1 - Department of Integrative Biology, Michigan State University, East Lansing, MI, USA                         2 - Ecology, Evolution, and Behavior Program, Michigan State University, East Lansing, MI, USA \* Email: [ezipkin@msu.edu](mailto:ezipkin@msu.edu) **Sharing/Access information** ``` Links to datasets and corresponding publication ``` * Ayebare S, Gilbert AG, Plumptre AJ, Simon N, Zipkin EF. 2025. Data from: Improving population analysis using indirect count data: a case study of chimpanzees and elephants. Dryad, Dataset: [https://doi.org/10.5061/dryad.4j0zpc8nz](https://doi.org/10.5061/dryad.4j0zpc8nz) \* Corresponding publication: * Ayebare S, Gilbert AG, Plumptre AJ, Simon N, Zipkin EF. 2025. Improving population analysis using indirect count data: a case study of chimpanzees and elephants. Ecosphere, ``` Folder no 1- Data_ML ``` \# Folder contents: contains 14 files \# Format: .csv Description: input files to fit a conventional distance sampling model (maximum likelihood inference) - Visits 2 & 3 \**Note**: NA indicates that transects were surveyed but no observations were made. 1\. **`Kalinzu_Mara_combined_R2_2007.csv`**: input file (2007 survey) to estimate the population density of chimpanzees in Maramagambo and Kalinzu combined (default variance estimator - "R2"). 2\. **`Kalinzu_Mara_combined_R2_2021.csv`**: input file (2021 survey) to estimate the population density of chimpanzees in Maramagambo and Kalinzu combined (default variance estimator - "R2"). 3\. **`Kalinzu_Mara_R2_2007.csv`**: input file (2007 survey) to estimate the population density of chimpanzees in Maramagambo and Kalinzu seperately (default variance estimator - "R2"). 4\. **`Kalinzu_Mara_R2_2021.csv`**: input file (2021 survey) to estimate the population density of chimpanzees in Maramagambo and Kalinzu seperately (default variance estimator - "R2"). 5\. **`Elephant_mara_R2_2007.csv`**: input file (2007 survey) to estimate the population density of elephants in Maramagambo (default variance estimator - "R2"). 6\. **`Elephant_mara_R2_2021.csv`**: input file (2021 survey) to estimate the population density of elephants in Maramagambo (default variance estimator - "R2"). **Variables** \- Region.Label: name of protected area. \- Area: size of protected area (km squared). \- Sample.Label: unique identification for each line transect. \- object: unique identification for detected signs (i.e., nests or dung). \- Effort: Length of each transect (km). \- distance: perpendicular distances in meters. \- dist: distance categories (meters) used in Bayesian inference. 7\. **`Kalinzu_Mara_combined_S2_O2_2007.csv`**: input file (2007 survey) to estimate the population density of chimpanzees in Maramagambo and Kalinzu combined using a conventional distance sampling model (post-stratification based variance estimators- "S2" & "O2"). 8\. **`Kalinzu_Mara_combined_S2_O2_2021.csv`**: input file (2021 survey) to estimate the population density of chimpanzees in Maramagambo and Kalinzu combined using a conventional distance sampling model (post-stratification based variance estimators- "S2" & "O2"). 9\. **`Mara_S2_O2_2007.csv`**: input file (2007 survey) to estimate the population density of chimpanzees in Maramagambo using a conventional distance sampling model (post-stratification based variance estimators- "S2" & "O2"). 10\. **`Mara_S2_O2_2021.csv`**: input file (2021 survey) to estimate the population density of chimpanzees in Maramagambo using a conventional distance sampling model (post-stratification based variance estimators- "S2" & "O2"). 11\. **`Kalinzu_S2_O2_2007.csv`**: input file (2007 survey) to estimate the population density of chimpanzees in Kalinzu using a conventional distance sampling model (post-stratification based variance estimators- "S2" & "O2"). 12\. **`Kalinzu_S2_O2_2021.csv`**: input file (2021 survey) to estimate the population density of chimpanzees in Kalinzu using a conventional distance sampling model (post-stratification based variance estimators- "S2" & "O2"). 13\. **`Elephant_mara_S2_O2_2007.csv`**: input file (2007 survey) to estimate the population density of elephants in Maramagambo using a conventional distance sampling model (post-stratification based variance estimators- "S2" & "O2"). 14\. **`Elephant_mara_S2_O2_2021.csv`**: input file (2021 survey) to estimate the population density of elephants in Maramagambo using a conventional distance sampling model (post-stratification based variance estimators- "S2" & "O2"). **Variables** \- Region.Label: name of protected area. \- Area: size of protected area (km squared). \- object: unique identification for detected signs (i.e., nests or dung). \- Sample.Label.original: unique identification for each line transect before post-stratification. \- distance: perpendicular distances in meters. \- dist: distance categories (meters) used in Bayesian inference. \- Effort: Length of each transect (km). \- Sample.Label.original: unique identification for line transect after post-stratification. \- grouping: unique identification for each stratum. ``` Folder no 2- Data_Bayesian_inference ``` \# Folder contents: contains 13 files \# Format: .csv Description: input files to fit a conventional, hierarchical and modified hierarchical distance sampling models (Bayesian inference) 1\. **`Kalinzu_mara_V1_2007.csv`**: input file (2007 survey) - contains Visit 1 data (distance categories) for chimpanzees (nests). 2\. **`Kalinzu_mara_V23_2007.csv`**: input file (2007 survey) - contains Visits 2 & 3 data (distance categories) for chimpanzees (nests). 3\. **`Kalinzu_mara_V1_2021.csv`**: input file (2021 survey) - contains Visit 1 data (distance categories) for chimpanzees (nests). 4\. **`Kalinzu_mara_V23_2021.csv`**: input file (2021 survey) - contains Visits 2 & 3 data (distance categories) for chimpanzees (nests). 5\. **`Ele_V1_2007.csv`**: input file (2007 survey) - contains Visit 1 data (distance categories) for elephants (dung). 6\. **`Ele_V23_2007.csv`**: input file (2007 survey) - contains Visits 2 & 3 data (distance categories) for elephants (dung). 7\. **`Ele_V1_2021.csv`**: input file (2021 survey) - contains Visit 1 data (distance categories) for elephants (dung). 8\. **`Ele_V23_2021.csv`**: input file (2021 survey) - contains Visits 2 & 3 data (distance categories) for elephants (dung). **Variables** \- Tr: unique identification for each line transect. \- Visit: unique identification for each sampling event. \- cnest: number of nests observed in each distance category. \- eldung: number of dung observed in each distance category. \- dist: distance categories in meters. ``` \- chimpanzees: (0 - 5m = dist[1]); (5 - 10m = dist[2]);(10 - 15m = dist[3]); (15 - 20m = dist[4]);(20 - 25m = dist[5]). \- elephants: (0 - 1m = dist[1]); (1 - 2m = dist[2]);(2 - 3m = dist[3]); (3 - 4m = dist[4]);(4 - 5m = dist[5]). ``` 9\. **`Kalinzu_mara_2007.csv`**: input file (2007 survey) - contains Visits 1, 2, & 3 data (number of nests observed per transect) for chimpanzees. 10\. **`Kalinzu_mara_2021.csv`**: input file (2021 survey) - contains Visits 1, 2, & 3 data (number of nests observed per transect) for chimpanzees. 11\. **`Ele_2007.csv`**: input file (2007 survey) - contains Visits 1, 2, & 3 data (number of dung observed per transect) for elephants. 12\. **`Ele_2021.csv`**: input file (2021 survey) - contains Visits 1, 2, & 3 data (number of dung observed per transect) for elephants. ``` **Variables** ``` \- Tr: unique identification for each line transect. \- L: Length of each transect (km). \- V1: number signs (ie., nests or dung) observed during Visit 1. \- V2: number signs (ie., nests or dung) observed during Visit 2. \- V3: number signs (ie., nests or dung) observed during Visit 3. \- V23: number signs (ie., nests or dung) observed during Visits 2 & 3 combined. \- A: area surveyed for each transect (km squared). 13\. **`Pred_var.csv`**: predictor variable **Variables** \- Tr: unique identification for each line transect. \- elev: elevation (meters). ``` Folder no 3- Data_model_ouputs ``` \# Folder contents: contains 10 files \# Format: .csv Description: model outputs from a conventional, hierarchical and modified hierarchical distance sampling models (Bayesian inference) 1\. Mara.Kal_2007.V23_chimps_cds.RData: - model results (2007 survey) for chimpanzees from a conventional distance sampling model (Bayesian inference). 2\. Mara.Kal_2021.V23_chimps_cds.RData: - model results (2021 survey) for chimpanzees from a conventional distance sampling model (Bayesian inference). 3\. Mara.Kal_2007.V23_chimps_hds.RData: - model results (2007 survey) for chimpanzees from a hierarchical distance sampling model (Bayesian inference). 4\. Mara.Kal_2007.V23_chimps_hds.RData: - model results (2021 survey) for chimpanzees from a hierarchical distance sampling model (Bayesian inference). 5\. Mara.Kal_2007_2021.V23_chimps_mhds.RData: - model results (2007 & 2021 surveys) for chimpanzees from a modified hierarchical distance sampling model (Bayesian inference 6\. Eles_2007_mara_cds.RData: - model results (2007 survey) for elephants from a conventional distance sampling model (Bayesian inference). 7\. Eles_2021_mara_cds.RData: - model results (2007 survey) for elephants from a conventional distance sampling model (Bayesian inference). 8\. Eles_2007_mara_hds.RData: - model results (2007 survey) for elephants from a heirarchical distance sampling model (Bayesian inference). 9\. Eles_2007_mara_hds.RData: - model results (2021 survey) for elephants from a heirarchical distance sampling model (Bayesian inference). 10\. Eles_2007_2021_mara_mhds.RData: - model results (2007 & 2021 surveys) for elephants from a modified hierarchical distance sampling model (Bayesian inference). ``` Folder no 4- Data_bias ``` \# Folder contents: contains 12 files \# Format: .csv Description: bias results from a hierarchical and modified hierarchical distance sampling models (Bayesian inference) 1\. **`Bias_chimps_hds_mhds_2021.csv`**: Estimated bias of the sign density for chimpanzees (2021) used to plot Appendix S1:Figures S3. 2\. **`Bias_elephants_hds_mhds_2021.csv`**: Estimated bias of the sign density for elephants (2021) used to plot Appendix S1:Figures S3. 3\. **`Bias_chimps_hds_mhds_2007.csv`**: Estimated bias of the sign density for chimpanzees (2007) used to plot Appendix S1:Figures S4. 4\. **`Bias_elephants_hds_mhds_2007.csv`**: Estimated bias of the sign density for elephants (2007) used to plot Appendix S1:Figures S4. **Variables** \- Transects: unique identification for each line transect. \- Tr_id: unique identification for each line transect. \- Model: unique identifier indicating model membership for either MHDS (i.e., modified hierarchical distance sampling model) and HDS (i.e., hierarchical distance sampling model). \- sd: standard deviation. \- l25: lower 95% credible interval. \- u25: upper 95% credible interval. 1\. **`Bias_hds_2021_chimps_transects.csv`**: Estimated bias of the sign density for chimpanzees (2021) used to estimate relative bias for a hierarchical distance sampling model. 2\. **`Bias_hds_2021_eles_transects.csv`**: Estimated bias of the sign density for elephants (2021) used to estimate relative bias for a hierarchical distance sampling model. 3\. **`Bias_hds_2007_chimps_transects.csv`**: Estimated bias of the sign density for chimpanzees (2007) used to estimate relative bias for a hierarchical distance sampling model. 4\. **`Bias_hds_2007_eles_transects.csv`**: Estimated bias of the sign density for elephants (2007) used to estimate relative bias for a hierarchical distance sampling model. 5\. **`Bias_mhds_2021_chimps_transects.csv`**: Estimated bias of the sign density for chimpanzees (2021) used to estimate relative bias for a modified hierarchical distance sampling model. 6\. **`Bias_mhds_2021_eles_transects.csv`**: Estimated bias of the sign density for elephants (2021) used to estimate relative bias for a modified hierarchical distance sampling model. 7\. **`Bias_mhds_2007_chimps_transects.csv`**: Estimated bias of the sign density for chimpanzees (2007) used to estimate relative bias for a modified hierarchical distance sampling model. 8\. **`Bias_mhds_2007_eles_transects.csv`**: Estimated bias of the sign density for elephants (2007) used to estimate relative bias for a modified hierarchical distance sampling model. **Variables** \- transects: unique identification for each line transect. \- Model: unique identifier indicating model membership for either MHDS (i.e., modified hierarchical distance sampling model) and HDS (i.e., hierarchical distance sampling model). \- bias_per_transect: estimated bias per transect (expected number of signs – observed number of signs). \- observed_dung: number of elephant dung observed at each omitted transect. \- observed_nests: number of chimpanzee nests observed at each omitted transect. ``` Folder no 5- Data_studyarea ``` \# Folder contents: contains 4 files \# Format: i) Geographic information systems (e.g., .shp ; .tif) Description: protected area boundaries & elevation raster 1\. **`Kalinzu_FR.**`**: (4 files) - boundary for Kalinzu Forest Reserve. 2\. **`Maramagambo_FR.**`**: (4 files) - boundary for Maramagambo Forest Reserve. 3\. **`Maramagambo_Kalinzu_FRs.**`**: (4 files) - boundary for Maramagambo and Kalinzu Forest Reserves combined. 4\. **`elev_kal.mara.**`**: (2 files) - elevation raster for Maramagambo and Kalinzu Forest Reserves combined. # Code/software ``` Code_Maximum_likelihood ``` \#Folder contents: contains 6 files Description: R scripts - To fit a conventional distance sampling model (maximum likelihood inference) 1. `CDS_ML_Maramagambo_Kalinzu_combined_2007.R`: Contains code to format data and to fit a conventional distance sampling model for chimpanzees (2007 survey) - Maramagambo and Kalinzu combined. 2. `CDS_ML_Maramagambo_Kalinzu_combined_2021.R`: Contains code to format data and to fit a conventional distance sampling model for chimpanzees (2021 survey) - Maramagambo and Kalinzu combined. 3. `CDS_ML_Maramagambo_Kalinzu_seperate_2007.R`: Contains code to format data and to fit a conventional distance sampling model for chimpanzees (2007 survey) - Maramagambo and Kalinzu seperately. 4. `CDS_ML_Maramagambo_Kalinzu_seperate_2021.R`: Contains code to format data and to fit a conventional distance sampling model for chimpanzees (20021 survey) - Maramagambo and Kalinzu seperately. 5. `CDS_ML_Maramagambo_2007_eles.R`: Contains code to format data and to fit a conventional distance sampling model for elephants (2007 survey) - Maramagambo. 6. `CDS_ML_Maramagambo_2021_eles.R`: Contains code to format data and to fit a conventional distance sampling model for elephants (2021 survey) - Maramagambo. Code_Bayesian_inference \#Folder contents: contains 20 files Description: R scripts - To fit a conventional, hierarchical and modified hierarchical distance sampling models (Bayesian inference) 1. `CDS_Maramagambo_Kalinzu_chimpanzees_2007.R`: Contains code to format data and to fit a conventional distance sampling model for chimpanzees (2007 survey) - Maramagambo and Kalinzu combined. 2. `CDS_Maramagambo_Kalinzu_chimpanzees_2021.R`: Contains code to format data and to fit a conventional distance sampling model for chimpanzees (2021 survey) - Maramagambo and Kalinzu combined. 3. `CDS_Maramagambo_chimpanzees_2007.R`: Contains code to format data and to fit a conventional distance sampling model for chimpanzees (2007 survey) - Maramagambo. 4. `CDS_Maramagambo_chimpanzees_2021.R`: Contains code to format data and to fit a conventional distance sampling model for chimpanzees (2021 survey) - Maramagambo. 5. `CDS_Kalinzu_chimpanzees_2007.R`: Contains code to format data and to fit a conventional distance sampling model for chimpanzees (2007 survey) - Kalinzu. 6. `CDS_Kalinzu_chimpanzees_2021.R`: Contains code to format data and to fit a conventional distance sampling model for chimpanzees (2021 survey) - Kalinzu. 7. `CDS_Maramagambo_elephants_2007.R`: Contains code to format data and to fit a conventional distance sampling model for elephants (2007 survey) - Maramagambo. 8. `CDS_Maramagambo_elephants_2021.R`: Contains code to format data and to fit a conventional distance sampling model for elephants (2021 survey) - Maramagambo. 9. `HDS_Maramagambo_Kalinzu_chimpanzees_2007.R`: Contains code to format data and to fit a hierarchical distance sampling model for chimpanzees (2007 survey) - Maramagambo and Kalinzu combined. 10. `HDS_Maramagambo_Kalinzu_chimpanzees_2021.R`: Contains code to format data and to fit a hierarchical distance sampling model for chimpanzees (2021 survey) - Maramagambo and Kalinzu combined. 11. `HDS_Maramagambo_chimpanzees_2007.R`: Contains code to format data and to fit a hierarchical distance sampling model for chimpanzees (2007 survey) - Maramagambo. 12. `HDS_Maramagambo_chimpanzees_2021.R`: Contains code to format data and to fit a hierarchical distance sampling model for chimpanzees (2021 survey) - Maramagambo. 13. `HDS_Kalinzu_chimpanzees_2007.R`: Contains code to format data and to fit a hierarchical distance sampling model for chimpanzees (2007 survey) - Kalinzu. 14. `HDS_Kalinzu_chimpanzees_2021.R`: Contains code to format data and to fit a hierarchical distance sampling model for chimpanzees (2021 survey) - Kalinzu. 15. `MHDS_Maramagambo_Kalinzu_chimpanzees_2007_2021.R`: Contains code to format data and to fit a modified hierarchical distance sampling model for chimpanzees (2007 & 2021 surveys) - Maramagambo and Kalinzu combined. 16. `MHDS_Maramagambo_chimpanzees_2007_2021.R`: Contains code to format data and to fit a modified hierarchical distance sampling model for chimpanzees (2007 & 2021 surveys) - Maramagambo. 17. `MHDS_Kalinzu_chimpanzees_2007_2021.R`: Contains code to format data and to fit a modified hierarchical distance sampling model for chimpanzees (2007 & 2021 surveys) - Kalinzu. 18. `HDS_Maramagambo_elephants_2007.R`: Contains code to format data and to fit a hierarchical distance sampling model for elephants (2007 survey) - Maramagambo. 19. `HDS_Maramagambo_elephants_2021.R`: Contains code to format data and to fit a hierarchical distance sampling model for elephants (2021 survey) - Maramagambo. 20. `MHDS_Maramagambo_elephants_2007_2021.R`: Contains code to format data and to fit a modified hierarchical distance sampling model for elephants (2007 & 2021 surveys) - Maramagambo. ``` Code_bias ``` \#Folder contents: contains 9 files Description: R scripts - To assess bias for a hierarchical and modified hierarchical distance sampling models (Bayesian inference): using cross validation 1. `CV_Maramagambo_Kalinzu_chimpanzees_2021_HDS.R`: Assess bias for the hierarchical distance sampling model- chimpanzees 2021. 2. `CV_Maramagambo_Kalinzu_chimpanzees_2021_MHDS.R`: Assess bias for the modified hierarchical distance sampling model- chimpanzees 2021. 3. `CV_Maramagambo_Kalinzu_chimpanzees_2007_HDS.R`: Assess bias for the hierarchical distance sampling model- chimpanzees 2007. 4. `CV_Maramagambo_Kalinzu_chimpanzees_2007_MHDS.R`: Assess bias for the modified hierarchical distance sampling model- chimpanzees 2007. 5. `CV_Maramagambo_elephants_2021_HDS.R`: Assess bias for the hierarchical distance sampling model- elephants 2021. 6. `CV_Maramagambo_elephants_2021_MHDS.R`: Assess bias for the hierarchical distance sampling model- elephants 2021. 7. `CV_Maramagambo_elephants_2007_HDS.R`: Assess bias for the hierarchical distance sampling model- elephants 2007. 8. `CV_Maramagambo_elephants_2007_MHDS.R`: Assess bias for the hierarchical distance sampling model- elephants 2007. 9. `CV_Relative_bias_estimation_HDS_MHDS.R`: To estimate relative_bias = sum(expected number of signs – observed number of signs )/ sum(observed number of signs). ``` Code_figures ``` \#Folder contents: contains 13 files Description: # # R scripts generate some of the figures in the manuscript 1. `Population_status_and_change_spatial.R:` Contains code to produce input files for figures 3 & 7. 2. `Spatial_variation_in_density_chimps_2021.R`: Contains code to generate figure 3 on the spatial distribution of chimpanzees using the hierarchical and modified hierarchical distance sampling models (2021 survey). 3. `Spatial_variation_in_density_elephants_2021.R`: Contains code to generate figure 3 on the spatial distribution of elephants using the hierarchical and modified hierarchical distance sampling models (2021 survey). 4. `Figure4_cds_density_estimation.R`: Contains code to generate figure 4 on the population density estimates for chimpanzees and elephants (2007 and 2021 surveys) - conventional distance sampling model. 5. `Figure6_effect_of_elevation.R`: Contains code to generate figure 6 - effect of elevation on the expected density of chimpanzees and elephants. 6. `Figure7_spatial_changes_in_density`.R`: Contains code to generate figure 7 - map showing the spatial changes in expected population density from 2007 to 2021 for chimpanzees and elephants. 7. `FigureS1_prior_predictive_check_chimpanzees.R`: Contains code to generate Appendix S1:Figure S1 - the prior predictive check for the scale parameter - chimpanzees. 8. `FigureS1_prior_predictive_check_elephants.R`: Contains code to generate Appendix S1:Figure S1 - the prior predictive check for the scale parameter - elephants. 9. `Bias_across_transects_2021_2007_surveys_chimpanzees.R`: Contains code to generate figure 5; Appendix S1:Figures S3 & S4 - Bias in sign density. 10. `Bias_across_transects_2021_2007_surveys_elephants.R`: Contains code to generate Appendix S1:Figures S3 & S4 - Bias in sign density. 11. `Figures_integrating_across_time_space_chimpanzees.R`: Contains code to generate figure 5; Appendix S1: Figures S5 (effect of covariates), and Appendix S1:Figure S7 (Expected sign density along transects). 12. `Figures_integrating_across_time_space_elephants.R`: Contains code to generate Appendix S1: Figures S6 (effect of covariates), and Appendix S1:Figure S7 (Expected sign density along transects).