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$.
What do you know about the observations in $w$? Are those weights, that is, in $[0,1]$. Then why don't you just multiply your original $x$ by $w, getting $x'$, and then apply your original formula to $y$ and $x'$?