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

Bring predict back #245

Merged
merged 1 commit into from
Oct 22, 2023
Merged

Bring predict back #245

merged 1 commit into from
Oct 22, 2023

Conversation

nilshg
Copy link
Contributor

@nilshg nilshg commented Oct 2, 2023

This PR takes another shot at a predict method for fixed effect models, with the aim of closing #204 and #243.

While this implementation solves the issues with missing data raised in #204, it does not fix the fe(x1)&x2 interaction case. Instead I've written a rather hacky solution that attempts to detect these cases and error out.

The issue I ran into is that once an fe term is involved, we can't rely on the StatsModels magic to create our X matrix for us and then multiply by coefficients. While it wouldn't be too hard to fix this for the simple fe(x1)&x2 case, I quickly realized that this doesn't then cover fe(x1)&fe(x2)&x3 and lots of other permutations one could think up. All in all I was going down a path of re-implementing the modelmatrix machinery which didn't seem right, so I stopped and copped out with the error.

Would be good to get opinions from @matthieugomez @eloualiche as to whether a band aid like this is acceptable to at least get the basic functionality in, maybe also @jariji who took an interest in #243 in having this. I would also be interested in improving this PR by adding confidence intervals if anyone's got ideas on how to do this.

@codecov
Copy link

codecov bot commented Oct 2, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (6d23721) 95.78% compared to head (d0ad15b) 96.35%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #245      +/-   ##
==========================================
+ Coverage   95.78%   96.35%   +0.57%     
==========================================
  Files           8        8              
  Lines         640      659      +19     
==========================================
+ Hits          613      635      +22     
+ Misses         27       24       -3     
Files Coverage Δ
src/FixedEffectModel.jl 95.20% <100.00%> (+1.96%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@matthieugomez
Copy link
Member

Yes, I think a band aid like this is acceptable.

@eloualiche eloualiche merged commit 4c5e187 into FixedEffects:master Oct 22, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants