Zipkin Lab Code Archive

Note: this website is a living document: we list both completed projects and those that are in development on this page. For projects in development, some information may be incomplete. You can watch our progress (or join in!) from this repo.


Our lab develops mathematical and statistical models to study the distribution and demographics of populations and communities. We work on a range of basic and applied problems and a variety of taxa including insects, birds, fish, amphibians, and mammals.

yeah bar

Unmarked population models

We develop models to estimate the abundance, distribution, and demographic rates of populations using count and occupancy data. These efforts allow us to quantitatively evaluate important life history parameters with less sampling effort than is traditionally required by mark-recapture studies.


Integrating count and detection–nondetection data to model population dynamics

Full text available here.

Figure 4

Citation - Zipkin, E. F., Rossman, S., Yackulic, C. B., Wiens, J. D., Thorson, J. T., Davis, R. J. and Grant, E. H. C. (2017), Integrating count and detection–nondetection data to model population dynamics. Ecology, 98: 1640–1650. doi:10.1002/ecy.1831

Abstract - There is increasing need for methods that integrate multiple data types into a single analytical framework as the spatial and temporal scale of ecological research expands. Current work on this topic primarily focuses on combining capture–recapture data from marked individuals with other data types into integrated population models. Yet, studies of species distributions and trends often rely on data from unmarked individuals across broad scales where local abundance and environmental variables may vary. We present a modeling framework for integrating detection–nondetection and count data into a single analysis to estimate population dynamics, abundance, and individual detection probabilities during sampling. Our dynamic population model assumes that site-specific abundance can change over time according to survival of individuals and gains through reproduction and immigration. The observation process for each data type is modeled by assuming that every individual present at a site has an equal probability of being detected during sampling processes. We examine our modeling approach through a series of simulations illustrating the relative value of count vs. detection–nondetection data under a variety of parameter values and survey configurations. We also provide an empirical example of the model by combining long-term detection–nondetection data (1995–2014) with newly collected count data (2015–2016) from a growing population of Barred Owl (Strix varia) in the Pacific Northwest to examine the factors influencing population abundance over time. Our model provides a foundation for incorporating unmarked data within a single framework, even in cases where sampling processes yield different detection probabilities. This approach will be useful for survey design and to researchers interested in incorporating historical or citizen science data into analyses focused on understanding how demographic rates drive population abundance.

Code - Link to code and data


Dynamic N-occupancy models: estimating demographic rates and local abundance from detection-nondetection data

Full text available here.

Citation - Rossman, S., Yackulic, C. B., Saunders, S. P., Reid, J., Davis, R. and Zipkin, E. F. 2016. Dynamic N-occupancy models: estimating demographic rates and local abundance from detection-nondetection data. Ecology doi:10.1002/ecy.1598

Abstract - Occupancy modeling is a widely used analytical technique for assessing species distributions and range dynamics. However, occupancy analyses ignore variation in abundances of occupied sites, even though site abundances affect many of the parameters being estimated (e.g., extinction, colonization, detection probability). We introduce a new model (“dynamic N-occupancy”) capable of providing accurate estimates of local abundance, population gains (reproduction/immigration), and apparent survival probabilities while accounting for imperfect detection using only detection/nondetection data. Our model utilizes heterogeneity in detection based on variations in site abundances to estimate latent demographic rates via a dynamic N-mixture modeling framework. We validate our model using simulations across a wide range of values and examine the data requirements, including the number of years and survey sites needed, for unbiased and precise estimation of parameters. We apply our model to estimate spatio-temporal heterogeneity in abundances of barred owls (Strix varia) within a recently invaded region in Oregon (USA). Estimates of apparent survival and population gains are consistent with those from a nearby radio-tracking study and elucidate how barred owl abundances have increased dramatically over time. The dynamic N-occupancy model greatly improves inferences on individual-level population processes from occupancy data by explicitly modeling the latent population structure.

Code - Link to code


Modeling structured population dynamics using data from unmarked individuals

Full text available here.

Figure 2

Citation - Zipkin, E. F., Thorson, J. T., See, K., Lynch, H. J., Grant, E. H. C., Kanno, Y., Chandler, R. B., Letcher, B. H. and Royle, J. A. (2014), Modeling structured population dynamics using data from unmarked individuals. Ecology, 95: 22–29. doi:10.1890/13-1131.1

