Performs a linear regression of one series vs. another.
LINREG2(yseries, xseries, info)
(s, slope, intercept, Se, report) = LINREG2( |
yseries, xseries, info) |
yseries |
- |
A series, the Y values. |
||||
xseries |
- |
A series, the X values. |
||||
info |
- |
Optional. An integer, the display fit statistics flag:
|
An XY series, the regression line in the form
(s, slope, intercept, Se, report) = LINREG2(yseries, xseries, info) returns the regression line, slope, intercept, standard error and regression equation in separate variables.
W1: gsin(25, .01)
W2: linreg2(3*W1 - 1, W1, 1)
displays y = 3.000x + -1.000, Standard error = 0.0 in a message box and after the OK button is pressed, plots the line that best fits the data.
linreg2(3*W1 – 1, W1)
plots the line that best fits the data, immediately.
W1: xy(gsin(10,.01, 4, pi), 1..10)
W2: linreg2(yvals(W1), xvals(W1));overp(W1, lred)
W2 contains the XY regression line with the original XY data overplotted in red.
The Y values of each series are used to make an XY plot. The line generated is the least squares fit to the XY data.
Argument order affects line generated.
The X values of the resulting regression line are the same as xseries.
The length of the shorter series determines number of points to be used and the length of the generated line.
See PFIT to fit a polynomial with error statistics.
See LINFIT to fit linear combination of arbitrary basis functions to a series using the method of least squares.
See PEARSON to return the correlation coefficient.