Can anyone explain to me the math behind how this Trend Line Custom Factor works? I attached a notebook where I was trying to convince myself of the math, but I still don't quite understand
1) Why the X and Y matrices are made the way they are
2) Why dividing the dot product of X and Y by the variance is done
Thanks.