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:
- a header block of key statistics, and
- a coefficient table with columns
coef,std err, the test statistic (torz), 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, ¶ms, &bse, &tvalues, &pvalues, &conf_int, header);
let text = summary.to_string();
assert!(text.contains("R-squared:"));
assert!(text.contains("const"));Structs§
- Header
Stats - Header statistics shown in the top block of the summary.
- Regression
Summary - Builder for a labeled regression-results summary.
- Summary
Table - A titled, fixed-width text table.
Enums§
- Align
- Horizontal alignment of a column’s cells.
- Stat
Kind - Whether the coefficient table reports a
tstatistic or azstatistic.
Functions§
- format_
fixed - Format a value with a fixed number of digits after the decimal point.
- format_
g - Format a value with
precsignificant figures, similar to the%gfamily 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.000for values that are smaller than the displayed precision (rather than rounding artifacts).