Forecast
Description
Minimum Origin Version Required: 2019 SR0
This function performs linear regression on a group of XY data to calculate or predict Y at the given X value. The Y value is predicted as
:
where,
/math-82cf10eee6fa9feaacb137cff874409c.png)
/math-c75b87bb81a8a965731448ed99a28db3.png)
and
are the means of x and y.
Syntax
double Forecast( double x, vector vx, vector vy)
Parameters
x
- The x coordinate(s) for calculating y coordinate(s).
vx
- The source x coordinates used for linear regression.
vy
- The source y coordinates used for linear regression.
Return
Return the calculated or predicted y coordinate at specified x coordinate.
Example
newbook; worksheet -a 2; col(a)={0:0.5:10}; col(b)=10*col(a)-20*rnd(); col(c)={20:1:25}; col(d)=forecast(col(c),col(a),col(b));