Skip to main content

Crate solow_graphics

Crate solow_graphics 

Source
Expand description

§solow-graphics

Statistical-graphics helpers that compute the data behind a plot and render it through the solow_viz SVG backend. Every routine returns both the rendered Figure and the computed arrays, so the numerics can be tested independently of the (intentionally un-pixel-exact) SVG output.

Provided:

  • ProbPlot / qqplot — theoretical vs. sample quantiles of a probability plot, plus the fitted reference line (QqLine).
  • plot_acf / plot_pacf — the (biased) autocorrelation and the Yule-Walker partial autocorrelation, with a white-noise confidence band.
  • plot_resid_fitted — a residuals-vs-fitted diagnostic scatter.
use solow_graphics::ProbPlot;
let data = [-1.2, 0.3, 0.1, 1.4, -0.7, 2.1, -0.2, 0.9];
let pp = ProbPlot::new(&data);
assert_eq!(pp.sample_quantiles().len(), data.len());
let line = pp.qqline_regression();
let svg = pp.qqplot().to_svg();
assert!(svg.starts_with("<svg"));
let _ = line.slope;

Structs§

AcfResult
Result of an autocorrelation/partial-autocorrelation computation.
Influence
Per-observation OLS influence diagnostics.
MosaicData
The normalized geometry behind a mosaic plot.
ProbPlot
A normal probability plot (Q-Q plot against the standard normal).
QqLine
The fitted reference line of a probability plot, y = slope * x + intercept, where x are the theoretical quantiles and y the sample quantiles.

Functions§

acf
The biased autocorrelation function for lags 0..=nlags.
conf_band
The symmetric white-noise confidence half-width z_{alpha/2} / sqrt(n).
influence_plot
Render an influence plot: externally studentized residual (y) versus leverage (x), with marker radius scaled by Cook’s distance.
mosaic
Render a mosaic plot of a 2-D contingency table counts (rows × columns).
pacf_yw
The Yule-Walker partial autocorrelation function (adjusted / unbiased autocovariances), lags 0..=nlags.
plot_acf
Compute the ACF and a (1 - alpha) white-noise confidence band, and render a stem-style plot. Returns the Figure and the AcfResult.
plot_fit
A plot_fit-style diagnostic: the observed response and the fitted values plotted against one regressor (column exog_idx of the design).
plot_pacf
Compute the (Yule-Walker) PACF and a (1 - alpha) white-noise confidence band, and render a stem-style plot. Returns the Figure and the AcfResult.
plot_regress_exog
A plot_regress_exog-style 2×2 diagnostic panel against one regressor.
plot_resid_fitted
A residuals-vs-fitted diagnostic. Takes the model’s fitted values and residuals, returns the rendered Figure (a zero-reference line is drawn at resid = 0).
qqplot
Convenience wrapper: build a ProbPlot and render its Q-Q plot.