**[MV] manova postestimation** -- Postestimation tools for manova

__Postestimation commands__

The following postestimation commands are of special interest after
**manova**:

Command Description
-------------------------------------------------------------------------
**manovatest** multivariate tests after **manova**
**screeplot** plot eigenvalues
-------------------------------------------------------------------------

The following standard postestimation commands are also available:

Command Description
-------------------------------------------------------------------------
**contrast** contrasts and ANOVA-style joint tests of estimates
**estat summarize** summary statistics for the estimation sample
**estat vce** variance-covariance matrix of the estimators (VCE)
**estimates** cataloging estimation results
**lincom** point estimates, standard errors, testing, and
inference for linear combinations of coefficients
**margins** marginal means, predictive margins, marginal effects,
and average marginal effects
**marginsplot** graph the results from margins (profile plots,
interaction plots, etc.)
**nlcom** point estimates, standard errors, testing, and
inference for nonlinear combinations of coefficients
**predict** predictions, residuals, and standard errors
**predictnl** point estimates, standard errors, testing, and
inference for generalized predictions
**pwcompare** pairwise comparisons of estimates
**test** Wald tests of simple and composite linear hypotheses
**testnl** Wald tests of nonlinear hypotheses
-------------------------------------------------------------------------

__Syntax for predict__

**predict** [*type*] *newvar* [*if*] [*in*] [**,** __eq__**uation(***eqno*[**,*** eqno*]**)** *statistic*]

*statistic* Description
-------------------------------------------------------------------------
Main
**xb** xb, fitted values; the default
**stdp** standard error of the fitted value
__r__**esiduals** residuals
__d__**ifference** difference between the linear predictions of two
equations
__stdd__**p** standard error of the fitted values for differences
-------------------------------------------------------------------------
These statistics are available both in and out of sample; type **predict**
*...* **if e(sample)** *...* if wanted only for the estimation sample.

__Menu for predict__

**Statistics > Postestimation**

__Description for predict__

**predict** creates a new variable containing predictions such as fitted
values, standard errors, residuals, and differences between the linear
predictions.

__Options for predict__

+------+
----+ Main +-------------------------------------------------------------

**equation(***eqno *[**,*** eqno*]**)** specifies the equation to which you are
referring.

