make_sq_inter

make_sq_inter(data, *, is_square=True, is_inter=True, keep_marginal=True)[source]

Add squares and pairwise products of the columns of data.

Feeding these to fsm() balances second moments and interactions, which balancing the raw columns does not guarantee.

Parameters:
  • data (DataFrame) – Covariates.

  • is_square (bool) – Add col^2 for each column.

  • is_inter (bool) – Add a.b for each pair of columns.

  • keep_marginal (bool) – Keep the original columns first.

Returns:

Marginal columns, then interactions, then squares, each in input column order.

Raises:

ValueError – If every option is off, leaving nothing to return.

Return type:

DataFrame