# Function approximation with regression analysis

This online calculator uses several simple regression models for approximation of unknown function given by set of data points.

function approximation problem asks us to select a function among a well-defined class that closely matches ("approximates") a target function

This calculator uses provided target function table data in form of points {x, f(x)} to build several regression models, namely, linear regression, quadratic regression, cubic regression, power regression, logarithmic regression, hyperbolic regression, ab-exponential regression, exponential regression. Results can be compared using correlation coefficient, coefficient of determination, average relative error (standard error of the regression) and visually, on chart. Theory and formulas are below the calculator, as usual.

Save the calculation to reuse next time, toextensionembed in your website orshareshare with friends.

## Linear regression

Equation:

a coefficient

b coefficient

Linear correlation coefficient

Coefficient of determination

Standard error of the regression

## Quadratic regression

Equation:

System of equations to find a, b and c

Correlation coefficient

,

where

Coefficient of determination

Standard error of the regression

## Cubic regression

Equation:

System of equations to find a, b, c and d

Correlation coefficient, coefficient of determination, standard error of the regression - the same formulas as in case of quadratic regression.

## Power regression

Equation:

b coefficient

a coefficient

Correlation coefficient, coefficient of determination, standard error of the regression - the same formulas as above.

## ab-Exponential regression

Equation:

b coefficient

a coefficient

Correlation coefficient, coefficient of determination, standard error of the regression - the same.

## Hyperbolic regression

Equation:

b coefficient

a coefficient

Correlation coefficient, coefficient of determination, standard error of the regression - the same as above.

## Logarithmic regression

Equation:

b coefficient

a coefficient

Correlation coefficient, coefficient of determination, standard error of the regression - the same as above.

## Exponential regression

Equation:

b coefficient

a coefficient

Correlation coefficient, coefficient of determination, standard error of the regression - the same as above.

## Derivation of formulas

Let's start from the problem:

We have unknown function y=f(x), given in form of table data (for example, those obtained from experiments).

We need to find function with known type (linear, quadratic, etc.) y=F(x), those values should be s close as possible to the table values at same points. On practice, type of function is determined by visually comparing table points to graphs of known functions.

As result we should get a formula y=F(x), named empirical formula (regression equatuion, function approximation), which allows to calculate y for x's not present in table. Thus, empirical formula "smoothes" y values.

We use **Least Squares Method** to obtain parameters of F for best fit. The best fit in the least-squares method sense minimizes the sum of squared residuals, a residual being the difference between an observed value and the fitted value provided by a model.

Thus, we need to find function F, such as the sum of squared residuals S will be minimal

Let's describe solution for this problem using linear regression F=ax+b as example.

We need to find best fit for a and b coefficients, thus

S is function of a and b. To find the minimum we will find extremum points, where partial derivatives equal to zero.

Using formula for derivative of complex function we will get the following equations

For function partial derivatives are

,

Expanding first formulas with partial derivatives we will get the following equations

After removing the brackets we will get the following

From these equations we can get formulas for a and b, which will be the same as formulas listed above.

Using the same technique we can get formulas for all remaining regressions

## Comments