Skip to main content
U.S. flag

An official website of the United States government

Code for analysis of polar bear maternal den abundance and distribution in four regions of northern Alaska and Canada within the Southern Beaufort Sea subpopulation boundary (1982-2015)

September 6, 2022

We have archived the derived data files and R/JAGS code for our analysis as a U.S. Geological Survey data release (link ). The code is divided into three R scripts: 1) pbdens_landdens_JWM.r contains R code for fitting hierarchical Bayesian models of polar bear maternal den abundance and distribution for the Southern Beaufort Sea (SBS) subpopulation, 1982-2015. This script requires the installation of JAGS (http://mcmc-jags.sourceforge.net/), and several model files in the JAGS programming language (.bug extension) must be present in the same working directory. There are four required model files: allyears_no_timevar.bug, allyears_timetrend_areablock.bug, allyears_timetrend_areablock.bug, allyears_timevar_areadot.bug, allyears_timevar_areavar.bug, and allyears_timevarblock_areablock.bug, which represent the structure of individual models with various levels of complexity (annual variation in the probability of dens occurring on land and the probability of land dens occurring in each of four study regions). 2) polarbearden_SBS_kde_JWM.r will create 95% kernel density estimates of observed polar bear den locations on land for three periods: 1982-2015, 1982-1999, and 2000-2015. This script includes code for basic plots of the kernel density maps, conversion into raster and shapefile formats, and summary statistics for comparing kernel density estimate values among regions of interest within the SBS. 3) pbdens_SBS_RF_RSF_JWM.r will fit a resource selection function for predicting the probability of a location being used as a polar bear maternal den based on environmental characteristics, by contrasting "used" (observed dens) and "available" (random locations within the 95% kernel density estimate boundary where dens were not observed) for polar bear maternal den locations on land in the SBS. This script also includes code for summarizing model fit, evaluating predictor variable importance, and plotting partial dependence plots characterizing the marginal effect of individual predictor variables on the probability of a location being classified as "Used";. All scripts contain additional documentation describing the data objects used in the analysis, their sources, and the analytical tools that we used. The repository also contains an RData object ('pbdens_SBS_JWM.RData') with all data inputs required for each script.

Publication Year 2022
Title Code for analysis of polar bear maternal den abundance and distribution in four regions of northern Alaska and Canada within the Southern Beaufort Sea subpopulation boundary (1982-2015)
DOI 10.5066/P9ZNG8JT
Authors Vijay P Patil
Product Type Software Release
Record Source USGS Digital Object Identifier Catalog
USGS Organization Alaska Science Center