I am trying to implement the FWL theorem for some sample data in Stata. This theorem tells us that given a multivariate regression of the form $y = \beta_{1}x_{1} + \beta_{2}x_{2} + \varepsilon$, the OLS estimator obtained by regressing $y$ on $\gamma_1$ where $\gamma_{1}$ are the residuals from the regression of $x_{1}$ on $x_{2}$ will be the same as the OLS estimator on $x_{1}$ from the multivariate regression.
I have been able to produce this result for the coefficient, but how can I find the correct standard errors for the OLS estimator from the partialled out regression? I understand that the issue has to do with the degrees of freedom when computing the new standard errors and I found a useful answer here, but this example requires that the independent and the dependent variables are both partialled out. Is there a way to find the correct standard errors when you only partial out the independent variables? In case it is useful, my Stata code to compute the standard errors in question is below:
sysuse auto2, clear
*compute the multivariate regression
regress price trunk headroom
*partialling out
regress headroom trunk
predict double resid_x2, resid
*the coefficient is the same in this case as in the multivariate regression, but the standard error is different
regress price resid_x2
*correcting for the degrees of freedom, this line should be equal to the standard
*error in the multivariate regression
display sqrt(73/71)*_se[resid_x2]
```