Abstract - The study of population dynamics requires unbiased, precise estimates of abundance and vital rates that account for the demographic structure inherent in all wildlife and plant populations. Traditionally, these estimates have only been available through approaches that rely on intensive mark–recapture data. We extended recently developed N-mixture models to demonstrate how demographic parameters and abundance can be estimated for structured populations using only stage-structured count data. Our modeling framework can be used to make reliable inferences on abundance as well as recruitment, immigration, stage-specific survival, and detection rates during sampling. We present a range of simulations to illustrate the data requirements, including the number of years and locations necessary for accurate and precise parameter estimates. We apply our modeling framework to a population of northern dusky salamanders (Desmognathus fuscus) in the mid-Atlantic region (USA) and find that the population is unexpectedly declining. Our approach represents a valuable advance in the estimation of population dynamics using multistate data from unmarked individuals and should additionally be useful in the development of integrated models that combine data from intensive (e.g., mark–recapture) and extensive (e.g., counts) data sources.

Code - Link to code and data

Inferences about population dynamics from count data using multistate models: a comparison to capture–recapture approaches

Full text available here.

Figure 1

Citation - Zipkin, E. F., T.S. Sillett, E. H. Campbell Grant, R. B. Chandler, and Royle, J. A. 2014. Inferences about population dynamics from count data using multistate models: a comparison to capture–recapture approaches. Ecology and Evolution, 4(4):417–426

Abstract - Wildlife populations consist of individuals that contribute disproportionately to growth and viability. Understanding a population's spatial and temporal dynamics requires estimates of abundance and demographic rates that account for this heterogeneity. Estimating these quantities can be difficult, requiring years of intensive data collection. Often, this is accomplished through the capture and recapture of individual animals, which is generally only feasible at a limited number of locations. In contrast, N-mixture models allow for the estimation of abundance, and spatial variation in abundance, from count data alone. We extend recently developed multistate, open population N-mixture models, which can additionally estimate demographic rates based on an organism's life history characteristics. In our extension, we develop an approach to account for the case where not all individuals can be assigned to a state during sampling. Using only state-specific count data, we show how our model can be used to estimate local population abundance, as well as density-dependent recruitment rates and state-specific survival. We apply our model to a population of black-throated blue warblers (Setophaga caerulescens) that have been surveyed for 25 years on their breeding grounds at the Hubbard Brook Experimental Forest in New Hampshire, USA. The intensive data collection efforts allow us to compare our estimates to estimates derived from capture–recapture data. Our model performed well in estimating population abundance and density-dependent rates of annual recruitment/immigration. Estimates of local carrying capacity and per capita recruitment of yearlings were consistent with those published in other studies. However, our model moderately underestimated annual survival probability of yearling and adult females and severely underestimates survival probabilities for both of these male stages. The most accurate and precise estimates will necessarily require some amount of intensive data collection efforts (such as capture–recapture). Integrated population models that combine data from both intensive and extensive sources are likely to be the most efficient approach for estimating demographic rates at large spatial and temporal scales.

Code - Link to code and data

Monarch butterfly populations

Monarch butterflies are a species of critical conservation concern. Our lab has several interdiciplinary modelling initiatives to understand the dynamics and drivers of their populations at site to continental scales.


Evaluating confidence in climate-based predictions of population change in a migratory species

Full text available here.

Figure 4

Citation - Saunders, S. P., Ries, L., Oberhauser, K. S. and Zipkin, E. F. (2016), Evaluating confidence in climate-based predictions of population change in a migratory species. Global Ecol. Biogeogr., 25: 1000–1012. doi:10.1111/geb.12461

