PriorContext#
- class cultivars.bayes.priors.PriorContext(*, k_endog, order, scales, presample_mean, k_exog=0, n_deterministic=1, include_constant=True)[source]#
What a prior needs to know about the sample before it can state itself.
Built once by the estimator and read by every prior in a stack, so two priors cannot disagree about the design’s column order or a variable’s scale. Everything here comes from the data or the specification; nothing comes from the prior.
- Variables:
k_endog (
int) – Number of modelled variables.order (
int) – Autoregressive order.scales (
NDArray[double]) – Per-variable residual scale, from_minnesota_scales()in_core.presample_mean (
NDArray[double]) – Mean of the firstorderobservations, which the sum-of-coefficients restriction is centred on.k_exog (
int) – Exogenous regressors carried after the lag block.n_deterministic (
int) – Width of the leading deterministic block, which is a count rather than a flag because families disagree about it: none for a trendless specification, one for a constant, two for a constant and trend, and one per unit for a fixed-effects panel. A boolean would have been silently one column short for every"ct"model and off byN - 1for every panel, and a prior whose columns do not line up with the design is inert at the limits while still looking plausible in between – which is worse than being wrong loudly.include_constant (
bool) – Whether the design carries a leading intercept column. Dummy columns must match the design’s own ordering, and a prior that guesses wrong is inert at the limits while still looking plausible in between – which is worse than being wrong loudly.
Note
Construction is keyword-only and validates nothing: the arrays are not checked against
k_endogand the counts are not checked for sign. Because two fields are arrays,==between contexts raisesValueErrorandhashraisesTypeError.include_constantis carried but not consulted. Every prior in the package places its columns fromn_deterministicalone, and nothing checks that the two fields agree.See also
PriorContext– the public name of this class._BayesianVectorAutoRegressionModel._prior_context()– returns an instance._ExogenousVectorAutoRegressionModel._prior_context()– returns an instance._ExogenousVectorErrorCorrectionModel._prior_context()– returns an instance._FunctionalCoefficientVectorAutoRegressionModel._prior_context()– returns an instance.
Example
A bivariate VAR(2) with a constant has five design columns, one deterministic column ahead of four lag columns:
Attributes#
Number of modelled variables \(k\), which is also the number of equations. |
|
Autoregressive order |
|
Per-variable residual standard deviation \(s_i\), shape |
|
Mean of the first |
|
Number of exogenous regressors, whose columns follow the lag block. |
|
Width of the deterministic block that leads the design. |
|
Whether the design carries a leading intercept column. |
|
Design columns ahead of the endogenous lag block. |
|
Design columns a prior's blocks must match. |