MyCalCute
Install
Calculators / Math / Least-squares line from summaries

Least-squares line from summaries calculator

Fit a straight line using centred summary statistics rather than a list of observations.

On this page

Your result

Slope2
Intercept1

Calculator controls

How to calculate

Least-squares line from summariesThe fitted line is y = intercept + slope × x. The observation count documents the sample but does not alter these two coefficients once the centred sums and means are supplied. Concept diagram; not to scale.Least-squares line fromsummaries1Number of observations52Mean x33Slope2MyCalCute.com
The fitted line is y = intercept + slope × x. The observation count documents the sample but does not alter these two coefficients once the centred sums and means are supplied. Concept diagram; not to scale.

Fit a straight line using centred summary statistics rather than a list of observations.

Slope = xy/xx
Intercept = my-xy/xx*mx

Worked example

  • Number of observations: 5
  • Mean x: 3
  • Mean y: 7
  • Sum of squared x deviations: 10
  • Sum of x-y deviation products: 20
  • Slope: 2
  • Intercept: 1

Assumptions and limits

Use paired observations from one sample. The sums are centred, not raw sums of squares; uncertainty, significance and goodness of fit are not estimated.

Results are rounded for display; calculations use unrounded values. Read our calculation methodology.

Understanding the result

Fit a straight line using centred summary statistics rather than a list of observations. The fitted line is y = intercept + slope × x. The observation count documents the sample but does not alter these two coefficients once the centred sums and means are supplied.

When this tool is useful

The fitted line is y = intercept + slope × x. The observation count documents the sample but does not alter these two coefficients once the centred sums and means are supplied.

Understanding your inputs

InputExample
Number of observations n5
Mean x mx3
Mean y my7
Sum of squared x deviations xx10
Sum of x-y deviation products xy20

Frequently asked questions

What does this model leave out?

Use paired observations from one sample. The sums are centred, not raw sums of squares; uncertainty, significance and goodness of fit are not estimated.

How do I reproduce the example?

Enter the displayed example values in their labelled units. Apply the formula before rounding; change one input at a time to compare scenarios.