I'm working with some factor data from a third party company. Their factor model is estimated on a broad universe. I'm trying to re-estimate the model on a smaller subset (my own universe) to construct factor mimicking portfolios. Essentially, I want to find portfolios from within my universe that track their factor most closely. Let's begin with a factor model: ri,t=Xi,t1Ft+ηi,tr_{i,t} = X_{i, t-1}^{'} F_t + \eta_{i, t} with a k×1k \times 1 vector of factor returns FtF_t , or in matrix form: rt=Xt1Ft+ηt\mathbf{r}_t = \mathbf{X}_{t-1}F_t+\mathbf{\eta}_t . Now let's say I know my betas Xt1\mathbf{X}_{t-1} , and then I estimate factor returns with a weighted least squares scheme: F^t=argminF(rtXt1F)Wt(rtXt1F).\hat{\mathbf{F}}_t = \arg{\min_{\mathbf{F}}} (\mathbf{r}_t - \mathbf{X}_{t-1}\mathbf{F})'\mathbf{W}_t(\mathbf{r}_t - \mathbf{X}_{t-1}\mathbf{F}). Then I have the factor mimicking portfolios as (Xt1WtXt1)1Xt1Wt.(\mathbf{X}_{t-1}' \mathbf{W}_t \mathbf{X}_{t-1})^{-1} \mathbf{X}_{t-1}'\mathbf{W}_t. The problem that I'm having is that this matrix is ill conditioned, because in the factor model there is exact collinearity. For example, including a country factor along with industry factors (as my model does) leaves two independent variables with the value 1. As a result, an additional constraint is imposed so that industry weights sum to 0 instead of 1. I'm having trouble seeing how this gets incorporated into the solution. How can I find the normalization matrix Zt1\mathbf{Z}_{t-1} which incorporates this additional constraint and fixes the estimation? I.e. then we have Zt1(Xt1Zt1WtZt1Xt1)1Xt1Zt1Wt\mathbf{Z}_{t-1}(\mathbf{X}_{t-1}' \mathbf{Z}_{t-1}'\mathbf{W}_t \mathbf{Z}_{t-1} \mathbf{X}_{t-1})^{-1} \mathbf{X}_{t-1}' \mathbf{Z}_{t-1}'\mathbf{W}_t , i'm just not sure what to use for Zt1\mathbf{Z}_{t-1} . Thanks.