Skip to content

linest

Linear regression coefficients (with optional statistics).

v = linest(knownys, knownxs, const, stat)

Returns the slope and intercept of the least-squares fit — [slope, intercept]. With const = false, forces the intercept to zero. With stat = true, returns an array including standard errors, R², F-statistic, and degrees of freedom.

linest([2 4 6 8], [1 2 3 4]) % [2 0] slope, intercept
  • logest — Exponential regression coefficients.
  • trend — Linear-trend predictions.
  • slope — Slope of a linear regression line.
  • intercept — Y-intercept of a linear regression line.
  • rsq — Square of the Pearson correlation coefficient (R²).