Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory errors when using predict for models with the same variable as a fixed and random effect #30

Open
doserjef opened this issue Sep 8, 2023 · 1 comment

Comments

@doserjef
Copy link
Collaborator

doserjef commented Sep 8, 2023

A memory error will occur when predicting for models that use the same variable as a fixed effect and unstructured random effect in the model (e.g., a linear year trend and a random, unstructured effect of year). This occurs for all spOccupancy model types. This is currently fixed on the development version for two model types (svcTMsPGOcc and stMsPGOcc), and I will fix this for additional model types within the next few weeks. I will update this when all model types are fixed on GitHub, and then eventually fixed on the next CRAN version. Thanks to Liam Kendall for making me aware of this problem.

@doserjef
Copy link
Collaborator Author

This error still exists for all model types except svcTMsPGOcc and stMsPGOcc. A simple, but somewhat clunky, solution to this problem is to supply two different variables to occ.covs when fitting the model and subsequently doing prediction. For example, if you want to fit a multi-season model with a linear trend for years as well as an unstructured random effect for years, then you can supply two identical variables to occ.covs with slightly different names (e.g., years and years.random), fit the model with the two identical variables with different names (e.g., occ.formula = ~ years + (1 | years.random)), and then generate the prediction design matrix with the same structure.

I am not updating this functionality in v0.7.3 that will be released on CRAN in April 2024, but rather I am waiting to update this for when I add in random slope functionality. I'll keep this issue open until that happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant