I am using data which include a (sample-)weight for each observation, i.e. the data is from a survey that has weights to make the sample representative for the US-population. I perform OLS to get some coefficients and I am trying to estimate the error variance using the standard formula,

sigma_hat^2 = RSS/(n-p)

RSS = sum(w * (y-y_hat)^2)

Shall I use standardized weights (w=w/sum(1)) and then multiply RSS by (n/(n-p))?

How do I correctly estimate sigma_hat^2?

Thanks for your answers