Examples gallery
A tour of the major models in Solow, each illustrated end to end: a small,
fully deterministic example dataset, the call that fits the model, the
printed results summary, and a rendered plot. Every page corresponds to a
runnable program in the solow-gallery crate, so you can reproduce any figure
and summary on your own machine.
The gallery is modeled on the canonical examples index of the reference Python statistics library: one self-contained vignette per modeling family.
Running the examples
The gallery lives in its own crate (crates/solow-gallery) that is not part
of the root workspace — it depends on the Solow crates by path. Run any example
by name:
cargo run --manifest-path crates/solow-gallery/Cargo.toml --bin ols
Each program prints its summary to standard output and writes its plot SVG into
docs/book/src/examples/img/, which is exactly where the images embedded on
these pages come from.
The examples
| Example | Model | Plot |
|---|---|---|
| Ordinary least squares | LinearModel::ols | scatter + fitted line |
| Weighted & generalized least squares | LinearModel::wls / gls | OLS vs WLS lines under heteroskedasticity |
| Generalized linear models | Glm (Poisson, Logit) | fitted mean / probability curves |
| Generalized additive models | GlmGam (penalized B-spline) | data with the fitted smooth curve |
| Generalized estimating equations | Gee (exchangeable) | clustered data with the marginal fit |
| Linear mixed effects | MixedLm (random intercepts) | grouped data with partial-pooling levels |
| Robust regression | Rlm (Huber's T) | OLS vs robust fit with outliers |
| Beta regression | BetaModel | (0,1) response with the fitted mean curve |
| Time series | acf / pacf / AutoReg / seasonal_decompose | ACF, PACF, AR fit, seasonal component |
| Forecasting service (case study) | AutoReg (+ backtest) | demand forecast with a 95% prediction band |
| Vector autoregression | Var | two series with an iterated forecast |
| State space & the Kalman filter | UnobservedComponents | observed series vs filtered state |
| Markov switching regimes | MarkovRegression | smoothed regime probability over time |
| Survival analysis | SurvfuncRight (Kaplan-Meier) | survival step function with bands |
| Copula dependence | ClaytonCopula | copula density over the unit square |
| Empirical likelihood | DescStat | −2 log-ELR profile with the χ² threshold |
| Principal component analysis | Pca | scree plot + PC1/PC2 scores |
| Q-Q plot diagnostics | ProbPlot | normal Q-Q plot with reference line |
| Multiple imputation | conditional_mean_impute / combine | imputation spread and the pooled estimate |
| Bayesian posterior | BayesMixedGlm (variational Bayes) | posterior means with credible bands |
| Optimizer convergence | minimize_bfgs / newton_stationary | gradient norm vs iteration (log scale) |
| The formula interface | solow_fit::ols / poisson | observed vs fitted |
Every figure on these pages is produced by solow-viz, Solow's dependency-light
SVG plotting backend.