New R package "ubms"

785 views
Skip to first unread message

Ken Kellner

unread,
Jan 25, 2021, 9:56:45 AM1/25/21
to unmarked
Hi all,

My R package "ubms" is now available on CRAN [1]. The package allows you to fit many of the same models as unmarked, but in a Bayesian framework with Stan [2] instead of with maximum likelihood. "ubms" allows you to specify random effects on model parameters (e.g., a random observer effect) using the syntax from "lme4", and you also get posterior distributions for parameters. 

The interface is designed to be almost identical to unmarked for easy switching back and forth, and it uses unmarkedFrames for data input. So, for example, if you fit an occupancy model in unmarked with the following code:

umf <- unmarkedFrameOccu(...)
fit <- occu(~1~1, data=umf)

You could fit the same model in Stan like this:

fit2 <- stan_occu(~1~1, data=umf)

Currently there are Stan equivalents of the unmarked functions occu, occuRN, occuTTD, pcount, distsamp, and colext. There are also helper functions for prediction, goodness of fit, and extracting posterior distributions of latent parameters like site-level abundance and occupancy (similar to what ranef() does in unmarked).

This is not meant to be a replacement for unmarked. In fact, I would suggest always fitting models in unmarked first, and only using ubms if you specifically need the extra abilities. Also, while I hope to add more models to ubms in the future, it is unlikely that equivalents to certain more complex unmarked functions like gdistsamp(), pcountOpen(), etc., will ever end up in ubms.

If you'd like to see more details, the package website is here [3] and there is an extended demo of the package features here [4]. Feel free to contact me with questions or issues, or submit bug reports on Github [5]. I hope you find the package useful!

Ken

Chance Hines

unread,
Oct 27, 2021, 11:40:41 AM10/27/21
to unmarked
I am exploring this package and really like the vignette. Thank you Ken for creating this.

I am posting a typo in the vignette so others wont have to troubleshoot too long. Forgive me for not posting the code format.

plot_dat in the 'simulate latent occupancy states' section has the upper quantile for group1 mislabeled as group2.

Ken Kellner

unread,
Oct 27, 2021, 12:09:03 PM10/27/21
to unmarked
Thanks! Good catch. I'll fix it.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages