Skip to content

Commit 4640028

Browse files
authored
add an example for changing reference cateogy in regression with interaction term (#909)
1 parent a3236f6 commit 4640028

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/table-layout.qmd

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,20 @@ fit8 = pf.feols("Y ~ X1 + X2 + job*X2", data = data)
218218
219219
pf.etable([fit7, fit8], labels=labels, cat_template="{value}")
220220
```
221+
## Change reference category
222+
You can also change the reference category of a categorical variable using the `ref` argument in the interaction `i()` operator. For example, repeating the last estimation but changing the reference category to "Managerial" instead of "Admin":
221223

224+
```{python}
225+
226+
fit9 = pf.feols("Y ~ X1 + X2 + i(job,ref='Managerial') + i(job,X2,ref='Managerial')", data = data)
227+
228+
pf.etable([fit9], labels=labels, cat_template="{value}")
229+
```
230+
231+
Notice that this process will change the `_coefnames`. In this example, the new `_coefnames` are:
232+
```{python}
233+
fit9._coefnames
234+
```
222235

223236
## Custom model headlines
224237
You can also add custom headers for each model by passing a list of strings to the `model_headers` argument.

0 commit comments

Comments
 (0)