Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upSuggestions for "margins" of ridge regression? #140
Comments
I'll attach my logs so far, why not. It's a bit opaque, tho. Below are the log statements in diff form, and I attach two files:
The first obvious difference is i=2. 1.log has
2.log has
It's as if FUN=F0 for some reason I can't quite see in 2.log. Log statements:
|
I found a possible factor.
For For
So perhaps the margins code is changing the model values in a way that currently depends on information carried around with the model. This would have to be adapted to ridgeLinear, but exactly what is required here is not obvious to me. |
Thanks for all your work - I'll try to figure out what needs to happen. |
dfrankow commentedMar 25, 2020
This is a request for debugging assistance for a new feature, margins of ridge regression. If I can debug this, I'd be happy if you'd accept a pull request with the feature.
I am trying to modify your "predictions" and "margins" libraries to find the marginal effects of a ridge regression.
The test and output look like this:
Clearly computing the standard error is not going well for my ridgeLinear object.
It is entirely possible that I've modified the ridgeLinear object to have some bug, or that I've incorrectly implemented the interface for it in the "prediction" library. The place I've traced to so far (the "FUN" gradient function in margins) seems to perhaps use the parent environment for some of its values. I could have a scoping problem. I'm looking for suggestions of things to try.
Within my "margins", I traced it with this code in the RStudio debugger:
The jacobian is always all 0s for model2 (the linearRidge model), so perhaps the world looks flat and it doesn't find the variances properly.
I can keep dropping into the debugging rathole by diving into the marginal_effects within the gradient function FUN ("me_tmp <- gr.." near line 20 of gradient_factory.R), but I wondered if you had any ideas.
Thanks for your attention.
Output of
sessionInfo
: