Sales Toll Free No: 1-855-666-7446

# Curve Fitting

Top
 Sub Topics It is easier to understand the graphical view rather than mathematical view, that’s why curve fitting Statistics is useful in statistics, curve fitting statistics is a way to represent large number of data in the form of curve. Proper definition of curve fitting statistics states that it is a way to represent best fit curve of large amount of data. With the help of these fitting curves, we can easily visualize the whole data and we can easily summarize the data means we can easily judge that where data is placed and we can easily judge relationship between data. Now we will discuss how we fit curve into statistics. We use following steps, which shows whole procedure of statistics curve fitting- Step1: First of all, we judge what type of equation we have, means its first order, second order or n- order like First order equation f(x) = ax + b Second order equation f(x) = ax2 + bx + c . . . n- order equation f(x) = axn + bxn-1 + cxn-2 +................+ d. Step 2: After evaluating the curve equation, we will analyze how many constraints are there, constraints can be any points, angle or curvature like If f(x) = ax + b, it is like a Slope equation where this type of curve contains exactly two fit points, And angle of this curve equation is tan θ = a. If f(x) = ax2 + bx + c, then this type of curve contains exactly three fit points, where angle of this curve equation is tan θ = (dy / dx). If f(x) = ax3 + bx2 + cx + d, then this type of curve contains exactly four fit points, where angle of this curve equation is tan θ = (dy / dx). Step 3: After evaluation of these constraints, we make suitable curves like ellipse, circle, rectangle, sphere etc. For making this kind of curve, first we find out what kind of error is there in given curve equation by following method - Step 1: If we have a function f(x) = a + bx or y – (a + bx) = 0, then we calculate sum of Square - Where sum of square is R2 (a, b) = ∑i=1n [y – (a + bx)]2. Step 2: After evaluation of sum of square, we can calculate the condition where R2 (a, b) is minimum, dR2 / dai (a, b) = -2 . ∑i=1n [y – (a + bx)], For critical points, above condition should be 0 dR2 / dai (a, b) = 0, dR2 / dai (a, b) = -2 . ∑i=1n [y – (a + bx)] = 0, After evaluating above sum equation, it produces value of ‘a’ and ‘b’- Step 3: After evaluation of ‘a’ and ‘b’, we calculate standard errors for ‘a’ and ‘b’ by following formula - Standard error of a = SE(a) = s . √(1 / n + x2 / ssx) Standard error of b = SE(a) = s / √ ssx Where ssx is a regression and ‘s’ is variance. This method is used for finding errors in curve equation.

## Best Fit Lines

From statistical Point of view Best fit lines Statistics very important in many aspects. If we want to draw best fit line then we need scatter-plot to find the direction. Scatter-plot is dimensional graph which display lots of point and show the relationship between two variables. These two variables are explanatory variables and response variables. Where, explanatory variable is plotted on x - axis and response variable is plotted on y - axis. If there is large number of data points then in that case Scatter Plots are used. It provide lots of information about relationship between two variables like Strength , directions like positive or negative, shape like linear or curved etc. and presence of outliers etc. In the best fit there is an association between two variables. So in general the best fit line is a Straight Line which is used to represent the data on scatter-plot. This line may be passed through all points, some of points or none of points. If you are going to draw the best fit line then you need to balance the number of points below the line with the Numbers of points above the line. The best fit line is used to show whether two variables are in co-relation or not. There is a method to determine the Line of Best Fit in mathematics which is called least Square method. The line of best fit is used in regression analysis and statistical calculation. The line of best raises instantly from left to right is called positive correlation and falls down instantly left to right is called negative co- relation. We can easily examine line of best fit with paper and pencil. Let’s take an example to understand to understand best fit line. We have a following table that describes that for the number of people who use a swimming pool over 8 days in summer, the corresponding maximum temperatures are given. Now we have to draw scatter-plot for the following data where temperatures are 20 , 24 , 36 , 32 , 28, 38 , 34 , 26 and number of peoples 280 , 360 ,450 ,420 ,400 ,500 ,475 and 320 according to each day. After that we have to draw the best fit line through the data. So if we want to plot scatter - plot then we need to plot ‘y’ against ‘x’. So here a line of best fit is drawn through with the help of scatter-plot so that an equal number of points lie on both sides of line or the numbers of point above the line is equals to total numbers of point below the line. The best fit line is simplistic but effective tool for indicating that how two variables may be related to each other. It is used to show co - relation between two variables with scatter-plot like number of home sales, numbers of years pass, annual salary, mortgage Interest rates etc. This is also used in analyzing investment risk and trading activity.

## Scatter Plots

