logdensity / WAIC

286 views
Skip to first unread message

Duarte, Adam

unread,
Jul 8, 2016, 6:51:28 PM7/8/16
to hmec...@googlegroups.com
Hi All,

I am fitting a multi-species occupancy model for different amphibian species. Some of the species are assumed to be detected without false positives; however, two of the salamander species can be confused with each other in the field when in the larvae life stage. For those two species, I am fitting the false-positive multiple detection state occupancy model of Miller et al . (2011) - http://onlinelibrary.wiley.com/doi/10.1890/10-1396.1/abstract -, where the larvae detections (when no other life stage is detected) are the "uncertain" detections. I would like to use WAIC for model selection. I have seen this post (https://sourceforge.net/p/mcmc-jags/examples/ci/ef7330d75872d8ae4e44acc7bf2d889fcfce1d9d/tree/classic-bugs/vol1/blocker/blocker.bug) using the "logdensity.bin" command to calculate the log likelihood when using the "dbin" command in jags. This seems to work for most of the species by simply using this bit of code - "log.lik.LICA[tt,ii,jj]<- logdensity.bin(detect.LICA[tt,ii,jj],p.LICA[tt,ii,jj],z.LICA[tt+1,ii])". Is there an option like "logdensity.cat" when using the "dcat" command like I need to use to fit the false-positive occupancy model? I have tried "log.lik.AMMA[tt,ii,jj]<- logdensity.cat(detect.AMMA[tt,ii,jj],pi.AMMA[tt,ii,jj,],z.AMMA[tt+1,ii])". It returns the error "Incorrect number of parameters in function logdensity.cat". To me this means the command does exist for jags but that it has a different number of inputs than what I am using. I have searched around and cannot find an example of this. Has anyone come across this that can steer me in the right direction? Thank you in advance for your help.

Cheers,

Adam

  

Tomas Telensky

unread,
Jul 12, 2016, 4:08:30 AM7/12/16
to Duarte, Adam, hmec...@googlegroups.com


Hi Adam,

this is interesting - that JAGS has so many undocumented functions! I just
downloaded jags user manual for version 4.0.0 (cannot find for version
4.2.0!!) and it's not there. Not sure if it is the version difference...
I guess in this case of undocumented functions you need to look in JAGS source code...

Tomas
> --
> *** Three hierarchical modeling email lists ***
> (1) unmarked: for questions specific to the R package unmarked
> (2) SCR: for design and Bayesian or non-bayesian analysis of spatial capture-recapture
> (3) HMecology (this list): for everything else, especially material covered in the books by Royle & Dorazio (2008), Kéry & Schaub (2012), Kéry & Royle (2015)
> --- You received this message because you are subscribed to the
> Google Groups "hmecology: Hierarchical Modeling in Ecology" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to hmecology+...@googlegroups.com.
> To post to this group, send email to hmec...@googlegroups.com.
> Visit this group at https://groups.google.com/group/hmecology.
> To view this discussion on the web visit https://groups.google.com/d/msgid/hmecology/6894a8f5-82f7-240a-70e9-e022f3ee9eff%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.

--
Pomozte nám chránit ptáky – staňte se členy ČSO!
www.birdlife.cz/prihlaska.html

Duarte, Adam

unread,
Jul 13, 2016, 12:12:22 PM7/13/16
to Tomas Telensky, hmec...@googlegroups.com
Thank you for the reply, Tomas. I will check out the source code and see
if I can make sense of it.

Cheers

Adam

Kristin Broms

unread,
Jul 13, 2016, 3:49:12 PM7/13/16
to Duarte, Adam, Tomas Telensky, hmecology: Hierarchical Modeling in Ecology
Hi Adam,

If you are proficient in R, another option would be to calculate WAIC outside of Jags, just be sure to save the relevant parameters.  The benefits of this approach are that there are more help files for R functions, and if you make a calculation error, you can recalculate WAIC without having to rerun the entire model.

~Kristin



For more options, visit https://groups.google.com/d/optout.



--
Kristin Broms, PhD

Postdoctoral Fellow
Colorado Cooperative Fish and Wildlife Research Unit
Department of Fish, Wildlife, and Conservation Biology
Colorado State University
205 Wagar
1484 Campus Delivery
Fort Collins, CO 80523

John Clare

unread,
Sep 4, 2016, 3:12:03 PM9/4/16
to hmecology: Hierarchical Modeling in Ecology
Hey Adam,

Don't know if you figured this out already or not, but was just looking at some of the logdensity options in JAGS: I think maybe the issue with  "log.lik.AMMA[tt,ii,jj]<- logdensity.cat(detect.AMMA[tt,ii,jj],pi.AMMA[tt,ii,jj,],z.AMMA[tt+1,ii])" 
is that the categorical distribution only has one argument (pi,or the set of probabilities), and so the logdensity.cat should only have two arguments: the data being considered, and the set of probabilities associated with the categorical outcome. 


Cheers,

John 
Reply all
Reply to author
Forward
0 new messages