ess_model

ess_model(x_cov, assignments, y_mat, *, contrast=(1.0, -1.0))[source]

Model-based effective sample size of each assignment.

Within each group, the outcome is regressed on an intercept and x_cov. The contrast is estimated by regression imputation at the full-sample covariate mean b, with variance sum_g c_g^2 * s_g^2 * b' (B_g' B_g)^{-1} b, where s_g^2 is the group’s residual variance on n_g - p degrees of freedom.

Parameters:
  • x_cov (np.ndarray) – Covariates used in the outcome models, one row per unit.

  • assignments (np.ndarray) – Assignments to assess, one per row.

  • y_mat (np.ndarray) – Potential outcomes, one column per group in sorted label order.

  • contrast (Sequence[float]) – Coefficient for each group.

Returns:

ESS per assignment; the most precise assignment has ESS equal to N.

Return type:

np.ndarray