fixest icon indicating copy to clipboard operation
fixest copied to clipboard

[Request] case.names

Open raffaem opened this issue 10 months ago • 1 comments

We are supposed to use obs to retrieve the cases used in estimation. See here, but the standard way would be to use case.names (see here).

Would it be possible to have an implementation of that function for fixest? See here for a proposal

raffaem avatar Jan 06 '25 10:01 raffaem

This can be done more simply:

fixest_data(x, sample = "estimation")

kylebutts avatar Feb 19 '25 17:02 kylebutts

Sorry, I didn't know about case.names! Well it feels like, since it's a stats method, it should be there (but what an unintuitive name!).

lrberge avatar Apr 17 '25 12:04 lrberge

I looked into this @lrberge and case.names does two things:

  1. when y is an unnamed vector, it is equivalent to obs(est).
  2. when y is a named vector, it is equivalent to names(y)[obs(est)]

I can PR if this if you would like? To match lm, it should really by as.character(obs(est)) but that seems silly to convert it to a character

kylebutts avatar Apr 17 '25 15:04 kylebutts

Well: since fixest does not accept vectors, the second case is not to be considered methinks.

Thanks Kyle, that would be great!

lrberge avatar Apr 17 '25 15:04 lrberge

Closed by https://github.com/lrberge/fixest/pull/560 if I'm not mistaken.

grantmcdermott avatar Apr 18 '25 16:04 grantmcdermott