# How do you compute the slope for weighted least squares? [duplicate]

You can compute the slope of linear regression (without weights) by:

cor(x, y) * sd(y) / sd(x)

If we have add weights (w) in here as well - how do you compute the slope then?

• Basically, you in general form you can use ordinary least squares, and with weights, you can use the weighted form, is this what you ask, or is it if you can use correlations and variances for this? – Tim Jul 26 '19 at 17:01
• The duplicate threads were discovered by inspecting the highest-voted relevant hits in the search stats.stackexchange.com/…. Other hits may be of interest, too. – whuber Jul 26 '19 at 17:09