**equation()** is filled in with one *eqno* for the **xb**, **stdp**, and **residuals**
options. **equation(#1)** would mean that the calculation is to be made
for the first equation (that is, for the first dependent variable),
**equation(#2)** would mean the second, and so on. You could also refer
to the equations by their names. **equation(income)** would refer to the
equation named income and **equation(hours)**, to the equation named
hours.

If you do not specify **equation()**, results are the same as if you had
specified **equation(#1)**.

**difference** and **stddp** refer to between-equations concepts. To use
these options, you must specify two equations, for example,
**equation(#1,#2)** or **equation(income,hours)**. When two equations must
be specified, **equation()** is required. With **equation(#1,#2)**,
**difference** computes the prediction of **equation(#1)** minus the
prediction of **equation(#2)**.

**xb**, the default, calculates the fitted values--the prediction of xb for
the specified equation.

**stdp** calculates the standard error of the prediction for the specified
equation (the standard error of the estimated expected value or mean
for the observation's covariate pattern). The standard error of the
prediction is also referred to as the standard error of the fitted
value.

**residuals** calculates the residuals.

**difference** calculates the difference between the linear predictions of
two equations in the system.

**stddp** calculates the standard error of the difference in linear
predictions (x_{1j}b - x_{2j}b) between equations 1 and 2.

For more information on using **predict** after multiple-equation estimation
commands, see **[R] predict**.

__Syntax for margins__

**margins** [*marginlist*] [**,** *options*]

**margins** [*marginlist*] **,** __pr__**edict(***statistic *...**)** [__pr__**edict(***statistic *...**)**
...] [*options*]

*statistic* Description
-------------------------------------------------------------------------
default linear predictions for each equation
**xb** linear prediction for a specified equation
__d__**ifference** difference between the linear predictions of two
equations
__r__**esiduals** not allowed with **margins**
**stdp** not allowed with **margins**
__stdd__**p** not allowed with **margins**
-------------------------------------------------------------------------
**xb** defaults to the first equation.

Statistics not allowed with **margins** are functions of stochastic
quantities other than **e(b)**.

For the full syntax, see **[R] margins**.

__Menu for margins__

**Statistics > Postestimation**

__Description for margins__

**margins** estimates margins of responses for linear predictions, fitted
values, and differences between the linear predictions.

__Syntax for manovatest__

**manovatest** *term* [*term ...*] [**/** *term* [*term ...*]] [**,**
__ytr__**ansform(***matname***)**]

**manovatest,** **test(***matname***)** [__ytr__**ansform(***matname***)**]

**manovatest** **,** __showord__**er**

where *term* is a term from the *termlist* in the previously run **manova**.

__Menu for manovatest__

**Statistics > Multivariate analysis >** **MANOVA, multivariate regression, and**
**related >** **Multivariate tests after MANOVA**

__Description for manovatest__

**manovatest** provides multivariate tests involving *term*s or linear
combinations of the underlying design matrix from the most recently fit
**manova**. The four multivariate test statistics are Wilks's lambda,
Pillai's trace, Lawley-Hotelling trace, and Roy's largest root. The
format of the output is similar to that shown by **manova**.

__Options for manovatest__

**ytransform(***matname***)** specifies a matrix for transforming the y variables
(the *depvarlist* from **manova**) as part of the test. The multivariate
tests are based on inv(A*E*A')*(A*H*A'). By default, A is the
identity matrix. **ytransform()** is how you specify an A matrix to be
used in the multivariate tests. Specifying **ytransform()** provides the
same results as first transforming the y variables with Y*A', where Y
is the matrix formed by binding the y variables by column and A is
the matrix stored in *matname*; then performing the **manova** on the
transformed y's; and finally running **manovatest** without **ytransform()**.

The number of columns of *matname* must equal the number of variables
in the *depvarlist* from **manova**. The number of rows must be less than
or equal to the number of variables in the *depvarlist* from **manova**.
*matname* should have columns in the same order as the *depvarlist* from
**manova**. The column and row names of *matname* are ignored.

When **ytransform()** is specified, a listing of the transformations is
presented before the table containing the multivariate tests. You
should examine this table to verify that you have applied the
transformation you desired.

**test(***matname***)** is required with the second syntax of **manovatest**. The rows
of *matname* specify linear combinations of the underlying design
matrix of the MANOVA that are to be jointly tested. The columns
correspond to the underlying design matrix (including the constant if
it has not been suppressed). The column and row names of *matname* are
ignored.

A listing of the constraints imposed by the **test()** option is
presented before the table containing the multivariate tests. You
should examine this table to verify that you have applied the linear
combinations you desired. Typing **manovatest, showorder** allows you to
examine the ordering of the columns for the design matrix from the
MANOVA.

**showorder** causes **manovatest** to list the definition of each column in the
design matrix. **showorder** is not allowed with any other option or
when *term*s are specified.

__Syntax for test__

In addition to the standard syntax of **test**, **test** after **manova** also allows
the following.

__te__**st,** **test(***matname***)** [__m__**test**[**(***opt***)**] **matvlc(***matname***)**] syntax A

__te__**st,** __showord__**er** syntax B

syntax A test expression involving the coefficients of the underlying
multivariate regression model; you provide information as a
matrix
syntax B show underlying order of design matrix, which is useful when
constructing the *matname* argument of the **test()** option

__Menu for test__

**Statistics > Multivariate analysis >** **MANOVA, multivariate regression, and**
**related > Wald test after MANOVA**

__Description for test__

In addition to the standard syntax of **test**, **test** after **manova** has two
additionally allowed syntaxes; see below. **test** performs Wald tests of
expressions involving the coefficients of the underlying regression
model. Simple and composite linear hypotheses are possible.

__Options for test__

+------+
----+ Main +-------------------------------------------------------------

**test(***matname***)** is required with syntax A of **test**. The rows of *matname*
specify linear combinations of the underlying design matrix of the
MANOVA that are to be jointly tested. The columns correspond to the
underlying design matrix (including the constant if it has not been
suppressed). The column and row names of *matname* are ignored.

A listing of the constraints imposed by the **test()** option is
presented before the table containing the tests. You should examine
this table to verify that you have applied the linear combinations
you desired. Typing **test, showorder** allows you to examine the
ordering of the columns for the design matrix from the MANOVA.

*matname* should have as many columns as the number of dependent
variables times the number of columns in the basic design matrix.
The design matrix is repeated for each dependent variable.

**showorder** causes **test** to list the definition of each column in the design
matrix. **showorder** is not allowed with any other option.

+---------+
----+ Options +----------------------------------------------------------

**mtest**[**(***opt***)**] specifies that tests be performed for each condition
separately. *opt* specifies the method for adjusting p-values for
multiple testing. Valid values for *opt* are

__b__**onferroni** Bonferroni's method
__h__**olm** Holm's method
__s__**idak** Sidak's method
__noadj__**ust** no adjustment is to be made

Specifying **mtest** without an argument is equivalent to specifying
**mtest(noadjust)**.

The following option is available with **test** after **manova** but is not shown
in the dialog box:

**matvlc(***matname***)**, a programmer's option, saves the variance-covariance
matrix of the linear combinations involved in the suite of tests.
For the test of H_0: L*b = c, what is returned in *matname* is L*V*L',
where V is the estimated variance-covariance matrix of b.

__Examples__

---------------------------------------------------------------------------
Setup
**. webuse metabolic**
**. manova y1 y2 = group**

Test group 1 versus groups 2, 3, and 4
**. manovatest, showorder**
**. matrix c1 = (3,-1,-1,-1,0)**
**. manovatest, test(c1)**

---------------------------------------------------------------------------
Setup
**. webuse sorghum**
**. manova time1 time2 time3 time4 time5 = variety block**
**. matrix m1 = J(1,5,1)**
**. matrix m2 = (1,-1,0,0,0 \ 1,0,-1,0,0 \ 1,0,0,-1,0 \** **1,0,0,0,-1)**
**. manovatest, showorder**
**. mat c1 =**
**(1,-1,0,0,0,0,0,0,0,0\1,0,-1,0,0,0,0,0,0,0\1,0,0,-1,0,0,0,0,0,0)**
**. matrix c2 = (.25,.25,.25,.25,.2,.2,.2,.2,.2,1)**

Test for equal variety marginal means
**. manovatest, test(c1) ytransform(m1)**

Test for equal time marginal means
**. manovatest, test(c2) ytransform(m2)**

Test variety by time interaction
**. manovatest, test(c1) ytransform(m2)**

---------------------------------------------------------------------------
Setup
**. webuse biochemical**
**. manova y1 y2 y3 = group c.x1 c.x2**

Test that the continuous covariates are jointly equal to zero
**. manovatest c.x1 c.x2**
--------------------------------------------------------------------------
Setup
**. webuse biochemical**
**. manova y1 y2 y3 = group c.x1 c.x2 group#c.x1 group#c.x2**

Test that the continuous covariates are jointly equal to zero across
groups
**. manovatest group#c.x1 group#c.x2**
---------------------------------------------------------------------------

Setup
**. webuse jaw**
**. manova y1 y2 y3 = gender fracture gender#fracture**

Compute the predicted mean (marginal mean), standard error, z statistic,
p-value, and confidence interval of **y1** for each combination of **fracture**
and **gender**
**. margins gender#fracture, predict(equation(y1))**

Contrast women with men for every fracture type and every dependent
variable
**. contrast gender@fracture#_eqns, mcompare(scheffe)**
---------------------------------------------------------------------------

__Stored results__

**manovatest** stores the following in **r()**:

Scalars
**r(df)** hypothesis degrees of freedom
**r(df_r)** residual degrees of freedom

Matrices
**r(H)** hypothesis SSCP matrix
**r(E)** residual-error SSCP matrix
**r(stat)** multivariate statistics
**r(eigvals)** eigenvalues of **E^-1H**
**r(aux)** **s**, **m**, and **n** values

**test** after **manova** stores the following in **r()**:

Scalars
**r(p)** two-sided p-value
**r(F)** F statistic
**r(df)** hypothesis degrees of freedom
**r(df_r)** residual degrees of freedom
**r(drop)** **0** if no constraints dropped, **1** otherwise
**r(dropped_***#***)** index of *#*th constraint dropped

Macros
**r(mtmethod)** method of adjustment for multiple testing

Matrices
**r(mtest)** multiple test results