# Linear regression calculator

Two-dimensional linear regression of statistical data is done by the**method of least squares**. Enter the statistical data in the form of a pair of numbers, each pair is on a separate line. The first number is considered as X (each odd-numbered in the order), second as Y (each even-numbered in the order).

The output of the linear regression is coefficients

**A**and

**B**of the linear function f(x) = Ax + B, which approximates given 2D data by linear function (line). Least squares means that we minimize the sum of the squares of the errors made in the results of every point.

Also calculate

**coefficient of correlation**Pearson product-moment correlation coefficient (PPMCC or PCC or R) is a measure of the linear correlation (dependence) between two variables X and Y, giving a value between +1 and −1 inclusive, where 1 is total positive correlation, 0 is no correlation, and −1 is total negative correlation.

### How to enter data as frequency table?

Simple. First-type data elements (separated by spaces or commas etc) then type f: and further write frequency of each data item. Each element must have defined frequency that number of numbers before and after symbol f: must be equal. For example:1.1 2.5 3.99

f: 5 10 15

### How to enter data as cummulative frequency table?

Similar as frequency table, but instead f: type cf: in second line. For example:10 20 30 40 50 60 70 80

cf: 5 13 20 32 60 80 90 100

The cumulative frequency is calculated by adding each frequency from a frequency distribution table to the sum of its predecessors. The last value will always be equal to the total for all observations, since all frequencies will already have been added to the previous total.