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 limits + survey weights #4

Closed
paulrconnor opened this issue Jan 29, 2018 · 3 comments
Closed

Memory limits + survey weights #4

paulrconnor opened this issue Jan 29, 2018 · 3 comments

Comments

@paulrconnor
Copy link

Hi,

I'd really like to use the r2beta function to recover partial r squared values from a lmer model, but I am getting the following error:

Error in t(ZZ) %% EE %% ZZ :
Cholmod error 'problem too large' at file ../MatrixOps/cholmod_ssmult.c, line 224

The data has around 1.5 million observations, i'm fitting about 10 fixed effects and one random effect with lmer(). Do you know any way around this problem?

Also, I fit the model using a vector of post-stratification weights. I'm not sure if this would make the estimates from the r2beta function invalid or not?

Any help on either of these issues would be much appreciated.

@paulrconnor paulrconnor changed the title Memory limits Memory limits + survey weights Jan 29, 2018
@paulrconnor
Copy link
Author

Ah, don't worry, figured out how to do this manually.

@bcjaeger
Copy link
Owner

Glad the memory issue was worked out. Regarding the weights, the r2beta function uses estimates of fixed and random model components to get partial and model R2 values. Those R2 values will be affected indirectly by the weights insofar as the weights determine the estimated fixed effect sizes and random effect variance estimates. Thus, weights should not be a problem for the r2beta function when it is applied to a linear mixed model fitted using the lmer() function; however, the same is not true for a generalized linear mixed effects model. The reason for this discrepancy is that the r2beta function uses penalized quasi-likelihood estimation to obtain model estimates for the generalized linear mixed model, and that process requires iterative updates of the model weights.

@paulrconnor
Copy link
Author

Thanks. The models are linear. I should also probably clarify that I didn't solve the memory issue: as far as I can tell the matrix algebra under the hood of r2beta requires more memory than I have to work with with a model that large. My fix was to use the code from Nakagawa and Shielzeth (2013) but compute the variance f the fixed effects with wt.var() instead of var(), which seems to have fixed the issue.

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

2 participants