__Title__

**[P] anovadef** -- anova and manova term definition programming command

__Syntax__

**anovadef** [**,** **alt** | __showord__**er**]

__Description__

**anovadef** returns in **r()** a labeling of the coefficients from the last
**anova** or **manova**. It numbers the returned values in the same order they
are presented in the **e(b)** and **e(V)** matrices from the **anova** or **manova**.
This is helpful since the order of the coefficients in **e(b)** or in **e(V)** is
not always the same as the order specified in the **anova** or **manova**
command, and when the **anova** or **manova** was run under **version** less than 11,
the matrix row and column names are not meaningful.

For **manova**, the labeling for one equation is returned. This same
labeling applies to each of the equations. The equation names are
already attached to the **e(b)** and **e(V)** matrices, and so **anovadef** does not
return them.

__Options__

**alt** specifies an alternate way of returning the labeling information; see
remarks below.

**showorder** specifies that instead of executing silently, **anovadef** is to
display the design matrix column definitions and not return results
in **r()**. **showorder** may not be specified with **alt**.

__Remarks__

After the following **anova**

**. version 10: anova wei len rep*for len*for for rep*len rep**
**rep*len*for*gea,** **cont(gea len)**

**anovadef** without the **alt** option

**. anovadef**

produces results named **r(tid***#***)** where *#* goes from 1 to the number of
elements in **e(b)**. **tid** stands for "term id".

Here are a few of the **r()** items produced with the example above:

**r(tid1)** : "1"
**r(tid2)** : "length"
**r(tid3)** : "(foreign==0)"
**r(tid4)** : "(foreign==1)"
**r(tid5)** : "(rep78==1)"
**r(tid6)** : "(rep78==2)"
**r(tid7)** : "(rep78==3)"
**r(tid8)** : "(rep78==4)"
**r(tid9)** : "(rep78==5)"
**r(tid10)** : "(rep78==1)*(foreign==0)"
**r(tid11)** : "(rep78==2)*(foreign==0)"
**r(tid12)** : "(rep78==3)*(foreign==0)"
...
**r(tid29)** : "(rep78==4)*length*(foreign==0)*gear_ratio"
**r(tid30)** : "(rep78==4)*length*(foreign==1)*gear_ratio"
**r(tid31)** : "(rep78==5)*length*(foreign==0)*gear_ratio"
**r(tid32)** : "(rep78==5)*length*(foreign==1)*gear_ratio"

**r(tid1)** corresponds to the constant and is simply "1". This is how
**anovadef** indicates the constant.

**anovadef** with the **alt** option

**. anovadef, alt**

produces results named **r(tn***#***)** and **r(tl***#***)** where *#* goes from 1 to the
number of elements in **e(b)**. **tn** stands for "term names" and **tl** stands for
"term levels".

Here are a few of the **r()** items produced with the example above:

**r(tn1)** : "1"
**r(tl1)** : "c"
**r(tn2)** : "length"
**r(tl2)** : "c"
**r(tn3)** : "foreign"
**r(tl3)** : "0"
**r(tn4)** : "foreign"
**r(tl4)** : "1"
**r(tn5)** : "rep78"
**r(tl5)** : "1"
**r(tn6)** : "rep78"
**r(tl6)** : "2"
**r(tn7)** : "rep78"
**r(tl7)** : "3"
**r(tn8)** : "rep78"
**r(tl8)** : "4"
**r(tn9)** : "rep78"
**r(tl9)** : "5"
**r(tn10)** : "rep78 foreign"
**r(tl10)** : "1 0"
**r(tn11)** : "rep78 foreign"
**r(tl11)** : "2 0"
**r(tn12)** : "rep78 foreign"
**r(tl12)** : "3 0"
...
**r(tn29)** : "rep78 length foreign gear_ratio"
**r(tl29)** : "4 c 0 c"
**r(tn30)** : "rep78 length foreign gear_ratio"
**r(tl30)** : "4 c 1 c"
**r(tn31)** : "rep78 length foreign gear_ratio"
**r(tl31)** : "5 c 0 c"
**r(tn32)** : "rep78 length foreign gear_ratio"
**r(tl32)** : "5 c 1 c"

A **"c"** indicates that the corresponding term is a continuous variable. A
number indicates that it is a categorical variable.

**anovadef** with the **showorder** option displays the following output.

** . anovadef, showorder**

** Order of columns in the design matrix**
** 1: _cons**
** 2: length**
** 3: (foreign==0)**
** 4: (foreign==1)**
** 5: (rep78==1)**
** 6: (rep78==2)**
** 7: (rep78==3)**
** 8: (rep78==4)**
** 9: (rep78==5)**
** 10: (rep78==1)*(foreign==0)**
** 11: (rep78==2)*(foreign==0)**
** 12: (rep78==3)*(foreign==0)**
** 13: (rep78==3)*(foreign==1)**
** 14: (rep78==4)*(foreign==0)**
** 15: (rep78==4)*(foreign==1)**
** 16: (rep78==5)*(foreign==0)**
** 17: (rep78==5)*(foreign==1)**
** 18: (rep78==1)*length**
** 19: (rep78==2)*length**
** 20: (rep78==3)*length**
** 21: (rep78==4)*length**
** 22: (rep78==5)*length**
** 23: length*(foreign==0)**
** 24: length*(foreign==1)**
** 25: (rep78==1)*length*(foreign==0)*gear_ratio**
** 26: (rep78==2)*length*(foreign==0)*gear_ratio**
** 27: (rep78==3)*length*(foreign==0)*gear_ratio**
** 28: (rep78==3)*length*(foreign==1)*gear_ratio**
** 29: (rep78==4)*length*(foreign==0)*gear_ratio**
** 30: (rep78==4)*length*(foreign==1)*gear_ratio**
** 31: (rep78==5)*length*(foreign==0)*gear_ratio**
** 32: (rep78==5)*length*(foreign==1)*gear_ratio**