```help fmm postestimation                                         also see:  fmm
-------------------------------------------------------------------------------

Title

fmm postestimation -- Postestimation tools for fmm

Description

The following postestimation commands are available for fmm:

command      description
-------------------------------------------------------------------------
INCLUDE help post_estat
INCLUDE help post_estimates
INCLUDE help post_lincom
INCLUDE help post_lrtest
INCLUDE help post_margins
INCLUDE help post_nlcom
predict      predictions including component probabilities
INCLUDE help post_test
INCLUDE help post_testnl
-------------------------------------------------------------------------

Syntax for predict

predict [type] newvar [if] [in] [, statistic equation(component#)]

statistic    Description
-------------------------------------------------------------------------
Main
mean       predicted mean; the default
prior      prior component probability
posterior  posterior component probability
-------------------------------------------------------------------------
Option equation(component#) is required for prior and posterior.  It is
also required for mean if predicted within-component means are desired.

INCLUDE help esample

Options for predict

mean, the default, calculates the predicted mean.

To obtain within component means, specify the equation(component#)
option.

prior calculates the prior component probabilities.  With prior,
equation(component#) must also be specified.

posterior calculates the posterior component probabilities.  With
posterior, equation(component#) must also be specified.

Marginal effects

Marginal effects can be calculated separately for the overall conditional
mean as well as for within-component means, prior and posterior
probabilities.  To calculate marginal effects for within-component means,
prior and posterior probabilities, run margins separately for each
component, as shown in the examples below. Note that fmm has not been
updated to accommodate factor variables.

Examples

Mixture of normals

. webuse womenwk, clear

. fmm wagefull educ age married, mix(normal) comp(2)

. predict wfhat

. predict wfhat1, eq(component1)

. predict wfhat2, eq(component2)

. predict wfhatpri, prior eq(component1)

. predict wfhatpos, posterior eq(component1)

. sum wagefull wfhat*

. drop wfhat*

Mixture of Negative Binomials (Type 2)

. webuse medpar, clear

. gen los0 = los - 1

. fmm exlos died hmo type2-type3, mix(negbin2) comp(2) comp(2)

. predict wfhat

. predict l0hat1, eq(component1)

. predict l0hat2, eq(component2)

. predict l0hatpri, prior eq(component1)

. predict l0hatpos, posterior eq(component1)

. sum los0 l0hat*

. drop l0hat*

. margins, dydx(*) predict(eq(component1))

. margins, dydx(*) predict(eq(component2))

. margins, dydx(*)

Also see

fmm; estimates, lincom, lrtest, margins, nlcom, predictnl, suest, test,
testnl
```