How to find curve (non-linear) of best fit?

In summary, to find the curve of best fit for the given data sets, you can use linear algebra and the formula for least squares estimates. For part a, you can use the formula for straight lines, while for part b, you can use the model y = a + bx + c*cos{x} and the matrix of least squares estimates (B). Alternatively, you can also use calculus to minimize the value of the sum and derive equations for a, b, and c, although this may be more challenging due to the small number of data points and their scattered distribution.
  • #1
visharad
54
0
Given the following sets of data, find the curve of best fit
x = -4, -6, 5, -6, -9, -2, 5
y = -4, -7, 3, -12, -2, 5, 7

a) y = a + bx
b) y = a + bx + c cosx

I can do part a by using the formula for least square methods for straight line. But what about part b? One way I can think of is to do the following
Use Calculus to minimize the value of Sum(a + bx + c cosx - y)^2 and derive equations for a, b and c.
But this problem is for linear algebra. So I am thinking if we can solve it without using calculus.
 
Mathematics news on Phys.org
  • #2
The second model is still a linear model; derive the least squares estimates through the usual method (good luck though, there are very few data points and they're scattered all over the place).

Using linear algebra...
Fit the model [itex]y = a + bx + c*cos{x}[/itex] --or-- [itex]Y = XB[/itex], where...
Y = Column vector of y-values
X = A 7x3 matrix where the first column consists of ones, the second contains x-values, and the third contains
cos(x) values.

Then the matrix of least squares estimates (B) is given by [itex]B = (X^{T}X)^{-1}X^{T}Y[/itex].

You remember projection onto subspaces, right? You're just projecting y onto the subspace spanned by x.
 
Last edited:

FAQ: How to find curve (non-linear) of best fit?

What is a curve of best fit?

A curve of best fit is a mathematical function that is used to model the relationship between two variables. It is used to find the most accurate representation of the data points on a graph, and is often used to make predictions or analyze trends.

Why is a curve of best fit important?

A curve of best fit is important because it allows us to make sense of large amounts of data and identify patterns and relationships between variables. It also helps us to make predictions and draw conclusions based on the data.

How do you find the curve of best fit?

To find the curve of best fit, you can use a variety of mathematical methods such as the least squares method, the method of least absolute deviations, or the maximum likelihood estimation method. These methods use statistical techniques to determine the most accurate curve that fits the data points.

What is the difference between a linear and non-linear curve of best fit?

A linear curve of best fit is a straight line that represents a linear relationship between two variables, while a non-linear curve of best fit is a curved line that represents a non-linear relationship between two variables. Non-linear curves can take on various shapes such as exponential, logarithmic, or polynomial.

How do you know if a non-linear curve of best fit is a good fit for the data?

There are several methods for evaluating the fit of a non-linear curve to the data, such as calculating the coefficient of determination (R-squared value) or performing a residual analysis. These methods can help determine the accuracy of the curve and whether it adequately represents the relationship between the variables.

Similar threads

Replies
10
Views
2K
Replies
2
Views
984
Replies
18
Views
3K
Replies
7
Views
1K
Replies
7
Views
1K
Replies
1
Views
981
Replies
19
Views
2K
Back
Top