Inspect and save results
Examples use import kernelmix as km. See the tutorial for a complete analysis.
Fit results and diagnostics
BKMRFit stores data, samples, settings and sampling_info, with family,
exposure_names and covariate_names properties. Stored arrays are read-only;
extracted samples are independent copies.
| Method | Return and use |
|---|---|
fit.summary(probability=0.95) |
Text summary of parameter means, SDs, equal-tailed intervals, available posterior inclusion probabilities (PIPs) and diagnostic messages. |
fit.summary_table(probability=0.95) |
List of dictionaries with parameter, mean, sd, lower, upper. |
fit.posterior_samples(parameter=None, combine_chains=False) |
Dictionary of arrays, or one named parameter array. Leading axes are chain and retained draw; combining chains merges those axes. |
fit.inclusion_probabilities() |
Exposure names and PIPs for selection fits. Group fits also return group PIP and within-group conditional PIP; the conditional value is undefined (NaN) if a group was never selected. Raises without selection. |
fit.diagnostics() |
Parameter diagnostics and messages. Uses rank-normalized/folded split R-hat and bulk/tail effective sample sizes. |
fit.save(path) |
Save training data, settings and states in a compressed non-pickle archive. Replaces the destination atomically. |
km.BKMRFit.load(path, *, max_bytes=512 * 1024 * 1024) |
Load and validate an archive, limiting total uncompressed member size. |
km.diagnose(values) |
Diagnostics for one finite scalar-parameter array shaped (chains, draws). |
The reported intervals are equal-tailed: the posterior probability below the lower limit equals that above the upper limit. A PIP is the fraction of draws including an exposure or group. R-hat compares chains; bulk/tail effective sample sizes account for draw dependence in the distribution's center/tails.
Default-route saved parameters include beta, r, lambda, sigma2, delta and pi; its binary fits also retain ystar. Structured arrays are described in the structured guide. delta records exposure inclusion. beta includes the added intercept when fitted. No-selection fits store pi=1. Diagnostics cannot establish model validity; R-hat requires multiple chains and short or constant sequences can yield undefined diagnostics.