biodiverse / ubms

Fit models to data from unmarked animals using Stan. Uses a similar interface to the R package 'unmarked', while providing the advantages of Bayesian inference and allowing estimation of random effects.
https://hmecology.github.io/ubms/
GNU General Public License v3.0
35 stars 8 forks source link

error when plotting gof() object #75

Closed jaymwin closed 9 months ago

jaymwin commented 9 months ago

Hello Ken,

Many thanks for the hard work on this package, and just wanted to report on a potential issue. After running the goodness-of-fit test function, I've been unable to create the posterior predictive check plot. I get the following error when running the vignette code:

fm_fit <- gof(fm, draws=500)
plot(fm_fit)

Error in as.double(y) : 
  cannot coerce type 'S4' to vector of type 'double'

I also see this error when running my own occupancy models. Here's my session info if that's helpful:

> sessionInfo()
R version 4.3.1 (2023-06-16 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22621)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

time zone: America/Chicago
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] ubms_1.2.6     unmarked_1.3.2

Thanks!

Jay

jaymwin commented 9 months ago

Nevermind, I started a new R session and it is working now that I've only loaded ubms. Must've been a conflict with the plot() function in another package.