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
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.
You can pass a reference
arg to the Treatment contrast, using syntax like
"y ~ C(Location, Treatment(reference='China'))"
http://patsy.readthedocs.org/en/latest/API-reference.html#patsy.Treatment
If you have a better suggestion for naming conventions please file an issue with patsy.