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

Click For Summary
To find the curve of best fit for the given data sets, two models are considered: a linear model (y = a + bx) and a non-linear model (y = a + bx + c cosx). The first model can be solved using least squares methods for straight lines. For the second model, the discussion suggests using linear algebra to derive least squares estimates without calculus, specifically by setting up a matrix equation Y = XB, where Y is the vector of y-values and X is a matrix containing the x-values and cos(x) values. The least squares estimates can be calculated using the formula B = (X^{T}X)^{-1}X^{T}Y, projecting y onto the subspace spanned by x.
visharad
Messages
51
Reaction score
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
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 y = a + bx + c*cos{x} --or-- Y = XB, 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 B = (X^{T}X)^{-1}X^{T}Y.

You remember projection onto subspaces, right? You're just projecting y onto the subspace spanned by x.
 
Last edited:
Here is a little puzzle from the book 100 Geometric Games by Pierre Berloquin. The side of a small square is one meter long and the side of a larger square one and a half meters long. One vertex of the large square is at the center of the small square. The side of the large square cuts two sides of the small square into one- third parts and two-thirds parts. What is the area where the squares overlap?

Similar threads

  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 16 ·
Replies
16
Views
3K
  • · Replies 18 ·
Replies
18
Views
4K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 7 ·
Replies
7
Views
1K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 19 ·
Replies
19
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K