-
Notifications
You must be signed in to change notification settings - Fork 726
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
LinearDRIV effect vs effect_interval shape inconsistency #687
Comments
Hi @kbattocchi, I would like to take this issue. |
I believe the issue is with the _BaseDRIVModelFinal class. For example, I can replicate the shape inconsistency with SparseLinearDRIV too. I avoid the shape inconsistency issue, if I modify the predict method in _BaseDRIVModelFinal as below. This works because it makes eff = self.const_marginal_effect(X) with dimensions (m,1) instead of (m,1,1). Then the effect method returns an output array with dimensions (m,). @kbattocchi and @fverac does this look like a reasonable approach? One concern I have is that this conditional check might miss some T and Y dimension configurations of the _BaseDRIV class though I wasn't able to reproduce any.
|
@ssemov Thanks for volunteering to look into this. It might help to outline the intended shapes of these methods:
Judging from the above specification, I would say that in the original repro, the shape of I think your fix makes Hope this helps! P.S. extended the repro code a little to demonstrate more
|
Thanks, @fverac! This is super helpful. I looked into your suggestion, and indeed the error is with the inference object LinearDRIV uses. LinearDRIV uses the StatsModelsInference class, which inherits its effect_interval method from LinearModelFinalInference. That outputs a vector of dimensions This only happens when I'll send a fix. |
Output array shapes are inconsistent for
LinearDRIV.effect()
andLinearDRIV.effect_interval()[0]
. Should make these consistent.Seems to occur when one of either Y, T, or Z is an array instead of a vector.
Repro:
The text was updated successfully, but these errors were encountered: