InstrumentalVariableRegression.build#

InstrumentalVariableRegression.build(X, Z, y, t, coords, priors, ppc_sampler=None, vs_prior_type=None, vs_hyperparams=None, binary_treatment=False)[source]#

Construct the IV graph without sampling.

Same signature as the historical fused fit; sampling now happens in sample_posterior(). Idempotent by skipping when the graph already exists.

Parameters:
  • X (ndarray) – Array used to predict the outcome y.

  • Z (ndarray) – Array used to predict the treatment variable t.

  • y (ndarray) – Focal outcome.

  • t (ndarray) – Treatment whose causal impact is being estimated.

  • coords (dict[str, Any]) – Coordinate names for the instruments and covariates.

  • priors (dict[str, Any]) – Prior specification dictionary forwarded to build_model().

  • ppc_sampler (Optional[Literal['jax', 'pymc']]) – Backend for posterior predictive sampling, applied at sample_posterior() time. "jax" requires JAX and None skips posterior-predictive sampling entirely.

  • vs_prior_type (Optional[Literal['spike_and_slab', 'horseshoe', 'normal']]) – Variable-selection prior type, forwarded to build_model().

  • vs_hyperparams (dict[str, Any] | None) – Hyperparameters for the variable-selection prior.

  • binary_treatment (bool) – Whether the treatment t is binary.

Raises:

RuntimeError – If the graph exists and the data arrays differ from those it was built with.

Return type:

None