biodiverse / spOccupancy

Single-species, Multi-species, and Integrated Spatial Occupancy Models
https://www.jeffdoser.com/files/spoccupancy-web/
GNU General Public License v3.0
52 stars 8 forks source link

extracting predicted occupancy state #46

Closed dvpopescu closed 5 months ago

dvpopescu commented 5 months ago

hi Jeff,

I am using msPGocc with a metagenomics eDNA dataset with 101 sites and 157 species. Many species, some very common ones, are only detected at only a handful of sites. I need to get detection-corrected occupancy predictions for these species at the same sampling locations, rather than at new locations. Since function predict requires new locations, would using function fitted be appropriate in this case? Thank you!

Viorel

doserjef commented 5 months ago

Hi Viorel,

Thanks for the note! fitted() is for extracting the detection probability values as well as "replicate" data values for use with posterior predictive checks, which I don't think is what you're looking for here. Instead, the detection corrected occupancy predictions at the same sampling locations are available directly in the model output object. So, if you saved the output from msPGOcc in a file called out, you can access the posterior samples for the detection corrected occupancy probabilities with out$psi.samples or you can get the posterior samples for the latent occupancy state (the binary 0/1 value) with out$z.samples.

Hope that helps! Let me know if I can clarify anything.

Jeff

dvpopescu commented 5 months ago

Thank you, Jeff!