Open s3alfisc opened 1 month ago
I have a self-contained implementation here fwiw; will need some refactoring but it is the same idea.
np.linalg.lstsq(X, W, rcond=1)[0]
will happily solve a multiple-outcome linear regression for you, which is the bulk of the work in Jonah's procedure.
Oh that's just super cool! Would you mind to open a PR that adds your code in a standalone file? Then I could take over from there with refactoring & testing, but we wouldn't lose track of the fact that you are the initial author of the module?
Btw, looking at your nicely organized and object oriented implementation, two things come to my mind: in my first or second year of grad school, I tried myself at an R implementation of the decomposition and vaguely recall that my code was much, much more convoluted than your very concise implementation. I was truly terrible at coding back then ...
Second, I am feeling a little guilty about my non-OOP implementation of ritest
. I might have to refactor it and introduce an Ritest
class after all ... 😄
Awesome, thank you!
Context:
Gelbach's decompositionis a useful tool in mediation analysis.
To do
decompose()
class forFeols
.