Issue Accessing Derived Quantities (bpvalue and r2) in communityModel

6 views
Skip to first unread message

Fernando Pinho

unread,
Jun 10, 2025, 12:07:30 AMJun 10
to camtrapR

Hello,

I’m using the communityModel function from the camtrapR package but cannot access certain derived quantities like bpvalue and r2 from the model output. Could you help clarify how to extract these values or if they require additional steps to compute?

Example of my code:

mod.jags <- communityModel(
  data_list,
  occuCovs = list(ranef = c("distHidro", "distHab")),
  detCovsObservation = list(ranef = "effort"),  
  detCovs = list(ranef = c("CTcode", "trail")),
  intercepts = list(det = "ranef", occu = "ranef"),
  modelFile = modelfile1)


fit.jags <- fit(
  mod.jags,
  n.iter = 50000,
  n.burnin = 5000,
  chains = 3)

Thank you for your assistance!

Juergen Niedballa

unread,
Jun 10, 2025, 1:35:32 AMJun 10
to camtrapR
Hello,
the bayesian p-values and related quantities (like r2, the species-specific residuals) are not returned by the model anymore.
Instead we moved the calculation of everything related to model fit assessment / posterior predictive checks to two dedicated functions: 
  • PPC.community (for the entire model / community) and 
  • PPC.residuals (for individual species, probably less relevant for you here)
The functions are now included in the dev version on github, which you can install via: 
remotes::install_github("jniedballa/camtrapR", ref = "dev", build_vignettes = TRUE)

There is an example workflow shown in the Examples section of 
?PPC.community

If there are further issues (e.g. memory related due to the predict calls) please let me know. 
Best,
Jürgen
Reply all
Reply to author
Forward
0 new messages