Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (EternallyCurious, Quad, vicknick), 700 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Interpretation of the var[8] coefficents stored by polyfit #444133
07/31/14 02:33
07/31/14 02:33
Joined: Sep 2013
Posts: 504
California
G
GPEngine Offline OP
User
GPEngine  Offline OP
User
G

Joined: Sep 2013
Posts: 504
California
polyfit (var* coeff, vars Data, int TimePeriod, int order, var weight) : var
takes
"coeff A var[8] array for storing the calculated polynom coefficients,"
and modifies it

But what is the sense of the 8 values I wonder. My guess is that 0 is the y-intercept, 1 is the coefficient for the x term, 2 is the coefficient for the x^2 term, etc. Is that correct?
Can you please document this?

Re: Interpretation of the var[8] coefficents stored by polyfit [Re: GPEngine] #444136
07/31/14 06:12
07/31/14 06:12
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
Yes, that is correct. For looking up the meaning of the mathematical terms in the manual, Wikipedia is a good source. There you'll often also find the algorithms.

Re: Interpretation of the var[8] coefficents stored by polyfit [Re: jcl] #444159
08/01/14 03:42
08/01/14 03:42
Joined: Sep 2013
Posts: 504
California
G
GPEngine Offline OP
User
GPEngine  Offline OP
User
G

Joined: Sep 2013
Posts: 504
California
Wikipedia will not tell you what order your polyfit method populates the coeff array .

Re: Interpretation of the var[8] coefficents stored by polyfit [Re: GPEngine] #444160
08/01/14 06:34
08/01/14 06:34
Joined: Jul 2000
Posts: 27,982
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,982
Frankfurt
Ah, I see. It is populated from the start.

Re: Interpretation of the var[8] coefficents stored by polyfit [Re: jcl] #444183
08/01/14 14:19
08/01/14 14:19
Joined: Sep 2013
Posts: 504
California
G
GPEngine Offline OP
User
GPEngine  Offline OP
User
G

Joined: Sep 2013
Posts: 504
California
confused
no, i mean the order of the coefficients in the output array is a design choice that is not stated in the manual. It took some experiments, but I figured out that it is implemented like this:
1. the value of coeff[n] gets the coefficient for the x^n term.
2. for polyfits with degree < m, coeff[m] through coeff[8] are 0.

I'm just trying to help the next person save a few steps here.


I have a related observation about something tricky.
The independent variable, x, for the polyfit is the bar index. 0 is the current bar, and the sense of it is that bar index decreases with time. Therefore, the first coefficient which is commonly thought of as the slope, or m, will actually be negative for rising series.


Moderated by  Petra 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1