Stata Technical Bulletin
17
estimates the model:
y = a' +c' wgt (continuous wgt effect)
+⅛ IaXwgt-2 + d''> IaXwgt-3 + d'4 IaXwgt-4 (agegrp*wgt interactions)
+u'
The predicted values of y are
agegrp*wgt model agegrp∣wgt model
y = a + c wgt |
a' + c' wgt |
if agegrp = 1 |
α + cwgt + b2 + d2 wgt |
a' + c'wgt ⅛ d'2 wgt |
if agegrp = 2 |
a + cwgt + b3+d3 wgt |
a' + c'wgt ⅛ d'3 wgt |
if agegrp = 3 |
a + c wgt ⅛ b4 + d4 wgt |
a' + c'wgt + d'4 wgt |
if agegrp = 4 |
That is, typing
. xi: regress y i.agegr*wgt
is equivalent t typing:
. xi: regress y i.agegr i.agegrIwgt
Also note that in either case, it is not necessary to specify separately the continuous variable wgt; it is included automatically.
Using ci: Interpreting output
. xi: regress mpg i.rep78
i.rep78 Irep78.1-5 (naturally coded; Irep78.1 omitted)
(output from regress appears)
Interpretation: i.rep78 expanded to the dummies Irep78.1, Irep78-2, ..., Irep78-5. The numbers on the end are “natural”
in the sense that Irep78_l corresponds to rep78 = 1, Irep78~2 to rep78 = 2, and so on. Finally, the dummy for rep78 = 1
was mitted.
. xi: regress mpg i.make
i.make Imake-l-74 (Imake-1 for make==AMC Concord omitted)
(output from regress appears)
Interpretation: i.make expanded to Imake_l, Imake_2, ..., Imake_74. The coding is not natural because make is a string
variable. Imake_l corresponds to one make, Imake~2 another, and so on. We can find out the coding by typing ‘describe’.
Imake_l for the AMC Concord was chosen to be omitted.
How xi names variables
The names xi assigns to the dummy variables it creates are of the form:
SsUbbg∣ouppdd
You may subsequently refer to the entire set of variables by typing ‘!stub*’. For example:
name = |
I + stub + _ + groupid |
Entire set | ||
Iagegr_l |
I |
agegr |
_ 1 |
Iagegr* |
I agegr _2 |
I |
agegr |
_ 2 |
Iagegr* |
IaXwgt-I |
I |
aXwgt |
_ 1 |
IaXwgt* |
IaXr-I _2 |
I |
aXr |
_ 1-2 |
IaXr* |
IaXr-2-l |
I |
aXr |
_ 2_1 |
IaXr* |
xi as a command rather than a command prefix
xi can be used as a command prefix or as a command by itself. In the latter form, xi merely creates the indicator and
interactin variables. Equivalent t typing,