1: \begin{abstract}
2: We develop new procedures to quantify the statistical uncertainty of %from sorting units in panel data into groups using
3: data-driven clustering algorithms. In our panel setting, each unit belongs to one of a finite number of latent groups with group-specific regression curves.
4: We propose methods for computing unit-wise and joint confidence sets for group membership. The unit-wise sets give possible group memberships for a given unit and the joint sets give possible vectors of group memberships for all units.
5: We also propose an algorithm that can improve the power of our procedures by detecting units that are easy to classify.
6: The confidence sets invert a test for group membership that is based on a characterization of the true group memberships by a system of moment inequalities.
7: To construct the joint confidence, we solve a high-dimensional testing problem that tests group membership simultaneously for all units. We justify this procedure under $N, T \to \infty$ asymptotics where we allow $T$ to be much smaller than $N$. As part of our theoretical arguments, we develop new simultaneous anti-concentration inequalities for the MAX and the QLR statistics.
8: Monte Carlo results indicate that our confidence sets have adequate coverage and are informative. We illustrate the practical relevance of our confidence sets in two applications.
9: \par
10: \vspace{4mm}
11: \textit{Keywords:} Panel data, grouped heterogeneity, clustering, confidence set, machine learning, moment inequalities, joint one-sided tests, self-normalized sums, high-dimensional CLT, anti-concentration for QLR
12: \par
13: \vspace{1mm}
14: \textit{JEL codes:} C23, C33, C38
15: \end{abstract}
16: