fixest_data function

Retrieves the data set used for a fixest estimation

Retrieves the data set used for a fixest estimation

Retrieves the original data set used to estimate a fixest or fixest_multi model. Note that this is the original data set and not the data used for the estimation (i.e. it can have more rows).

fixest_data(x, sample = "original")

Arguments

  • x: An object of class fixest or fixest_multi. For example obtained from feols or feglm.
  • sample: Either "original" (default) or "estimation". If equal to "original", it matches the original data set. If equal to "estimation", the rows of the data set returned matches the observations used for the estimation.

Returns

It returns a data.frame equal to the original data set used for the estimation, when the function was called.

If sample = "estimation", only the lines used for the estimation are returned.

In case of a fixest_multi object, it returns the data set of the first estimation object. So in that case it does not make sense to use sample = "estimation" since the samples may be inconsistent across the different estimations.

Examples

base = setNames(iris, c("y", "x1", "x2", "x3", "species")) base$y[1:5] = NA est = feols(y ~ x1 + x2, base) # the original data set head(fixest_data(est)) # the data set, with only the lines used for the estimation head(fixest_data(est, sample = "est"))