estimating density of multiple species at multiple sites: example code

128 views
Skip to first unread message

A. Marm Kilpatrick

unread,
Feb 10, 2024, 2:17:14 AM2/10/24
to distance-sampling
Hi All,
I've done quite a bit of analysis of distance sampling data in the past via Program Distance. I'd like to do a new analysis in R. I've read through the R examples on the Distance page:
However, I can't find an example of what I would think would be a very standard dataset: point counts of multiple species of birds at multiple sites. 
There is an example of how to estimate density for one species at multiple sites (deer pellet example) and a nice example of how to estimate the density of multiple species at one site (multi-species surveys example), but no example that I could find that combines the two. Did I miss it? 
I'd like to use the approach in the multi-species surveys example to fit detection functions that take advantage of data from multiple species to fit the detection functions for rarer species with fewer observations, and I need to estimate densities for multiple sites. The stratification in the dht2() function only accepts one level (site or species but not both). I'm guessing it's something quite simple but since none of the examples I could find show how to do this I'm a bit puzzled. 
Apologies if I've missed it. I also tried searching in the messages here and despite reading back through 6 years of messages with search terms I couldn't find anything providing an example.
As a simple hack I've created a column that is the species & site columns pasted together as ~species_site and used this for the ~strat_formula argument for dht2(). That works, but I'm guessing there is a better way.
Thank you!
marm
PS: It would be fantastic to add one additional example to the Distance Examples page that combines multiple species at multiple sites. If someone shows me how to do it, I'd happily write the .RMD file to post on the example page so others can see how to do it too. 

Eric Rexstad

unread,
Feb 10, 2024, 3:42:11 AM2/10/24
to distance-sampling, A. Marm Kilpatrick
Prof Kilpatrick

Thanks for your interest and your thorough examination of our online resources. You haven't missed an example of two-level stratification, we don't have such an example.

The hack you describe will serve the purpose. If your data set is sufficiently rich, you can simply treat each of your sites separately (as if they were separate study areas), then perform your "species as covariate" detection function modelling.

I have experimented with using two covariates to perform the analysis you describe (see attached script). I must emphasise this is an untested solution. I used the same data set as in the "multi-species" example on our website. I manufactured "sites" from the data set by treating the two visits as if they were geographic strata. Subsequently, I fitted models of the form

testhn <- ds(birds, key="hn", truncation = 95, convert_units = cu,
             region_table = birds.regiontable,
             sample_table = birds.sampletable,
             formula=~species+visit)

and produced density estimates not dissimilar to the estimates presented in Buckland (2006).

From: 'A. Marm Kilpatrick' via distance-sampling <distance...@googlegroups.com>
Sent: 10 February 2024 07:13
To: distance-sampling <distance...@googlegroups.com>
Subject: [distance-sampling] estimating density of multiple species at multiple sites: example code
 
--
You received this message because you are subscribed to the Google Groups "distance-sampling" group.
To unsubscribe from this group and stop receiving emails from it, send an email to distance-sampl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/distance-sampling/65bda3bf-f206-4527-8897-a9675804d695n%40googlegroups.com.
two-level-stratification.R
Reply all
Reply to author
Forward
0 new messages