Wls regression

How do we compute the weights in WLS regression? Step by step explanation would be really helpful.
After, we compute the weight then how to do we use it to run the regression?


Ambassador to the humans
It depends on why you're using WLS in the first place. Sometimes you're using it because each observation is actually an average and you want to account for the fact that each observation might have different sample sizes associated with it. Some methods dynamically compute the weights to account for something like heteroskedasticity.