formulaic icon indicating copy to clipboard operation
formulaic copied to clipboard

Allow `Term` instances to control the naming of output columns in model matrices

Open matthewwardrop opened this issue 2 years ago • 2 comments

This allows Term subclasses to label model matrix columns differently based on context; e.g. if a column is a random effect column, then it might be labelled as: a|g rather than a:g.

matthewwardrop avatar Oct 17 '21 21:10 matthewwardrop

I want to request a similar feature for categorical variables.

Currently they get formatted as C({parameter})[T.{value}]. E.g.,

BinGrp = [0, 0, 0, 1, 1, 1]
becomes
   C(BinGrp)[T.0]  C(BinGrp)[T.1]
0               1               0
1               1               0
2               1               0
3               0               1
4               0               1
5               0               1

It would be nice if we could pass in a format string to get simplier names. E.g. BinGrp0, BinGrp1 if we pass in a format string like "{parameter}{value}"

hguturu avatar Sep 29 '23 20:09 hguturu

Hi @hguturu ! Thanks for reaching out! Let's move that to a separate issue, since this is requesting custom formatting via the formula expression itself, as compared to via the API as here. I'll let you do that and then continue the discussion there!

matthewwardrop avatar Sep 29 '23 20:09 matthewwardrop