Im using this formula to find the slope of the regression line of given $x,y$ samples using LS calculation :
$a=\frac{(n\sum xy-\sum x\sum y)}{(n\sum x^2-(\sum x)^2)}$
How do i change it to apply weightings?
In other words i want to recieve $x,y,w$ samples such that the importance of $x,y$ distance from the resulting line will be determined by $w$.