2

In many cases calculating trend by using least-squares method is best decision. But sometimes it is overabundant. What I need is just to know, whether trend is positive or not. Can I use such approach (difference in weight coefficient) and how to determine it's approximation error?

($x_1*1$ + $x_2*2$ + ... + $x_n * n$) - ($x_1*n$ + $x_2*(n-1)$ + ... + $x_n * 1$)

Examples:

Negative

19  17  11  1  4  4  6  3  2  2    => -283

Positive

0  0  1  3  1  1  7  5  6  12      => 182

Update

Calculation using this approach and least-squares approach

enter image description here

1 Answers1

1

Hint- Write your suggested formula in vector form: $$\begin{align} w_1&=\pmatrix{1&2&\cdots&n}^T\\w_2&=\pmatrix{n&n-1&\cdots&1}^T\\ x&=\pmatrix{x_1&x_2&\cdots&x_n}^T\end{align}$$ Then you would get: $$\text{trend}=w_1^Tx-w_2^Tx=(w_1-w_2)^Tx$$ where $$(w_1-w_2)^T=\pmatrix{1&3&5&\cdots&2n-1}-\pmatrix{n&n&\cdots&n}$$ My impression is, this couldn't be reliable enough for seeing a trend.

polfosol
  • 9,245
  • I have taken about 5000 example data-sets from Database and made calculations using my rough approach and least-squares method. Interesting, that they have almost 100% correlation. Moreover roughFormula result divided by 165 equals least-squares method result. Sorry for my poor math, but I think it's very interesting. – Pavel Tkackenko Nov 22 '16 at 06:47
  • @PavelTkackenko As you see in the expression of $w_1-w_2$, the $\pmatrix{n&\cdots&n}$ is just a bias and can be ignored in trend detection. So you are left with $\pmatrix{1&\cdots& 2n-1}$. This weight vector doesn't look much beneficial over $w_1$. I suggest you just work with $w_1$ and not $w_1-w_2$ to see what I'm saying. – polfosol Nov 22 '16 at 08:05