 CURVE FITTING TOOL

# How to use Curve Fit Online Tool?

This is an online tool for curve fitting.
Usage:
1. Type X and Y values. You can add rows to the table by using the button below the table.
2. Choose fit method using the dropdown menu.
3. Results are generated automatically.

You can:
- export the report to PDF using "GENERATE PDF" button.
- export the report to TXT using "EXPORT TXT" button.
- manipulate diagram (for example zoom in or out)
- save diagram as PNG.

Contact: contact@softinery.com

Curve Fitter Documentation

# Fit methods

## Linear fit (linear regression calculator)

It is a type of statistical method used to find a linear relationship between two variables - independent and dependent one. This method is also called "simple linear regression". There is also multiple linear regression - when the linear relationship is to be found between more than one independent variables and one dependent variable.

The best-fitting line is obtained by minimizing the sum of the squared errors, that is differences between the predicted and the actual values. Chart of regression line fitted to data

The equation of regression line is:

$y = a + b \cdot x$

where:

a - intercept

b - slope

x - independent variable

y - dependent variable

You can use our tool as linear regression calculator by choosing "Linear fit" from the dropdown menu ("Choose fit method"). The calculator will automatically determine the regression equation with coefficients.

### How to calculate linear regression?

The regression coefficient b is given by:

$b=\frac{SS_{xy}}{SS_{xx}}=\frac{\sum_{i=1}^{n}(x_i-\bar{x})(y_i-\bar{y})}{\sum_{i=1}^{n}(x_i-\bar{x})^2}$

and a is calculated in terms of b as

$a=\bar{y}-b\bar{x}$

## Polynomial fit

The relationship between the independent variable x and the dependent variable y is in the form of an nth degree polynomial of x.

Polynomial regression can so be categorized as follows for n from one to three:

1. Linear – if degree is 1. The equation of fit curve is:

$y = a + b \cdot x$

1. Quadratic – if degree is 2. The equation of fit curve is:

$y = a_2 \cdot x^2 + a_1 \cdot x + a_0$

1. Cubic – if degree is 3. The equation of fit curve is:

$y = a_3 \cdot x^3 + a_2 \cdot x^2 + a_1 \cdot x + a_0$

and so on. The order of polynomial can be generally n. Illustration of 4th order polynomial fit

## Exponential fit

In exponential regression the following equation is used:

$y = a \cdot exp(b \cdot x)$

An exponential function is used to describe processes with rapid growth of decay of some quantity. Examples include growth of bacteria, radioactive decay, chemical reaction kinetics. Exponential fit illustration

## Power fit

The following function is used for the fitting:

$y = a \cdot x^b$

## Four parameters logistic regression

Four parameters logistic regression (4PL) is often used in modelling of many biological systems. As the result of fitting, S shaped curve is obtained. The formula used for fitting is following:

$y = d+\frac{a-d}{1+(\frac{x}{c})^{b}}$

where:

a - the minimum value that can be obtained (y at at x = 0)

b - Hill’s slope of the curve

c - the point of inflection (i.e. the point on the curve halfway between a and d)

d - the maximum value that can be obtained (y at at x tending to infinity)

# Least squares method

Least squares method is a mathematical procedure for finding the best-fitting curve to a given set of points. It is based on minimizing the sum of the squares of the the residuals of the points from the curve (SSE - Sum of Squared Error). The sum of squared errors is defined as:

$SSE = \sum_{i=1}^{n}[y_i - \bar{y}_i]^2$

where:

$y_i$ - value of y at point i

$\bar{y}_i$ - predicted value of y at point i

The function SSE is minimized to find the best fit line.

The condition for SSE to be a minimum is:

$\frac{\partial SSE}{\partial a_i}=0$

for i = 1,...,n

# Measures of goodness

## R squared

Coefficient of determination also denoted $R^2$ is a statistical measure which shows how well the regression model fits the data. It represents the proportion of variance in the dependent variable that can be explained by the independent variable. The formula for calculating $R^2$ is:

$R^2=1-\frac{\text{Unexplained Variation}}{\text{Total Variation}}$

Typically, $R^2$ is in the range of 0 and 1. A higher $R^2$ value (closer to one) imply that more variation is explained by the model. An $R^2$ of 1 indicates that the model predictions perfectly fit the observed data. It is worth to note that the coefficient of determination is the square of the correlation coefficient.

## Sum of Squared Errors (SSE)

The sum od squared errors is defined as:

$SSE = \sum_{i=1}^{n}[y_i - \bar{y}_i]^2$

The value of SSE is minimized in order to find coefficients of a best-fitting curve.