Specifying which category to treat as the base with 'statsmodels'

后端 未结 2 2310
鱼传尺愫
鱼传尺愫 2021-02-20 04:05

In understand that when I have a category variable in a model passed to a statsmodels fit that dummy variables will automatically be generated for the

2条回答
  •  攒了一身酷
    2021-02-20 04:48

    If you use single quotes to wrap your string, reference's argument needs to be wrapped with double quotes. Very easy mistake to make. I was using single quotes on both.

    For example:

    'y ~ C(Location, Treatment(reference="China"))'
    

    is correct.

    'y ~ C(Location, Treatment(reference='China'))'
    

    is not correct.

提交回复
热议问题