LINEST(known_ys,known_xs,affine,stats)
known_ys: vector of values of dependent variable
known_xs: array of values of independent variables, defaults to a single vector {1,…,n}
affine: if true, the model contains a constant term, defaults to true
stats: if true, some additional statistics are provided, defaults to false
This function returns an array with the first row giving the regression coefficients for the independent variables x_m, x_(m-1),…,x_2, x_1 followed by the y-intercept if affine is true.
If stats is true, the second row contains the corresponding standard errors of the regression coefficients.In this case, the third row contains the R^2 value and the standard error for the predicted value. The fourth row contains the observed F value and its degrees of freedom. Finally, the fifth row contains the regression sum of squares and the residual sum of squares.
If affine is false, R^2 is the uncentered version of the coefficient of determination; that is the proportion of the sum of squares explained by the model.
If the length of known_ys does not match the corresponding length of known_xs, this function returns a #NUM! error.