Displaying Fixed Effects with Statsmodel Summary_col #32
adrianmross
started this conversation in
Show and tell
Replies: 3 comments 2 replies
-
Heck yeah! I'm going to add this to the community codebook and update the regression chapter (somewhere?!) @LeDataSciFi/classmates-2024 |
Beta Was this translation helpful? Give feedback.
2 replies
-
Tracking that PR in the statsmodel package: statsmodels/statsmodels#9191 (Currently awaiting either maintainer action, or revision to pass code checks, unclear.) |
Beta Was this translation helpful? Give feedback.
0 replies
-
It might be that I failed the formatting checks. I’ll revise an do again as the maintainers might not look at it till that’s sorted. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The Problem : Too many C(garbage) variables! 🗑️
On Assignment 6, I asked in the discussion thread:
I am sure others ran into this problem when doing the assignment. C(variables) in the index about a mile long. 🤬
Let's examine what I mean with the
diamonds
dataset by running a couple of regressions on it.Ugly. 💩 We can do better.
The Solution: Fixed Effects ✨
So, Prof. Bowen responded this is a common problem. Researchers tend to show they used categorical variables without all the coefficients, saying whether they included a fixed effect.
What do you think is the best way to code this? Well... not to brag, but I think I have a good solution.
That's much better. 👌
What is going on here
make_has_FE
, a particular classification of functions in Comp. Sci., which constructs and returns other functionshas_FE
. 🫨🤯has_FE
checks whether the categorical parameter passed to it is present in the dataframe index of the model. If present it returns"Yes"
.info_dict
insummary_cols
to create two new parameters for each model.info_dict
takes the parameter name and a lambda function to run on each model.5.
info_dict
prints after theR-squared
summary which I did not like, so flip that around.The Future
Professor challenged me with submitting this to the statsmodel devs to integrate into a future feature. While that is done, who knows how long it will take for their approval. Until then you can copypasta this file and import the super-charged function. 🦸♂️ It has a few extra features to customize the appearance.
Beta Was this translation helpful? Give feedback.
All reactions