i. without the prefix -xi-


This blog (including the pile of books to read, the GRE reviewers to go through, the TV shows to watch…this list will never end) has been neglected for more than week. Anyway… here is i. .

i. is usually used with the -xi- prefix. But it may also be used without -xi-. i. allows you to include dummy variables for a categorical variable without explicitly generating new variables for each category.

For example:

sysuse auto, clear
reg price i.rep78

is the same as generating dummy variables for each of the n=5 categories of rep78 first and including n-1 of them in the regression:

sysuse auto, clear
tab rep78, gen(rep78_)
reg price rep78_2 rep78_3 rep78_4 rep78_5

By default, the category with the lowest value (in this case, n=1) is omitted. No new variables are generated using the command above. Without the -xi- prefix, however, the use of i. is limited to only one of the four possible dummy variable creation allowed with -xi-. With -xi-, it is possible to directly specify interactions. Also, with -xi-, it is possible to choose the omitted category. See –help xi-.

6 Responses

  1. I just want to forestall some possible questions and to expand on some passing comments, as some might get confused about the state of play.

    The factor variable notation was greatly expanded in Stata 11. -help fvvarlist-, amd most of what it discusses, is only available in Stata 11 (and up).

    -xi:- isn’t obsolete but it’s on its way out. However, it is the main machinery for getting indicators on the fly in Stata 10 (and recently). Of course, you can always create your own indicator variables directly.

  2. […] i. without the prefix -xi- […]

  3. I love the new i options in stata 11. You can actually set the reference category pretty easily. For example, if you have a three level categorical variable named var1, you could set the reference to the second level by referencing the variable as ib2.var1:

    logit dv ib2.var1

Leave a Reply