A method of estimating the parameters of a linear regression model when the covariance matrix is an unknown diagonal matrix is investigated. It is assumed that the observations fall into $k$ groups with constant error variance for a group. The estimation is carried out in two steps, the first step being an ordinary least squares regression. The least squares residuals are used to estimate the covariance matrix and the second step is the calculation of the generalized least squares estimator using the estimated covariance matrix. The large sample properties of the estimator are derived for increasing $k$, assuming the numbers in the groups form a fixed sequence.
"Estimation for a Linear Regression Model with Unknown Diagonal Covariance Matrix." Ann. Statist. 6 (5) 1149 - 1158, September, 1978. https://doi.org/10.1214/aos/1176344317