In reply to Kevin Bai.

Please read "Visualize a weighted regression," if you haven't already.

Unweighted least-squares regression uses the "normal equations" (X`*X) beta = (X`*Y) and solves for the regression estimates, beta. Here X is the design matrix (including dummy variables for categorical effects) and Y is the vector of observed responses. If you use weights, you multiply the i_th row of X and Y by sqrt(w_i). In matrix form, the weighted normal equations are (X`*W*X) beta = (X`*W*Y), where W is the square matrix that has the weights on the diagonal.

There is no special treatment for categorical vs interval variables. Each categorical variable is represented by columns in the design matrix.

Notice that the multiplication factor is the square root of the weight, not the weight value itself.

Good luck in your research.