How to perform linear regression on clusters of data Suppose I have 2 clusters of data: $\{(Y_{1i}, X_{1i})\}_{i=1}^{n_1}$ and $\{(Y_{2i}, X_{2i})\}_{i=1}^{n_2}$, and I'm interested in running a simple linear regression on each cluster.
I assume that
$$Y_{1i} = \beta_{10} + \beta_{11}X_{1i}+\epsilon_{1i}$$
$$Y_{2i} = \beta_{20} + \beta_{21}X_{2i}+\epsilon_{2i},$$
where $\epsilon_{1i}, \epsilon_{2i}$ have mean 0 given $X$. To estimate the intercept and slope coefficients, I can minimize the empirical squared error in the two clusters separately:
$$argmin_{\beta_{10}, \beta_{11}} \frac{1}{n_1}\sum_{i=1}^{n_1}(Y_{1i} - \beta_{10}-\beta_{11}X_{1i})^2$$
$$argmin_{\beta_{20}, \beta_{21}} \frac{1}{n_2}\sum_{i=1}^{n_2}(Y_{2i} - \beta_{20}-\beta_{21}X_{2i})^2$$
Now suppose I assume that the intercept and slope coefficients are identical between the two clusters, i.e.,  $\beta_{10} = \beta_{20} = \beta_0$ and $\beta_{11} = \beta_{21} = \beta_1$. Is this equivalent to running a single linear regression model on the pooled data? i.e., I would minimize:
$$argmin_{\beta_{0}, \beta_{1}} \frac{1}{n_1 + n_2}\sum_{i=1}^{n_1 + n_2}(Y_{i} - \beta_{0}-\beta_{1}X_{i})^2$$


Is this equivalent to running a single linear regression model on the pooled data?

You are already running pooled data when you apply the sum for a single cluster. The equation
$$Y_{1i} = \beta_{10} + \beta_{11}X_{1i}+\epsilon_{1i}$$
can be seen as $n_1$ different clusters
$$Y_{1,1} = \beta_{10} + \beta_{11}X_{1,1}+\epsilon_{1,1} \\
Y_{1,2} = \beta_{10} + \beta_{11}X_{1,2}+\epsilon_{1,2} \\
Y_{1,3} = \beta_{10} + \beta_{11}X_{1,3}+\epsilon_{1,3} \\
\vdots \\
\vdots \\
Y_{1,n_1} = \beta_{10} + \beta_{11}X_{1,n_1}+\epsilon_{1,n_1} \\$$
Now you have $n_1 + n_2$ different clusters
$$Y_{1,1} = \beta_{0} + \beta_{1}X_{1,1}+\epsilon_{1,1} \\
Y_{1,2} = \beta_{0} + \beta_{1}X_{1,2}+\epsilon_{1,2} \\
Y_{1,3} = \beta_{0} + \beta_{1}X_{1,3}+\epsilon_{1,3} \\
\vdots \\
\vdots \\
Y_{1,n} = \beta_{0} + \beta_{1}X_{1,n}+\epsilon_{1,n} \\ 
\, \\ 
Y_{2,1} = \beta_{0} + \beta_{1}X_{2,1}+\epsilon_{2,1} \\
Y_{2,2} = \beta_{0} + \beta_{1}X_{2,2}+\epsilon_{2,2} \\
Y_{2,3} = \beta_{0} + \beta_{1}X_{2,3}+\epsilon_{2,3} \\
\vdots \\
\vdots \\
Y_{2,n_2} = \beta_{0} + \beta_{1}X_{2,n_2}+\epsilon_{2,n_2} \\$$
If the $\epsilon_{1,i}$ and $\epsilon_{2,i}$ are independent and have the same distribution*, then this is equivalent to a single cluster of $n_1 + n_2$ variables.
However it is not equivalent when the $\epsilon_{1,i}$ and $\epsilon_{2,i}$ have a different distribution/variance. In this case, you will perform some sort of weighted sum.
See How to combine two measurements of the same quantity with different confidences in order to obtain a single value and confidence . With the method in that link, if the case is that we estimate the variances of the two pools as being equal (up to a scaling with factors $X^TX$, $n_1$ and $n_2$) then the method will be the same as running a single linear regression model.

*Or even less strict if they have the same variance. You might be thinking of least squares regression without the $\epsilon$ being normal distributed and just care about the variance.
