Skip to content

Collinearity checking bug in FEIV #236

@jiafengkevinchen

Description

@jiafengkevinchen

I think this line presumes that the IV model is just-identified. I get a dimension error when the system is over-identified.
https://github.com/s3alfisc/pyfixest/blob/c9cb184b34333c82cb11bec9e73e387efd63c170/pyfixest/feiv.py#L42C1-L43C1
len(self._collin_index) is 1 + dim(exogenous covariates) whereas the dimension of Z should be dim(exogenous instruments) + dim(exogenous covariates)

A hacky but working solution is to pad self._collin_index with Falses if the model is overidentified

if self._collin_index is not None:
    # TODO: this does not implement collinearity checking for the instruments
    collin_index_z = np.array([False] * (Z.shape[1] - len(self._collin_index)) + list(self._collin_index))
    self._Z = Z[:, ~collin_index_z]

I imagine something goes wrong if the instruments are collinear though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions