jtools icon indicating copy to clipboard operation
jtools copied to clipboard

Integration with fixest models

Open mattysimonson opened this issue 2 years ago • 0 comments

The fixest package which came out last year has been a real boon to researchers using regression, and for the most part, it plays well with jtools (this is important because while fixest can make beautiful tables, it relies on base R for plotting which is a pain for those of us used to ggplot2). A key feature of fixest is that you can run multiple models at once (e.g., on a split sample, or swapping out different outcome variables with the same set of preditors). When you do this, the results get saved as a fixest_multi object, which, from what I can tell, appears to be a list of individual fixest model objects. The plot_summs function can handle individual fixest model objects just fine, but if they're stored in a fixest_multi, then you have to break them out manually:

modeling_3_outcomes <- fixest::feglm( c(support, favorability, trust) ~ income + gender + age, data = mydata) plot_summs(modeling_3_outcomes[[1]], modeling_3_outcomes[[2]], modeling_3_outcomes[[3]]

and realistically, you'd want to rename them after their DVs so the legend doesn't label each color as model 1, model 2, model 3:

plot_summs(support = modeling_3_outcomes[[1]], favorability = modeling_3_outcomes[[2]], trust = modeling_3_outcomes[[3]]

Ideally, I would be able to simply input plot_summs(my_fixest_multi) and plot_summs would unpack this list and extract the model names (e.g. the DV names) automatically.

There are probably other ways to make the integration of these two packages more seamless, but this is the first one that comes to mind, and it seems like reasonably low-hanging fruit to start with (at least the unpacking part is; less sure how easy it is to extract the DV names).

mattysimonson avatar Apr 11 '22 05:04 mattysimonson