Skip to content

Add German credit model - #349

Open
michalkamin wants to merge 6 commits into
stan-dev:developmentfrom
Uupali:german-credit
Open

michalkamin wants to merge 6 commits into
stan-dev:developmentfrom
Uupali:german-credit

Conversation

@michalkamin

@michalkamin michalkamin commented Nov 12, 2026 •

Copy link
Copy Markdown

Adds the German credit models from the NUTS paper (Hoffman & Gelman, 2014, Sections 4.1.2–4.1.3).

Data

  • german_credit: 1000 customers, 24 standardized numeric predictors.
  • german_credit_interactions: the same 24 main effects plus all 276 pairwise interactions (300 predictors).

Models

  • german_credit_lr: Bayesian logistic regression with $\mathcal{N}(0, 10^2)$ priors on the intercept and coefficients (25 parameters).
  • german_credit_hlr: hierarchical logistic regression, centered parameterization. The intercept and coefficients share a $\mathcal{N}(0, \sigma^2)$ prior, with $\sigma^2 \sim \text{Exponential}(0.01)$ (302 parameters).
  • german_credit_hlr_nc: the same hierarchical model with a non-centered parameterization ($\alpha = \sigma \cdot \alpha_\text{raw}, \beta = \sigma \cdot \beta_\text{raw}$). It implies the same posterior over ($\alpha, \beta, \sigma^2$).

Posteriors

  • german_credit-german_credit_lr
  • german_credit_interactions-german_credit_hlr
  • german_credit_interactions-german_credit_hlr_nc

Data generation

The data come from the UCI Statlog German credit file german.data-numeric. They are generated by data-raw/german_credit.py and data-raw/german_credit_interactions.py, which need only NumPy.

  • The response is coded y = 1 for good credit risk and 0 for bad.
  • Main effects are standardized to mean 0 and variance 1, using the population SD.
  • Interactions are products of the standardized main effects, for all pairs j < k, appended after the main effects. They are then re-standardized. No squared terms are included.

@michalkamin
michalkamin marked this pull request as ready for review November 13, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants