ETWFERegression.build_model#
- ETWFERegression.build_model(X, y, coords, *, unit_idx, time_idx, cohort_idx, ev_idx, effect_indicator, att_weights, dbar_unit=None, dbar_time=None, conditioning='mundlak')[source]#
Define the ETWFE PyMC model.
- Parameters:
X (
DataArray) – Covariates with dims["obs_ind", "coeffs"]. May have zero columns, in which case noXdata node and nobetavariable are created.y (
DataArray) – Outcome with dims["obs_ind", "treated_units"].coords (
dict[str,Any]) – Must supplyobs_ind,treated_units,units,periods,cohortsandev; pluscoeffswhenXhas columns.unit_idx (
ndarray) – Integer position arrays of lengthn_obs, indexing into theunits,periods,cohortsandevcoordinates respectively. All must be non-negative.time_idx (
ndarray) – Integer position arrays of lengthn_obs, indexing into theunits,periods,cohortsandevcoordinates respectively. All must be non-negative.cohort_idx (
ndarray) – Integer position arrays of lengthn_obs, indexing into theunits,periods,cohortsandevcoordinates respectively. All must be non-negative.ev_idx (
ndarray) – Integer position arrays of lengthn_obs, indexing into theunits,periods,cohortsandevcoordinates respectively. All must be non-negative.effect_indicator (
ndarray) – Float array of lengthn_obs, 1.0 where the(cohort, event time)effect applies to that observation and 0.0 otherwise.att_weights (
ndarray) – Weight matrix of shape(n_cohorts, n_ev)summing to one over treated cells, used to aggregatetauintoatt.dbar_unit (
ndarray|None) – Mundlak treatment means of lengthn_obs. Required whenconditioning="mundlak". Should be centred by the caller.dbar_time (
ndarray|None) – Mundlak treatment means of lengthn_obs. Required whenconditioning="mundlak". Should be centred by the caller.conditioning (
Literal['dummy','mundlak']) – Which conditioning strategy to use for the two-way effects.
- Return type:
None