Using stacking method to obtain annual abundance estimates

61 views
Skip to first unread message

Ryan Williams

unread,
Nov 12, 2025, 10:20:21 AM (13 days ago) Nov 12
to unmarked
I originally posted this question as a response to this thread. I thought it might be more appropriate to re-post as a separate question (I deleted my original post).

I have been trying to figure out how to generate annual abundance estimates using pcount(). I'm working with a large dataset of surveys for a rare turtle species (~700 sites, ~4,000 surveys, 2012-2024). Survey effort across sites and years is not uniform. I have had success with models looking at abundance as related to various site covariates and detection across years. I have been digging through unmarked's documentation, the literature, and this group to figure out how to look at a trend of abundance. I have a number of detection covariates I'd like to include in the model, along with year at the site level in order to obtain annual estimates for N. As most sites were surveyed in multiple years, I am trying to figure out how to incorporate year at the site level.

Upon reading about the site/year "stacking" method, I wondered if it would be appropriate to meet my objective. Could I create a y-matrix that looks like the following?

SiteAYear01   survey01 survey02 survey03
SiteAYear02   survey01 survey02 survey03 survey04
SiteAYear03   survey01 survey02 survey03
etc...

Could I then add year as a site covariate to generate estimates of abundance for each year? If that's a reasonable thing to do, it seems I should also include site as a random effect to address pseudoreplication issues. If so, does this mean to:

1.) Include site, defined as (using the example above) "SiteA", i.e., the original site ID (what I was assuming I should do), or
2.) Include site, defined as (using the example above) "SiteAYear01", i.e., the site as it pertains to the y-matrix

Any input would be greatly appreciated. I am still trying to get my bearings using N-mixture so it is entirely possible I am missing something simple to address my issue.

Thank you!
Ryan

Jeffrey Royle

unread,
Nov 13, 2025, 11:30:37 AM (12 days ago) Nov 13
to unma...@googlegroups.com
hi Ryan,
 You are correct -- you can model trend in this manner by defining a site covariate that is "year" where year is defined with respect to the order of your rows: 1,2,3...., 1,2,3.... etc...
 To model random effects for site, you should then use a grouping variable where all rows of the same site sharing a value (like "SiteA" as you suggested). For this you have to use the TMB model fitting engine. I don't have experience with that myself but there are examples around I believe. 

regards
andy


--
*** Three hierarchical modeling email lists ***
(1) unmarked (this list): for questions specific to the R package unmarked
(2) SCR: for design and Bayesian or non-bayesian analysis of spatial capture-recapture
(3) HMecology: for everything else, especially material covered in the books by Royle & Dorazio (2008), Kéry & Schaub (2012), Kéry & Royle (2016, 2021) and Schaub & Kéry (2022)
---
You received this message because you are subscribed to the Google Groups "unmarked" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unmarked+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/unmarked/ded1065c-b2b8-4cbb-9ed2-d7b30d3a174dn%40googlegroups.com.

Ryan Williams

unread,
Nov 13, 2025, 1:20:17 PM (12 days ago) Nov 13
to unmarked
Thank you, Andy, for the confirmation! I will dig into TMB.

Ryan

Marc Kery

unread,
Nov 13, 2025, 9:32:41 PM (12 days ago) Nov 13
to unmarked
Dear Ryan,

re. TMB, no digging is required at all. unmarked uses TMB automatically under the hood when you specify such additional random effects ... or perhaps there is a switch in the unmarked model fitting function that you have to set 'engine = 'TMB'' (I forgot ). That's all.

Happy modeling  -- Marc


From: unma...@googlegroups.com <unma...@googlegroups.com> on behalf of Ryan Williams <ryanwilliams...@gmail.com>
Sent: Thursday, November 13, 2025 19:20
To: unmarked <unma...@googlegroups.com>
Subject: Re: [unmarked] Using stacking method to obtain annual abundance estimates
 
Reply all
Reply to author
Forward
0 new messages