-
Notifications
You must be signed in to change notification settings - Fork 36
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
Add 1st stage regression in Feiv class #525
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
|
Very cool! Looking forward to it =) |
There are a few concerns that I have working on this issue.
Thanks! |
Hi @Jayhyung - sorry for my delayed response, I have been swamped for work over tethe last days :/
Yes, only one endogenous variable is allowed. It would be quite cool to allow for more, but this would require to rework the
For now, I think that coefficient, predicted values and residuals is all that we need, right? So this sounds good to me =)
Sounds like a good strategy =) I think that you could just create a new test file, e.g. |
Thanks for the feedback! I will work on my next iteration. Stay tuned. :) |
Just added the error testing file! Please let me know if anything extra should be done. |
@@ -133,6 +139,28 @@ def get_fit(self) -> None: | |||
_Z = self._Z | |||
_Y = self._Y | |||
|
|||
# Start First Stage | |||
|
|||
model1 = Feols( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it correct that the endogenous variable is always the first one in _X
. But it would likely be safer to use the endogvar created via the model_matrix_fixest
function?
This would require to add an endogvar
argument to Feiv.__init__
and to pass it to Feiv.get_fit()
.
We would also have to demean endogvar
in FixestMulti.
Alternatively, we could also keep this as is, as the unit tests you've implemented would certainly catch it if we broke this logic. =)
What do you think @Jayhyung ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think your practice is more sensible as it encompasses more general cases. I will take this into account in the next iteration!
demean "endogva" in FixestMulti.py
I added |
pyfixest/estimation/feiv_.py
Outdated
@@ -31,7 +33,8 @@ class Feiv(Feols): | |||
Names of the coefficients of Z. | |||
collin_tol : float | |||
Tolerance for collinearity check. | |||
weights_name : Optional[str] | |||
weights_name : Op endgvar : np.ndarray |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small formatting issue here =)
Thanks! Just fixed the formatting issue. Let me know if anything comes up! |
Perfect. It's merged =) thanks @Jayhyung! |
Hi Alex @s3alfisc! More details with this PR will follow soon.