Statistics Calculator: Mean, Standard Deviation and Line of Best Fit

Mean, median, spread and range of a list of numbers, or a least-squares straight line through x and y pairs.

Calculated from standard textbook formulas, with every step shown. The formulas are fixed, so the working does not need checking: what matters is the numbers you type in. Use these calculators only if you are competent to choose the inputs (loads, material strength, dimensions, supports) and check your units and assumptions. For learning and checking your own working: design and sign-off are for a qualified engineer. Drafting Central does not store the numbers you type.

How this calculator works

Paste a list of readings, one per line. The calculator gives the count, mean, median, the sample and population standard deviations, and the range. Use the sample standard deviation (divide by n minus 1) for a sample of readings, and the population one (divide by n) when you have every value.

If each line has two numbers (x and y), it also fits the best straight line by least squares and gives R squared. A value near 1 means the points lie close to a line, but it does not prove the relationship is a line: always plot the points.

Formulas used

  • s = \sqrt{\frac{\sum (y_i - \bar y)^2}{n-1}}
  • m = \frac{\sum (x_i - \bar x)(y_i - \bar y)}{\sum (x_i - \bar x)^2}
  • c = \bar y - m\bar x

Worked example

With the default numbers in the calculator above:

  1. Count, mean: 5 values, mean 12.24
  2. Median: 12.2
  3. Sample standard deviation: 0.27019
  4. Population standard deviation: 0.24166
  5. Smallest, largest and range: 0.7

Change the numbers in the calculator to see the full working, every step, for your own case.

Common questions

Sample or population standard deviation?

Sample if your numbers are a sample of a larger set of readings (the usual case). Population if they are all of them.

What does R squared tell me?

How much of the scatter of y is explained by the straight line. 1 is a perfect line.

How many numbers can I enter?

Up to 500 lines.

Related calculators

Further reading: Montgomery and Runger, Applied Statistics and Probability for Engineers.

Need a calculator we do not have?

Tell us what you would like to calculate. We read every request and build the most asked-for ones.

We store your request (and your email if you give it) to decide what to build. We do not store the numbers you type into calculators.

Embed this calculator on your own page

Copy this code into your page. The calculator runs inside the frame and links back to Drafting Central.

Need this drawn, designed or checked?

Drafting Central is a mechanical engineering and drafting business in Burleigh Waters on the Gold Coast. A calculator gives you the numbers; we can turn them into drawings and designs.

Need help with a real project?

Talk to Drafting Central →

← All engineering calculators