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

Added support methods for emmeans #454

Merged
merged 1 commit into from Apr 17, 2024
Merged

Added support methods for emmeans #454

merged 1 commit into from Apr 17, 2024

Conversation

rvlenth
Copy link
Contributor

@rvlenth rvlenth commented Nov 21, 2023

Following-up on an emmeans user's suggestion. I have put together some support methods for the emmeans package. With it set up as provided, these methods will be registered when fixest is loaded, provided that emmeans is installed.

The provided example uses the AER package. I just didn't want to do an example with the iris data, as it is so far afield of the kinds of applications we would want with fixest. I think your package would benefit from having at least a somewhat realistic econometric example dataset built-in.

There are some important notes in the ROxygen comments. Only the variables in the main model are considered in the reference grid created by emmeans -- no fixed effects nor instrumental variables. Your vcov and other optional arguments to vcov() are supported via optional arguments to emmeans(). And an important consideration: while the estimates of marginal means are correct, their standard errors and CIs are incorrect when we have fixed effects, because the EMMs involve the intercept for which we don't have variances and covariances; however, contrasts among EMMs are fine because the intercept is zeroed-out.

@lrberge
Copy link
Owner

lrberge commented Feb 6, 2024

Hi, this is a very neat PR, thanks for the effort. I'll try to review it in the coming weeks.

@ocolluphid
Copy link

+1 on getting this PR approved, would be useful to output pairwise contrasts using fixest models with emmeans (and with clustered SEs) :)

@lrberge lrberge merged commit 2cd4e20 into lrberge:master Apr 17, 2024
@lrberge
Copy link
Owner

lrberge commented Apr 17, 2024

Hi, I finally accepted the fact that I will never have the time to thoroughly review the PR so I just merged it as it is, and I didn't check it worked. Given your credentials I think I'm safe by assuming that it just works :-)
Very sorry for the long delay until reaching this state.

I think your package would benefit from having at least a somewhat realistic econometric example dataset built-in.

I agree the example is very far from the IV realm. It has one benefit however. By showing that the method gives results even for absurd data, it's a reminder that IVs are just a tool in the end, and causal statements can only be reached by other means than a simple regression. That said, 100% the examples should be improved.

Thanks for taking the time to write it.

@lrberge
Copy link
Owner

lrberge commented Apr 17, 2024

Sorry, on the IV I thought you made reference to:
https://lrberge.github.io/fixest/articles/fixest_walkthrough.html#instrumental-variables

I agree with the suggestion. At some point I'll find the time to add a new data set and drop the AER suggest.

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.

None yet

3 participants