Solved – Linear Regression Percentage Increase/Decrease

I am trying to find out a way to display the percentage increase or decrease to my customers using y = mx + b

[m] => -3.1817815606309E-9 [b] => 4509.1022466333 [r] => -0.60473807847473 [r2] => 0.36570814355731 

Some data:

x,y  1410375600000,21.91 1410379200000,21.99 1410382800000,21.41 1410386400000,22.18 1410390000000,22.65 1410393600000,22.01 1410397200000,21.27 1410400800000,21.13 1410404400000,21.92 1410408000000,22.40 1410411600000,22.08 1410422400000,21.86 1410426000000,22.29 1410429600000,22.27  x = time since epoch in milliseconds y = prices 

How do I find out the rate to which it's increase/decreasing? I have been playing with r2 * 100 and have been getting ok results with it but I am not sure I am doing this right.

Ultimately if my first values are around ~$25 and my last values around ~$20, I want 20% decrease as my answer.

thanks!

First off, this isn't a great model for predicting or understanding prices. I think you know that though, and you're just looking for SOMETHING to tell your customers, right?

m = rate of change in x per unit of y. So for each millisecond, price has decreased by 3.1817815606309E-9 dollars.

If you started at $25, and 30 days pass, you'd expect prices to decrease by $m * (1000*60*60*24*30)$ units. Or $8.247. $1 – (25-8.247)/25$ is a 33% decrease.

For a general formula for $d$ days, $P_0$ initial price: $1 – (P_0 -(m*(1000*60*60*24*d)))/P_0$.

Similar Posts:

Rate this post

Leave a Comment