# variance for weighted least squares regression

$Y_i = \beta_0 + \beta_1 X_i + u_i, i = 1,2,\ldots,N$. Model is heteroskedastic. I am using an iterative version of weighted least squares, in which I iteratively perform weighted regression, then fit the resulting residuals using some nonparametric approach, and then get back to weighted regression and so on. Assuming that the process converges, yielding estimates $\hat{\beta}_0,\hat{\beta}_1$, how do I generate an estimate of their variances?

The regression estimates for a weighted regression model is $$\hat{\beta} = (X'WX)^{-1}X'WY$$
Now, $Var(\hat{\beta}) = (X'WX)^{-1}X'W Var(Y)W'X(X'WX)^{-1}$
Assuming $Var(u_i) = \sigma_i^2$ and $Cov(u_i,u_j)=0$ for $i\ne j$ $$Var(Y) = diag(\sigma_i^2)$$
You can use the below formulation to calculate the variance of the estimates,$$Var(\hat{\beta}) = (X'WX)^{-1}X'W diag(\sigma_i^2) W'X(X'WX)^{-1}$$