Statistics scatter plots is a graph, which plots a Point and all these points shows some relationship between two Sets of data like we have a data of our country population and when create a graph of persons between their height and weight, it shows some dotted graph, where each dot represents each person’s height and weight.
So, this dotted graph, which represents relationship between height data of a person and weight data of a person, is called as a scatter plots in Statistics. This kind of graph shows statistics part because these graphs represent relationships between group of data and in statistics, when we deal with group of data.
This scatter graph is useful to find out correlation between two Set of data like we make a scatter plot graph on an ice cream shop’s sell and temperature because sale of ice cream is depends upon temperature. When temperature is high, selling of ice cream increases and correlation between selling and temperature is high in this situation means there are lot of dotted point are linked in this situation and when temperature is low, then selling of ice cream remains low in this situation and correlation between selling and temperature is also low in this situation means no dotted links exist in scatter plot between temperature and selling.

## Polynomial Curve Fitting

Curve fitting can be thought as process of finding a function in mathematics that best fits a sequence of data points. Here we will discuss polynomial Curve Fitting This is to be done by abiding to some rules of fitness. Different techniques we use for purpose of curve fitting are: smoothing and interpolation. Various examples for curve fitting can be Linear Regression, non – linear regression and polynomial fitting. Extrapolation is defined as using curve that has been fitted outside range of data being fitted and interpolation means to use curve within fitted data. Interpolation technique can be used for the Polynomials fitting process. In th.is fitted polynomial curve will pass through each and every data Point. Values for data points are estimated, which are found to be present on fitted curve. An example illustrates one of the simpler approaches:

Suppose a polynomial is defined as P (X) = (X – x1) y0 / (x0 - x1) + (X - x0) y1 / (x1 - x0). Where, (x0, y0) and (x1, y1) are two data points that are needed to be fit in a particular sequence. Polynomial P (X) has characteristic that P (x0) = y0 and P (x1) = y1 which represents a straight line. If we try to fit more data points, degree of overall polynomial will be comparatively higher. You can consider a polynomial of this type:
P (X) = (X - X1) (X - X2) Y0 / [(X0 - X1) (X0 - X2)] + (X - X0) (X - X2) Y1 / [(X1 - X0) (X1 - X2)] + (X - X0) (X - X1) Y2 / [(X2 - X0) (X2 – X1)].
Here, data points we considered are: (X0, Y0), (X1, Y1) and (X2, Y2). Other examples of polynomial curve fitting include divided differences and iterated interpolation.

## Least Squares Curve Fitting

Curve fitting when done by method of least squares Curve Fitting, we assume such curves that are best fit with minimum abnormalities squared (least squared error) from a given sample of data.
Suppose we have data points as (x1, y1), (x2, y2)… (xn, yn). Where, “x” is an independent variable and 'y' a dependent variable. Curve that we get after fitting F (x) has error represented as “E” from every data Point. Error can be calculated as:
E1 = y1 – F(x),
E2 = y2 – F(x),
E3 = y3 – F(x),
And so on to,
En = yn – F(x)
Best fitting curve has a characteristic that:
Pi = E12 + E22 + E32 +….. + En2 = n (summation) i= 1 Ei2,
Polynomial least squares fitting is one such method for polynomial curves fitting. In general Polynomials are most frequently used curves in mathematics. Least squares line method is performed on a Straight Line of standard form: y = mx + c. We use this method to estimate the data points like (x1, y1), (x2, y2)… (xn, yn) where, n > 2 and those are best fit. Same way we use this method to estimate data points of Parabola curve of the form y = a x2 + bx + c. We can also call it as a quadratic binomial function. Here, n > 3. Where, 'n' is total number of data points in Sample Space.
Least – Squares p th degree of polynomials represented as: y = a0 + a1 x + a2 x2 + …. + am xm. Here also we check for fitness of curve by estimating data points within which the curve can be found existing. Here, n > p + 1.

## Curve Fitting Algorithm

Curve fitting algorithm in mathematics deals with estimating those data points in given Set of samples for which curves are best fitted. There are several techniques that we follow to implement this algorithm. Let us discuss them in brief as follows:
1. Least squares Curve Fitting: This curve fitting technique is based on the use of least squares, which uses only those curves that are best fit with least deviations or errors when squared (least squared error) from a given set of data. Let us say data points of a Sample Space are given as (N1, N1), (N2, M2)… (Nn, Mn). Where, “N” and “M” are two independent and dependent variables respectively. For any curve F (N) we are going to estimate these points that are best fit for curve. Deviations or errors are represented as “Error” that are calculated from every data Point as:
Error1 = M1 – F (N)
Error2 = M2 – F (N)
Error3 = M3 – F (N)
And so on to,
Error n = Mn – F (N)
Best fitting curve has a property according to which value 'p i' is calculated as summation of error values from all data points respectively as:
P i = Error12 + Error22 + Error32 +….. + Errorn2 = n (summation) i= 1 Errori2
2. We have other methods also for curve fitting depending on type of curve we are dealing with:
a. Linear Regression for curves like straight lines y = ax + b.
b. Exponential curve fitting for exponent Functions like y = a ex.
c. Rational curve fitting for rational or fractional function like y = 1 / (ax + c).
d. Logarithmic fitting for curves including logs like y = log (ax + g).
e. Polynomial Fitting for polynomial curves like y = ax2 + bx + d.