Skip to main content

Crate solow_summary

Crate solow_summary 

Source
Expand description

§solow-summary

Labeled regression-results summary tables for Solow models – the rendered, human-readable companion to a fitted model’s numeric results.

The crate is deliberately model-agnostic: a RegressionSummary is built from plain values (parameter names, estimates, standard errors, test statistics, p-values, confidence intervals, and a set of header statistics), so the results of any estimator can be rendered without this crate depending on that estimator’s crate.

§Layout

A summary renders as two stacked fixed-width text blocks:

  1. a header block of key statistics, and
  2. a coefficient table with columns coef, std err, the test statistic (t or z), the corresponding p-value, and the lower/upper confidence-interval bounds.

Both blocks are produced by the general SummaryTable type, which lays out titled, optionally-headered, row-based tables with right-aligned (or per-column left-aligned) fixed-width columns.

The visual layout here is Solow’s own. Only the displayed numbers are cross-checked against a reference implementation (see the crate’s tests/reference.rs).

§Example

use solow_summary::{HeaderStats, RegressionSummary};

let names = ["const", "x1"];
let params = [1.5, -2.0];
let bse = [0.07, 0.08];
let tvalues = [21.4, -25.0];
let pvalues = [1e-20, 1e-22];
let conf_int = [(1.35, 1.65), (-2.16, -1.84)];

let header = HeaderStats {
    model: Some("OLS".into()),
    nobs: Some(40.0),
    rsquared: Some(0.95),
    aic: Some(45.9),
    bic: Some(51.0),
    ..HeaderStats::new()
};

let summary =
    RegressionSummary::new(&names, &params, &bse, &tvalues, &pvalues, &conf_int, header);
let text = summary.to_string();
assert!(text.contains("R-squared:"));
assert!(text.contains("const"));

Structs§

HeaderStats
Header statistics shown in the top block of the summary.
RegressionSummary
Builder for a labeled regression-results summary.
SummaryTable
A titled, fixed-width text table.

Enums§

Align
Horizontal alignment of a column’s cells.
StatKind
Whether the coefficient table reports a t statistic or a z statistic.

Functions§

format_fixed
Format a value with a fixed number of digits after the decimal point.
format_g
Format a value with prec significant figures, similar to the %g family but with a fixed number of significant digits and without an exponent unless the magnitude makes a plain decimal unwieldy.
format_pvalue
Format a p-value to three decimals, displaying 0.000 for values that are smaller than the displayed precision (rather than rounding artifacts).