pymixef.results module

Stable backend-neutral fit result and archival format.

class pymixef.results.FitResult(model_ir, parameters, unconstrained_parameters, parameter_covariance, fitted_values, residuals, random_effects, objective, log_likelihood, method, engine, convergence, manifest, warnings=(), diagnostic_data=<factory>, extra=<factory>, result_schema_version='1.0.0')[source]

Bases: object

Result contract shared by frequentist, stochastic, and Bayesian engines.

Parameters:
  • model_ir (Any)

  • parameters (Mapping[str, float])

  • unconstrained_parameters (Mapping[str, float])

  • parameter_covariance (ndarray | None)

  • fitted_values (ndarray)

  • residuals (ndarray)

  • random_effects (Mapping[str, Any])

  • objective (float)

  • log_likelihood (float | None)

  • method (str)

  • engine (str)

  • convergence (ConvergenceReport)

  • manifest (RunManifest)

  • warnings (tuple[WarningRecord, ...])

  • diagnostic_data (Mapping[str, DiagnosticTable])

  • extra (Mapping[str, Any])

  • result_schema_version (str)

model_ir: Any
parameters: Mapping[str, float]
unconstrained_parameters: Mapping[str, float]
parameter_covariance: ndarray | None
fitted_values: ndarray
residuals: ndarray
random_effects: Mapping[str, Any]
objective: float
log_likelihood: float | None
method: str
engine: str
convergence: ConvergenceReport
manifest: RunManifest
warnings: tuple[WarningRecord, ...]
diagnostic_data: Mapping[str, DiagnosticTable]
extra: Mapping[str, Any]
result_schema_version: str
property success: bool

A compatibility convenience; inspect convergence for real detail.

property n_observations: int
prediction(*, mode='conditional')[source]

Return an explicitly named prediction mode for the analysis rows.

Parameters:

mode (str)

Return type:

ndarray

diagnostic(name)[source]
Parameters:

name (str)

Return type:

DiagnosticTable

residual_diagnostics(*, observed=None, variance=None)[source]
Parameters:
  • observed (Sequence[float] | None)

  • variance (Sequence[float] | float | None)

Return type:

DiagnosticTable

simulate(*, n_replicates=1, seed=None, parameter_uncertainty='none', random_effects=True, residual_error=True, output='numpy', design=None)[source]

Simulate from archived Gaussian calculations or a backend simulator.

The arguments follow PyMixEF’s public simulation contract. A backend may archive a callable simulator for an in-memory result, but archival reloads use the standardized Gaussian fallback only when its assumptions are explicit.

Parameters:
  • n_replicates (int)

  • seed (int | None)

  • parameter_uncertainty (str)

  • random_effects (bool)

  • residual_error (bool)

  • output (str)

  • design (Any)

Return type:

ndarray | DiagnosticTable

vpc(*, data=None, independent=None, bins='adaptive', prediction_corrected=False, simulations=1000, seed=None)[source]
Parameters:
  • data (Sequence[float] | None)

  • independent (Sequence[float] | None)

  • bins (str | int | Sequence[float])

  • prediction_corrected (bool)

  • simulations (int)

  • seed (int | None)

Return type:

DiagnosticTable

to_dict()[source]
Return type:

dict[str, Any]

save(path)[source]

Save the full result as versioned JSON; never pickle.

Parameters:

path (str | Path)

Return type:

Path

classmethod from_dict(value)[source]
Parameters:

value (Mapping[str, Any])

Return type:

FitResult

classmethod load(path, *, verify_integrity=True, require_sidecar=False)[source]

Load an archived result and verify its hash sidecar when available.

Legacy or externally produced JSON may omit the sidecar. Set require_sidecar=True when the calling workflow requires an integrity record. Integrity verification can be disabled only explicitly.

Parameters:
  • path (str | Path)

  • verify_integrity (bool)

  • require_sidecar (bool)

Return type:

FitResult

summary()[source]

Return a concise text summary separating estimates and convergence.

Return type:

str