Skip to content
This repository was archived by the owner on Jul 15, 2025. It is now read-only.
/ stratifreg-code Public archive

A library for fitting regression and gmm models in stratified subsamples with continuity constraints, quantile and lasso.

Notifications You must be signed in to change notification settings

rpriam/stratifreg-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Stratified linear regression mixture models

Main classes

  • Joint2Regressor: Stratified multiple regression with continuity constraints for two (or K) groups.
  • JointKRegressor: Piecewise regression across K groups, with joint constraints, lasso and quantile.
  • Joint2GMMRegressor: EM algorithm for piecewise Gaussian mixture regression with constraints.
  • JointUtils: Utilities for group splitting, closest point to median finding, etc.

Key Features

  • Joint multi-group regression with continuity or custom constraints at the join point.
  • Supports quantile regression, penalized regression (lasso, ridge, elasticnet), and stratified GMM.
  • Stratified multivariate piecewise regression, not directly available in scikit-learn or statsmodels.

Note : This package is provided “as is” for reproducing results, even if not all features are fully
implemented or tested. For the moment the lasso and ridge includes the $\beta_0$, hence the eventual
intercept may be removed (centering $y_\ell$). The code development has involved the use of modern
tools, for code refactoring into classes, docstring writing, code cleaning, debugging.

Usage

pip install stratifreg

import stratifreg

from stratifreg import Joint2Regressor

Datasets

Name n p X y
D1 covid-19 4361 6 .csv .csv
D2 pre-diabet 3059 4 .csv .csv
D3 life-expectancy 2928 16 .csv .csv
D4 pisa-2009 5233 20 .csv .csv
D5 housing 20640 8 .csv .csv

To be added next

  • Smoother multi-points at joints
  • Optimal computation for the $x_o$
  • Statistical tests and variance
  • Model and variable selection
  • Full numpy implementation

References

  • Priam, R. (2025). Family of linear regression mixture models stratified along the outcome. hal-04179813v3

About

A library for fitting regression and gmm models in stratified subsamples with continuity constraints, quantile and lasso.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published