HierarchicalLinearRegression.fit#

HierarchicalLinearRegression.fit(X, Z, y, group_idx, coords=None, non_centered=True)[source]#

Draw posterior and predictive samples for hierarchical linear regression.

Parameters:
  • X (DataArray) – Fixed-effects design matrix with dims [obs_ind, coeffs].

  • Z (DataArray) – Random-effects design matrix with dims [obs_ind, random_coeffs].

  • y (DataArray) – Outcome matrix with dims [obs_ind, treated_units].

  • group_idx (ndarray) – Integer group index per observation.

  • coords (dict[str, Any] | None) – Coordinates used by PyMC dimensions.

  • non_centered (bool) – If True, use non-centered parameterization for group effects. If False, use centered parameterization.

Returns:

Posterior, prior predictive, and posterior predictive samples.

Return type:

az.InferenceData