Linear Algebra - Least Squares

In summary, Sheepover is trying to solve a system of equations using the QR factorization of the data set and trial functions, but is having trouble finding the coefficients without traditional methods.
  • #1
sheepover
4
0

Homework Statement

Test these two equations, using least-squares fitting of the data (ti, bi), i = 1, 2, . . . , 100:1.
[tex]b(t) = d_{1} + d_{2}te^{-t} + d_{3}t^{2}e^{-2t}[/tex]2.
[tex]b(t) = d_{1} + d_{2}\sqrt{t}e^{-\sqrt{t}} + d_{3}te^{-2\sqrt{t}}[/tex]

where d1, d2, d3 in R are unknown.

For both theories, compute the resulting values of the constants d1, d2, d3 and produce a graph that shows the original data and the computed function b(t).

Which one of the two theories is more appropriate for the given data?We are given t and b as 1x100 matrices in matlab, and I also have a Modified Gram-Schmidt program in MATLAB that computes Q and R for any matrix A, which is supposed to be used to solve this problem.

Homework Equations



A = QR
ATAx = ATb
min||b-Ax||

The Attempt at a Solution



Not even sure where to start. I've been searching online for any guidance for hours. Textbook is no help either.

If someone could at least point me in the right direction, or give me some steps to solve this, it would be appreciated.
 
Physics news on Phys.org
  • #2
For 1, A is the matrix having each row of the form
[tex]\begin{array}{ccc}1 & t_ie^{-t_i} & t_i^2e^{-t_i}\end{array}[/tex]
for each i. It will have 3 columns and 100 rows.

Similarly, for 2 A is the matrix having each row of the form
[tex]\begin{array}{ccc} 1 & \sqrt(t)e^{-\sqrt(t)} & te^{-2\sqrt{t}}\end{array}[/tex]

Again it has 3 columns and 100 rows.
 
  • #3
I am not sure where your confusion lies. Do you understand that what you need to do is to solve the 3 x 3 linear system B p = r, where B = A^T * A, r = A^T * b and p = column vector (d1,d2,d3)? If you don't get this, you really do need to go back and review the basics.

OK, so if you understand that you need to solve a 3 x 3 linear system, there is the issue of how to do that. You could simply write down the equations in Matlab and ask it to solve them---no matter how it chooses to do it. On the other hand, maybe the question is more about how to use QR factorization in solving the resulting 3 x 3 system---I don't know: I can't tell, from what you have written. (I do know that I, personally, would *never* ask anybody to use a factorization of a 100 by 3 matrix to solve a 3 by 3 system; I might ask for a QR factorization of the 3 by 3 matrix, but that is a different story.)

RGV
 
  • #4
The point of the exercise given to sheepover is to use QR factorization on the data set and the trial functions in the problem to find the least-squares coefficients without forming the normal equations traditionally used for such calculations. In this case, it means the QR method is used directly on an over-determined system with 100x3 terms as one component.

Sheepover's Google must be broken because searching with "least squares QR" found results immediately.
 

FAQ: Linear Algebra - Least Squares

1. What is least squares in linear algebra and why is it important?

Least squares is a method used in linear algebra to find the best fit line for a set of data points. It minimizes the sum of the squared differences between the predicted values and the actual values. This is important because it allows us to make accurate predictions and estimate unknown values based on the data we have.

2. How is least squares different from other regression methods?

Least squares is different from other regression methods in that it minimizes the sum of the squared errors, rather than just the absolute errors. This means it takes into account both the magnitude and direction of the errors, making it a more accurate and robust method.

3. Can least squares be used for non-linear data?

Yes, least squares can be used for non-linear data by transforming the data into a linear form. This can be done by taking the logarithm or square root of the data, or by using polynomial regression. However, in some cases, other regression methods may be more appropriate for non-linear data.

4. How do you interpret the coefficients in a least squares regression?

The coefficients in a least squares regression represent the change in the predicted value for a unit change in the corresponding independent variable. For example, if the coefficient for x is 2, it means that for every one unit increase in x, the predicted value will increase by 2.

5. What are the assumptions of least squares regression?

The main assumptions of least squares regression include linearity, constant variance, independence of errors, and normally distributed errors. These assumptions should be checked before using least squares and if they are not met, other regression methods may be more appropriate.

Similar threads

Back
Top