Abstract Aim - Forecasting ecological responses to climate change is a common objective, but there are few methods for evaluating confidence in such predictions. For migratory species, in particular, it is also essential to consider the extent of spatial synchrony among separate breeding populations in range-wide predictions. We develop a quantitative method to evaluate the accuracy of climate-based ecological predictions and use this approach to assess the extent of spatio-temporal synchrony among distinct regions within the breeding range of a single migratory population.
Location - We model weekly site-specific summer abundances (1996–2011) of monarch butterflies (Danaus plexippus) in the Midwestern USA as a function of climate conditions experienced during a shared spring migration/breeding phase in Texas and separate summer recruitment periods in Ohio and Illinois.
Methods - Using negative binomial regression models, we evaluate spatiotemporal synchrony between monarchs in the two states and develop a novel quantitative assessment approach to determine the temporal predictive strength of our model with Bayesian P-values.
Results - Monarchs breeding in the Midwest exhibit spatio-temporal synchrony in Ohio and Illinois; cooler spring temperatures, average to above average precipitation in Texas and cooler than average summer temperatures are associated with higher population abundances in both states. At least 10 years of data are needed for adequate model predictability of average future counts. Because annual spring weather conditions in Texas primarily drive yearly abundances, as opposed to localized summer effects, year-specific counts are often difficult to predict reliably, specifically when predictive spring conditions are outside the range of typical regional conditions.
Main conclusions - Our assessment method can be used in similar analyses to more confidently interpret ecological responses to climate change. Our results demonstrate the relative importance of climatic drivers in predicting abundances of a migratory species and the difficulties in producing reliable predictions of animal populations in the face of climate change

Code - Link to code

Data - proprietary- please contact the authors for access.

Breakpoint analysis

Understanding when changes occur in dynamic systems is not trivial when multiple drivers are in play. Yet this understanding is critical for making managment decisions. We are developing tools to understand when changes are occuring in dynamic systems, and conducting cross-diciplinary analysis to understand how the length of time we observe a system affects our conclusions about that system.

In development

The Dynamic Regime Shift detector project

This project is currently in development.

simulation outputs for shift size

Citation - C.A. Bahlai and E.F. Zipkin

Abstract - Understanding how and when environmental factors interact with density dependent internal population regulation remains a fundamental question in ecology. Pinpointing when sustained state changes occur in naturally fluctuating populations has remained unresolved. Yet, an analytical approach which allows the identification of timing and magnitude of such changes would advance our understanding and have the potential to direct the management of species of economic or conservation concern. We develop a generalizable tool, the “Regime Shift Detector” for adapting a simple density dependent model to detecting shifts in dynamic regime in population time series data. This tool was developed as a suite of functions for examining population time series data for the presence, location, and magnitude of shifts, using an iterative approach to fitting the Ricker model on subsets of the time series, and ranking the fit of the break point combination using model selection. We examined the performance of this tool with simulated data and two real-world case studies of involving 20-year population time series datasets documenting species of conservation and economic concern. We found that under low sampling error conditions, the regime shift detector tool was able to identify no shift scenarios in approximately 60% of cases, and identify shifts in 1, 2 and 3 break scenarios in ≥80% of cases, although its performance declined as sampling error increased. In our case study examining the invasion process of Harmonia axyridis, the regime shift detector identified shifts in population cycling associated with prey availability. However, the case study examine population cycling in Monarch butterflies, the regime shift detector tool’s results were more ambiguous, suggesting multiple super-imposed processes were involved in the decline of this species. When interpreted in the context of known species biology, the regime shift detector script has the potential to aide management decisions and identify, and rank critical drivers of change in a species internal dynamics. In an era of rapid global change affecting species dynamics, it is critical to use tools which allow better understanding of changes to internal regulators of population, and not base management decisions on population numbers alone.

Code - Link to code

The Bad Breakup project

This project is currently in development.

lampyrid timeseries

Citation - C.A. Bahlai, E.F. Zipkin and I. Gelfand

Abstract - How do different break points and starting points in our time series affect our ability to detect trends? Project in development.

Code - Link to code

More information

  1. Licensing

    Creative Commons License
    This work is licensed under a Creative Commons Attribution 4.0 International License.

    Although we endeavor to make all our supporting materials publicly available, some of our analyses rely on proprietary data created by others. In these cases, please get in contact with us or the original data creator to gain access to these data.

  2. How to use this code archive

    All of the materials made available here are freely usable, with attribution. If you like our work and are interested in collaborating on something building on what we've done, please let us know by email or commenting on the code in question through github. Please submit corrections as an issue or a pull request to this repo.

  3. About this page

    This wepage design was developed by Mozilla staff for the Working Open Workshop series and adapted by Christie Bahlai. It is maintained by members of the Zipkin Lab.