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

Application: Generalized linear models #63

Open
ocramz opened this issue Jul 18, 2018 · 3 comments
Open

Application: Generalized linear models #63

ocramz opened this issue Jul 18, 2018 · 3 comments

Comments

@ocramz
Copy link
Owner

ocramz commented Jul 18, 2018

References :

@adamConnerSax
Copy link

Just a note here. I've been working my way through replicating some of Rs lmer and glmer using sparse-linear-algebra as the sparse matrix representation. It's going slowly but going.
I'm using Cholmod (via hcholmod and some extras I added) and nlopt (via hmatrix-nlopt).
Right now I'm pretty close to a working version for lmer and it's done in the same way that R does it which should make generalizing to glmer more or less straightforward.
The Cholmod interface needs some work, and when I come up for air, I plan to build a cholmod-sla package to give useful access to cholmod routines using sparse-linear-algebra on the haskell side.
That's fairly straightforward and hcholmod needs replacing anyway since, though it's super useful, it doesn't expose enough, doesn't work with a nice sparse matrix representation and, I think, isn't handling all the FFI stuff quite right. Though I'm not sure about that last bit.
Another issue for later is getting the problem specification types correct. For now I've just rolled something that works for specifying the grouping of observations and which random-effects to model. But that could probably benefit from some more eyes at some point.
Anyway, it's most definitely a WIP but you can see what's going on so far here:
https://github.com/adamConnerSax/glm-haskell
which is more-or-less, following the (lme) algo as described here:
https://arxiv.org/pdf/1406.5823.pdf
Then I will move onto the glm bits from here (which use the same pieces but with another optimization step in the middle to handle the weights coming from the link function):
https://cran.r-project.org/web/packages/lme4/vignettes/Theory.pdf

Once this all (the bare bones of lmer and glmer) works, I'd be happy to see what we can do about adding different algos, like whatever is in glmnet. I've been focused on glmer because it is what's used in some papers doing electorate modeling and I have some plans to explore that work once I have the tools.

@ocramz
Copy link
Owner Author

ocramz commented Aug 7, 2019

Wow, thanks for sharing your work! I agree the FFI stuff is pretty confusing; I've never looked into the cholmod internals. However I'd be happy to support you in using/extending SLA.

@adamConnerSax
Copy link

Just an update here: I've got LMMs and GLMMs (with Normal, Bernoulli, Binomial, Poisson, and Gamma distributions for observations) working, at least roughly. I'm working on some confidence interval stuff--parametric bootstrapping and likelihood profiling. All following lme4. You can see that work on this branch: https://github.com/adamConnerSax/glm-haskell/tree/GLMMs
The interface and internals are sort of terrible at this point. I need to use it more on real things to see how to simplify its use.
As always, feedback and thoughts are most welcome!

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

No branches or pull requests

2 participants