Replication Package for “Identifying Latent Structures in Panel Data”

Computation Environment

We provide all code for the empirical applications and simulations in the paper. Please contact Zhentao Shi ( if you have any question about the code.

The results in the paper are generated under

CVX must be installed and linked with Matlab, and Mosek is invoked as the solver through the command cvx_solver mosek. Without Mosek, a user can still run the code with CVX if he comments out this line.

File Structure

The empirical applications can be exactly replicated by the commented master.m in folders

Data are also provided in each folder.

The workhorse scripts that execute the iterative algorithm in Section 3.1 of the Supplementary Material are

The scripts in folders simulations generate the simulation results. The master files are either master_** or **_super. Super parameters, such as N, T and Rep, should be provided outside of the main function or script.

Implementation Tips

As emphasized in Section 3.2 of the Supplementary Material, we take advantage of convex programming to reduce the computational burden of high-dimensional optimization in each substep of the iterative algorithm. It is straightforward to utilize the convexity in the linear models. Probit regression with a linear index is a convex problem. To implement in CVX, we must formulate it as a disciplined convex programming (, which CVX accepts.