Open DWesl opened 4 years ago
Is there a way to get a stateful transform to operate on a categorical interaction term (e.g. drop_unused_interactions(A:B)
, drop_unused_interactions((A + B) ** 2)
, or drop_all_zero_columns((C(A, Treatment('b')) + B) ** 2)
)? That might be the easiest way to accomplish this if such a thing is possible.
I have an experiment design that does not include all combinations of its categorical variables, and ran into some difficulties getting a full-rank design matrix for
statsmodels
. I included a simplified version below.produces as output
I don't mind spending the time to find the representation that produces all-zero columns, but there doesn't seem to be a way within patsy to say "I know some of these columns are going to be all zeros" or "These columns will be linear dependent on others". Since some
statsmodels
functions require the formula information frompatsy.DesignInfo
objects, I wanted to see what could be done withinpatsy
.matthewwardrop/formulaic#19 is a related issue, with some discussion of how to generalize the "Reduced X" method in the script.