How to calculate least-squares slope and intercept

Briefly

Use the linRegrSlope and linRegrIntercept functions.

These two functions take two attributes, the first is the independent (or explanatory) attribute. The second is the dependent (or response) attribute.

You can also read the slope and intercept of a least squares regression line directly from the plotted line in a scatter plot.