Skip to content

ENH: penalization for categorical exog #5407

Open

Description

@josef-pkt

penalizing categorical regressors

parking two references

Gertheiss, Jan, and Gerhard Tutz. 2009. “Penalized Regression with Ordinal Predictors.” International Statistical Review 77 (3): 345–65. https://doi.org/10.1111/j.1751-5823.2009.00088.x.
Tutz, Gerhard, and Jan Gertheiss. 2016. “Regularized Regression for Categorical Data:” Statistical Modelling, May. https://doi.org/10.1177/1471082X16642560.

AFAIR, I read the 2009 article carefully but didn't read the 2016 article (not downloaded before, and was after my time working on penalized in 2015)

#2882 penalization, shrinkage to subspace
#4038 SUMM overview issue
#4215 effect of pinv or ridge regularization for categorical variables

I used penalization of categorical variable, e.g. shrink to common value or common consecutive values, in notebooks. There should be more issues on this, especially also for helper functions for contrast/restriction matrices.
However, I didn't find a specific issue in a brief issue search.

It is easy to implement as a user with the available penalization classes, but we might be able to provide more automatic support, especially with the availability of factor information in patsy's design_info.
The idea might be that we can create restriction matrices similar to what I implemented for wald_test_pairwise for main effects.

one idea related to and in analogy to GAM:
In GAM with from_formula we could allow users to create the design matrix including the spline basis columns through the standard patsy formula. In that case we need some extra keywords that request the penalization of some terms.
We could do the same for factor variables, i.e. use standard from_formula but then add penalization for the parameters of categorical variables through an extra keyword.

But first step would be to write a standalone helper function that constructs the restriction matrix from a model of from the design_info. (And users could feed that to a Penalized Model class)

Activity

  1. added this to the 0.11 milestone on Dec 5, 2018
  2. modified the milestones: 0.11, josef on Oct 5, 2019
  3. josef-pkt commented on Oct 7, 2025

    @josef-pkt
    MemberAuthor

    a newer reference
    I did not check what they are doing.
    Then main article has only a one-way regressor. The online appendix has mixed regressors, standard regressors and one penalized one-way regressor.

    Heiler, Phillip, and Jana Mareckova. 2021. “Shrinkage for Categorical Regressors.” Journal of Econometrics 223 (1): 161–89. https://doi.org/10.1016/j.jeconom.2020.07.051.

    They only cite a newer article by Tutz and a coauthor, not the two articles that I have above.
    Tutz, Gerhard, and Margret-Ruth Oelker. 2017. “Modelling Clustered Heterogeneity: Fixed Effects, Random Effects and Mixtures.” International Statistical Review 85 (2): 204–27. https://doi.org/10.1111/insr.12161.

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions