DADiSP Worksheet Functions > Function Categories > Curve Fitting > LINREG
Determines the least squares fit of a line to a series.
LINREG(series, info)
(s, slope, intercept, Se, report) = LINREG( |
series, info) |
series |
- |
A series or multi-column table. |
||||
info |
- |
Optional. An integer, the display fit statistics flag:
|
An interval (regularly spaced) series, the regression line in the form
(s, slope, intercept, Se, report) = LINREG(series, info) returns the regression line, slope, intercept, standard error and regression equation in separate variables.
linreg(gline(100, .01, 1.0, 1.0)^3, 1)
displays the slope and y-intercept of the regression line and after the OK button is pressed, plots the line that best fits the data.
linreg(gline(100, .01, 1.0, 1.0)^3)
Same as above, except the regression line is returned immediately without reporting.
If the input is an XY series, LINREG returns an XY series where the X values are the same as the X values of the input series. For example:
W1: xy(grand(10,1), grand(10,1))
W2: linreg(w1)
W2 contains an XY series.
See PFIT to fit a polynomial with error statistics.
See LINREG2 to fit a line to separate X and Y series.
See LFIT to fit a line using only the endpoints.
See LINFIT to fit linear combination of arbitrary basis functions to a series using the method of least squares.
See DETREND to remove a regression line or piecewise continuous regression line from a series.