Skip to content

diagnostic test with categorical #1061

Open

Description

@josef-pkt

Many or most of the current diagnostic tests just follow a standard version that assumes continuous variables.

What happens if there are dummy variables, categorical variables with dummy coding.

example linear_lm

  • There is no non-linearity introduced if we take powers of a dummy variable.
    (0, 1)**2 = (0, 1)
  • The dof in the p-value calculation will (?) be wrong if the added variables are not linearly independent of the existing ones.

Note: for the second case: OLS already calculates the rank of exog, df_model, and the number of extra linearly independent variables that are added is just mod_large.df_model - mod_small.df_model

Need more unit tests against cases like these.

Also, this is not mentioned in the docstrings.


related: Instrument in GMM based on polynomials
We can use squares and products and higher polynomial terms to get an approximation to the efficient instruments. pinv wouldn't care much but the linear algebra (matrix inverses) might not work well if the matrices are singular.

possible solution: Use SVD/PCA dropping zero eigenvalues, similar to what pinv does. This will remove the redundant variables, the number of instruments is smaller, and we also don't count redundant variables when we just look at the array shape
This could just use the princomp PCA class, or the SVD version, it has been unused until now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions