# Multiple (binary) endogenous variable for separated subgroups

I want to specify an empirical model of home ownership like:
\begin{align} Y &= X'\beta+\sum_j \delta\cdot D_j + \gamma_1\cdot\lambda(X_1\cdot\theta)+\text{city_dummies}+u \\ D_j &= \phi_j\cdot z+\upsilon_j \end{align}

where $D(j)$ are binary endogenous variables indicating the strictness of restriction of immigrant admission in different cities；lambda is inverse mills ratio, $j=1,2,···J$. The first equation is structural and coefficients before $D$s are of interest, the second equation is the first stage estimation of 2sls. In summary,it's a 2sls specification with sample selection and multiple (binary) endogenous variables.

Now I have two questions:

The first one is on the setting of binary variables. Ideally, I believe it's more reasonable to conduct the first stage estimation separately in different subgroups, for instance, super cities, big cities and middle-sized cities. Of course, I can estimate the whole model separately，but then the sample size may become a problem for some subgroups. Moreover, except $D(j)$, I don't think other coefficient varies systematically across different cities, in other word, no slope heterogeneity. In the former stage, I generate dummies $D_j=1$ if household lives in a city of type $j$ and $=0$ otherwise and dummy immigrant_permit. In my Stata do file, I write my code like:

gen im_j=immigrant_permit*D_j
cmp (homeowner =income  im_1 ···im_j $head_char$household) /// *subsample*
(im_1= $exc_hukou$head_char_sele $household) /// *binary 2sls* ····· (im_j=$exc_hukou $head_char_sele$household) ///
(immigrant_history = $exc_immigrant$head_char_sele $household) /// *sample selection equation on full sample* if condition, /// indicators(immigrant_history*$cmp_probit $cmp_probit$cmp_probit \$cmp_probit) quietly


My question is that only for those household which both have the permit and actually immigrant to type j city, the im_j=1, otherwise im_j=0 even for those who live in other type cities and never move. This fact makes me uncomfortable. Alternatively, I make dummies D_j=1 if household lives in a city of type j and missing otherwise. Thus the estimation confined to subsample of people who actually lives in the type j cities (a word of notation, a permit make household access to a banch of social welfare, it's a special public policy in China, so household can live in a city without permit), but thus there is no overlapping sample across different im_j (im_j is missing for only one subgroup) and the estimation fails. So,what's the right way to conduct the first stage separately in a single equation (if it's possible)

I think I need to make my expression more clear, imagine I have four subgroups for immigrants:

1. immigrant household with permit live in type 1 city (D_1==1,im_permit==1)
2. immigrant household without permit live in type 1 city(D_1==1,im_permit==0)
3. immigrant household with permit live in type 2 city (D_2==1,im_permit==1)
4. immigrant household without permit live in type 2 city (D_2==1,im_permit==0).

Then according my original setting gen im_j=immigrant_permit*D_j , it's only for group(1) whose im_1 equals one, and for group(2) and group(3)-group(4) im_1 equals 0, does this make sense?

The second one is on model specification. There is a common confusion between heckman sample selection and selection bias as endogenity. Some previous thread had been presented to clarify this point, see endogeneity-versus-sample-selection-bias. In this model, I prefer the Heckman sample selection approach, above all, it's more clear: I have already have multiple endogenous variables. It's no way that I introduce a new one. But my coauthor suggested I should consider the selection bias as alternative choice. Is that a better choice?