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

Enable large Armadillo matrices #17

Merged
merged 3 commits into from
May 31, 2022
Merged

Enable large Armadillo matrices #17

merged 3 commits into from
May 31, 2022

Conversation

SebKrantz
Copy link
Contributor

I got an error in a large data setting, the error is:

Running Two-stage Difference-in-Differences
• first stage formula `~ 0 | id + t`
• second stage formula `~ paved`
• The indicator variable that denotes when treatment is on is `paved`
• Standard errors will be clustered by `id`
Error in make_V(x1, x10, x2) : 
  SpMat::init(): requested size is too large; suggest to enable ARMA_64BIT_WORD
Called from: make_V(x1, x10, x2)

Adding PKG_CPPFLAGS = -DARMA_64BIT_WORD=1 apparently fixes it. See:

https://stackoverflow.com/questions/40592054/large-matrices-in-rcpparmadillo-via-the-arma-64bit-word-define

@kylebutts
Copy link
Owner

Awesome! Thanks Sebastian. Love collapse by the way! Just to confirm, this fixed your issue with big data? I think I've tried this before with someone else and it didn't fix it.

@SebKrantz
Copy link
Contributor Author

Thanks @kylebutts, it certainly runs pretty long in my case, but I am still able to terminate the run without terminating R. Since this is an Armadillo option which needs to be set at compile time i.e. cannot be changed by the R user, it is better to enable it and have users deal with the consequences of their code running too long.

@kylebutts
Copy link
Owner

Thanks, great! As for running with super large datasets, running bootstrapped standard errors is possible as well (description of why analytic standard errors slow things down a lot #12 (comment)).

You can also, of course get point estimates and slightly too small errors by running the two-stages manually as you work on it and then bootstrap the standard errors when the code is running properly!

@kylebutts kylebutts merged commit 854ab3b into kylebutts:main May 31, 2022
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

Successfully merging this pull request may close these issues.

2 participants