Returns a set of coefficients that represent the formula of the straight line which best fits the given data.
Syntax:
LINEST(known-ys:array|range, known-xs:array|range)
Calculates the formula of the straight line which best fits the data known-ys and known-xs arrays or ranges of cells, returning an array.
This function can be used to perform either simple linear regression, which works out the formula of the straight line graph plotted from known-xs and known-ys, or multiple linear regression, in which case there are multiple independent known-xs.
For simple linear regressions,
the result is an array of two values giving {c,m}
for the straight line fit
y = c + m⋅x
For multiple linear regression, with m independent known-xs,
the result is an array of m+1
values such that
y = a0 + ∑i=m ai⋅xi
where the xi are the independent x variables and ai is the (i+1)th element of the returned array.