*! version 1.0 31 Maj 2022
cwmglm Postestimation tools for cwmglm

Postestimation commands

cwmglm allows predict and cwmbootstrap.

Description for predict

predict creates group memberships based on the posterior probabilities or on the maximum a posteriori probabilities (MAP). The latter estimator assigns to the mixture component with the largest posterior probability.

Syntax for predict

predict have two alternate syntaxes

predict stub, posterior calculates posterior latent class probability. It creates a number of variables equal to the number of latent classes in the model. Each variable is named according to stub.

predict varname, map calculates a single variable containing MAP group memberships.

Description for cwmbootstrap

cwmbootstrap calculates bootstrap standard errors for the last cwm estimates in memory. cwmbootstrap uses returned results of cwmglm to obtain bootstrap standard errors for the following estimates:

e(b) coefficient vector of the glm

e(p_multi_#) probabilities of a each outcome for the xmultinomial variables

e(p_binomial) probabilities of a positive outcome for the xbinomial variables

e(lambda) mean of the xpoisson variables

e(mu) mean of the xnorm variables

Syntax for cwmbootstrap

cwmbootstrap , [reps(#)]

Optional
reps (#) Number of bootstrap replications. Default is 100

Returned results for cwmbootstrap

cwmbootstrap returns the following results:

r(b) inference table for e(b)

r(p_multi) inference table for e(p_multi_#)

r(p_binomial) inference table for e(p_binomial)

r(lambda) inference table for e(lambda)

r(mu) inference table for e(mu)

Description for cwmcompare

cwmbootstrap calculates AIC and BIC for nesting CWMs.

Syntax for cwmcompare

cwmbootstrap namelist

where namelist is a list of estimates calculated with cwmglm and saved using estimates store

Returned results for cwmcompare

cwmcompare returns the following results:

r(table) the information criteria table for the different estimates

r(bestAIC) the estimate name of the model with the minimum AIC

r(bestBIC) the estimate name of the model with the minimum BIC

Examples

Setup

. use students, clear

Mixture of regressions with random covariates, model VVV

. cwmglm weight height heightf, k(2) xnormal(height heightf) vvv

Predict posterior class memberships. Note that 2 variables are predicted: cluster1 and cluster2

. predict cluster, posterior

Predict MAP

. predict cluster, map

Bootstrap

. cwmbootstrap, nreps(1000)

Comparing a CWM and a finite mixture model

. cwmglm weight height heightf, k(2) xnormal(height heightf) vvv

. estimates store cwm

. cwmglm weight height heightf, k(2) vvv

. estimates store fmm

. cwmcompare cwm fmm

Authors

Daniele Spinelli, corresponding author (University of Milano-Bicocca, daniele.spinelli@unimib.it)

Salvatore Ingrassia (University of Catania, s.ingrassia@unict.it)

Giorgio Vittadini (University of Milano-Bicocca, giorgio.vittadinid@unimib.it)