CornellLabofOrnithology / ebird-best-practices

Best Practices for Using eBird Data
https://CornellLabOfOrnithology.github.io/ebird-best-practices/
Other
31 stars 12 forks source link

Chapter 6 (Abundance Models): GAM Errors #19

Closed pabuveery closed 1 year ago

pabuveery commented 1 year ago

Hello! I am attempting to create abundance models for several species, and am experiencing a challenge with the GAM models. When I run a zero-inflated poisson model, I get the following error:

Error in x$terms %||% attr(x, "terms") %||% stop("no terms component nor attribute") : no terms component nor attribute

When I run the negative binomial models or the tweedie distribution, I get the following error:

Error in s(day_of_year, k = 5) : unused argument (k = 5)

After looking into common GAM errors, I couldn't find any interpretation of why these errors would come about. I started creating abundance models in August and had no trouble until a couple of weeks ago; I did not make any changes to the code or update R or RStudio. Strangely, I have specifically been able to avoid this issue for a Blackburnian Warbler abundance model for BCR 12 if, and only if, I rerun my habitat covariates (Chapter 3) script from scratch. If I proceed to attempt another species after this, I receive the above errors -- and furthermore, if I rerun the Blackburnian Warbler code after having received these errors, the Blackburnian Warbler code now throws the same errors.

This is a strange and idiosyncratic issue, but do you have any insights into why this may be occurring? Happy to provide any further code, systems info, etc. that may be helpful in answering this question. I'm on a MacOS Big Sur (11.4), using RStudio (2022.02.3) on R version 4.2.1.

Thank you for your help!

pabuveery commented 1 year ago

Sorry, I jumped the gun on this post -- I think another package I'd loaded downstream for dataviz masked mcgv, and after specifying mcgv::gam() on my models I was able to rerun my code. Feel free to delete this (or to leave it up if anyone else experiences the issue). Thanks!