Skip to content

Support "Background" Covariates for Gelbach Decomposition / .decompose() method #797

Open
@s3alfisc

Description

@s3alfisc

Good first issue

I've labeled this a "good first issue" because it shouldn't be too difficult to implement, still the changes are somewhat intricate and it is not necessarily a "quick win".

Context

Currently, we only support regression decompositions without any background covariates in the decompose class.

Hence, the short regression is always defined as depvar ~ param and it is not possible to always additionally control for any other variables.

In math, $X1$ always consists of an intercept and one additional covariate.

Image

We would like to allow users to add background variables always contained in $X1$.

To do so, we have to add an argument to Feols.decompose(), which we might call xfml. The decompose API might then look like this:

import pyfixest as pf 

fit = pf.feols("Y ~ X1 + X2 + C(f1)", data = pf.get_data())
fit.decompose(param = "X1", xfml = "X2")

Now, the "short" regression is defined as Y ~ X1 + X2 and the "long" regression becomes Y ~ X1 + X2 + C(f1).

Without providing a xfml argument, the short regression is

fit.decompose(param = "X1")

Y ~ X1 and the long regression as above.

To Do

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions