Title

classifylasso —— Identify latent group structures via Classifier-Lasso.

Syntax

classifylasso
depvar [indepvars]
[if] [in] [, group() options]

Optimization [+]
group(numlist) specify the possible numbers of latent groups;
the default is group(2)

lambda(#) tuning parameter in the penalized least squares (PLS) objective function;
the default is lambda(0.5)

rho(#) constant multiplier of the tuning parameter in the BIC-type information criterion;
the default is rho(0.67)

tolerance(#) tolerance criterion for convergence in the iterative algorithm;
the default is tolerance(0.01)

maxiterations(#) maximum level of iterations in the iterative algorithm;
the default is maxiterations(20)

optimize_options control the optimize package;
optptol(#), optvtol(#), optnrtol(#), optmaxiter(#), optignorenrtol(string), opttechnique(string), optsingularHmethod(string)

Regression [+]
absorb(varlist) categorical variables that identify the fixed effects to be absorbed; the default is the panel (unit) variable by xtset

noabsorb suppress the fixed effects

vce(vcetype) vcetype may be ols (default),
robust, or cluster clustvar

dynamic conduct bias correction in dynamic models

Display [+]
notable suppress the estimation table

display_options control the display style

Description

classifylasso facalitates practitioners to identifiy latent group structures via Classifier-Lasso.
It simultaneously identifies and estimates unobserved parameter heterogeneity in
panel data models using penalized techniques.

classifylasso displays the group selection information and an estimation table.
Estimation results are stored in e() form.
Postestimation commands are allowed to generate new variables or to visualize more results.

Options

Optimization

group(numlist) specifies the possible numbers of latent groups.
The default is group(2).
When the group number is set to be 1, the regression degenerates to the conventional panel data estimation with common slope coefficients.

If more than one possible number is input, the best-fit number of groups will be determined by minimizing the information criterion.
The information criterion consists of the logarithm of min-squared error and a penalized term of the product of number of parameters and number of groups.

lambda(#) specifies the tuning parameter in the penalized least squares PLS objective function. The default is lambda(0.5).

The PLS objective function consists of the conventional least-squares function and a additive-multiplication penalized term.
Note that the lambda option controls the λ instead of λ_NT=λT^(-1/3) eq.(2.6) in Section 2.3 of Su, Shi, and Phillips (2016).

rho(#) specifies the constant multiplier of the tuning parameter in the BIC-type information
criterion.
The default is rho(0.67).

Note that the rho option controls the value of ρ instead of ρ_NT=ρ(NT)^(-1/2), according to Assumption A5* in Section 2.6 of Su, Shi, and Phillips (2016).

tolerance(#) specifies the tolerance criterion for convergence in the iterative algorithm.
The default is tolerance(0.01).

If the tolerance criterion is not tight enough, the iteration may not end in optimal estimation. On the other hand, if the tolerance criterion is too small, the iteration may be time-consuming. The
same comments suit the maxiterations(#) option.

maxiterations(#) specifies the maximum level of iterations in the iterative algorithm.
The default is maxiterations(20).

optimize_options control the optimize package;
see [M-5] optimize() for more details.

optptol(#), optvtol(#), optnrtol(#), optmaxiter(#), and optignorenrtol(string) determine the convergence criterion, whose parameters are transmitted to
optimize_init_conv_ptol(#), ... vtol(#), ... nrtol(#), ... maxiter(#), ... ignorenrtol(S, "off"|"on");
the default is 1e-6, 1e-7, 1e-5, 150, "off", respectively.

opttechnique(string) and optsingularHmethod(string) determine the optimization method,
whose parameters are transmitted to optimize_init_technique(S, "nr"|"dfp"|"bfgs"|"bhhh"|"nm") and ... optsingularHmethod(S, "m-marquardt"|"hybrid")
(S is the transmorphic defined in the command);
the default is "bfgs" and "m-marquardt", respectively.

Regression

absorb(varlist) specifies the categorical variables representing the the fixed effects to be absorbed. By default, the panel (unit) variable is absorbed.

noabsorb suppresses the fixed effects in the model.

vce(vcetype) specifies the type of standard error in post-Lasso estimation, which
includes types that are derived from asymptotic theory (ols, the default),
that are robust to some kinds of misspecification (robust), that allow
for intragroup correlation (cluster clustvar); see
[R] vce_option.
Moreover, a single robust option is the same as vce(robust), and a single cluster clustvar option is the same as vce(cluster clustvar).
Note that the standard error in C-Lasso estimation is always the default ols.

dynamic applies Dhaene and Jochmans's (2015) half-panel jackknife method to conduct
bias correction in dynamic models.
Meanwhile, the autocorrelation-and-heteroscedasticity consistent standard errors (HAC) will be the default of vce().

Display

notable suppresses the estimation table.

display_options: noci, nopvalues, noomitted, vsquish, noemptycells, baselevels, allbaselevels, nofvlabel,
fvwrap(#), fvwrapon(style), cformat(%fmt), pformat(%fmt), sformat(%fmt), and nolstretch;
see [R] Estimation options.

Examples

Setup

. use classifylasso.dta, clear

. xtset id t

Obtain selection and estimation results

. classifylasso y x1 x2, group(1/5)

Or obtain the estimation results without selection

. classifylasso y x1 x2, group(2)

Replication of Su, Shi and Phillips (2016). Note that it is time-consuming.

. use saving.dta, clear

. xtset code year

. classifylasso savings lagsavings cpi interest gdp, group(1/5) dynamic

Postestimation commands

The following postestimation commands are available after classifylasso:

Command Description

classoselect select an alternative estimation result

predict predict group membership and fitted values

estimates replay redisplay the estimation results

classocoef plot the coefficients

classogroup plot the group selection information

The syntaxes for classoselect, predict and estimates replay are listed as follows:

classoselect [, options]

The selected estimation result is used by predict, estimates replay and classocoef
By default, post-Lasso coefficients with the BIC-best number of groups are selected

group(#) use coefficients estimated under certain number of groups

postselection use postselection (unpenalized) coefficients

penalized use penalized coefficients

predict newvar
[if] [in] [, statistic]

For each group, suppose y = xb + d_absorbvars + e; see reghdfe for details

statistic

gid group membership; the default

xb xb fitted values

xbd xb + d_absorbvars

d d_absorbvars

residuals residuals

stdp standard error of the prediction (of the xb component)

estimates replay [, options]

outreg2(filename) export the tables one group a column; require outreg2 installed

display_options control the display style

For more details, please link to the corresponding help file.

Stored results

classifylasso stores the following in e():

Scalars

e(obs) sample size

e(N) number of individual units

e(group) active number of groups

Macros

e(title) Classifier-Lasso

e(cmd) classifylasso

e(predict) classifylasso_p

e(cmdline) command as typed

e(panelvar) name of panel variable

e(timevar) name of time variable

e(depvar) name of dependent variable

e(indepvar) name of independent variables

e(absvar) name of the absorbed variables

e(grouplist) possible group number list

e(coef) active coefficients, postselection or penalized

Matrices

e(a_classo_GK) C-Lasso coefficient matrix under K groups

e(V_classo_GK) C-Lasso covariance matrix under K groups

e(rsq_classo_GK) C-Lasso R-squared under K groups

e(a_post_GK) post-Lasso coefficient matrix under K groups

e(V_post_GK) post-Lasso covariance matrix under K groups

e(rsq_post_GK) post-Lasso R-squared under K groups

e(df_GK) degrees of freedom under K groups

e(id) group membership and individual information matrix

e(selection) selection information matrix

Functions

e(sample) marks estimation sample

For the ereturn matrices, K can be any number specified by group(numlist). Let N, p, and nK be the number of individuals, independent variables, and length of group(numlist):

e(a_classo_GK) and e(a_post_GK) are K×p matrices with each row representing a coefficient vector of one group;
e(V_classo_GK) and e(V_post_GK) are Kp×p matrices with each p×p matrix representing a covariance matrix of one group.
e(rsq_classo_GK) and e(rsq_post_GK) are K×5 matrices with each row representing R-sq., Adj R-sq., Within R-sq., Adj Within R-sq., and RMSE of one group.
e(df_GK) are K×6 matrices with each row representing various degrees of freedom of one group.

e(id) is a N×(p+nK+2) matrix with each row reporting the id, group membership under different groups,
the time-series estimations, and number of observations.
e(selection) is a nK×6 matrix with each row representing one selection with the
group number, information criterion, logarithm mean square error, number of iterations, maximum iteration, and computation time.

References

The program is designed by

Wenxin Huang, Yiru Wang, and Lingyun Zhou. "Identifying latent structures in panel data: the classifylasso command". Accepted at the Stata Journal.

For the rationale behind Classifier-Lasso, see

Liangjun Su, Zhentao Shi, and Peter C.B. Phillips. "Identifying latent structures in panel data". Econometrica 84.6 (2016): 2215-2264. [link]

Additional references:

Geert Dhaene and Koen Jochmans. "Split-panel jackknife estimation of fixed-effect models". The Review of Economic Studies 82.3 (2015): 991-1030.
[link]

Compatibility and known issues

Please ensure the following information before running the classifylasso program:

. The programs are written in version 17.0.

. The following files are required: classifylasso.ado and classifylasso.mata, classifylasso_p.ado classoselect.ado, classocoef.ado, and classogroup.ado.

. Commands reghdfe and ftools are pre-installed.

. Panel structure is declared: tsset or xtset panelvar timevar.

Author

Wenxin HUANG

Antai College of Economics and Management, Shanghai Jiao Tong University.

Yiru WANG

Department of Economics, University of Pittsburgh.

Lingyun ZHOU

PBC School of Finance, Tsinghua University.