What is Least squares: Definition and 167 Discussions

The method of least squares is a standard approach in regression analysis to approximate the solution of overdetermined systems (sets of equations in which there are more equations than unknowns) by minimizing the sum of the squares of the residuals made in the results of every single equation.
The most important application is in data fitting. The best fit in the least-squares sense minimizes the sum of squared residuals (a residual being: the difference between an observed value, and the fitted value provided by a model). When the problem has substantial uncertainties in the independent variable (the x variable), then simple regression and least-squares methods have problems; in such cases, the methodology required for fitting errors-in-variables models may be considered instead of that for least squares.
Least-squares problems fall into two categories: linear or ordinary least squares and nonlinear least squares, depending on whether or not the residuals are linear in all unknowns. The linear least-squares problem occurs in statistical regression analysis; it has a closed-form solution. The nonlinear problem is usually solved by iterative refinement; at each iteration the system is approximated by a linear one, and thus the core calculation is similar in both cases.
Polynomial least squares describes the variance in a prediction of the dependent variable as a function of the independent variable and the deviations from the fitted curve.
When the observations come from an exponential family and mild conditions are satisfied, least-squares estimates and maximum-likelihood estimates are identical. The method of least squares can also be derived as a method of moments estimator.
The following discussion is mostly presented in terms of linear functions but the use of least squares is valid and practical for more general families of functions. Also, by iteratively applying local quadratic approximation to the likelihood (through the Fisher information), the least-squares method may be used to fit a generalized linear model.
The least-squares method was officially discovered and published by Adrien-Marie Legendre (1805), though it is usually also co-credited to Carl Friedrich Gauss (1795) who contributed significant theoretical advances to the method and may have previously used it in his work.

View More On Wikipedia.org
  1. P

    How do I perform a weighted least squares fit with error bars?

    Hi, I am trying to do a best least-squares fit to a set of data which is described by the following equation: y=a\exp(-b\ln^2(c/x)) Where a,b,c are constant parameters I am trying to find values for. Any advice on how to proceed?
  2. S

    Linear Algebra - Least Squares

    Homework Statement Test these two equations, using least-squares fitting of the data (ti, bi), i = 1, 2, . . . , 100:1. b(t) = d_{1} + d_{2}te^{-t} + d_{3}t^{2}e^{-2t}2. b(t) = d_{1} + d_{2}\sqrt{t}e^{-\sqrt{t}} + d_{3}te^{-2\sqrt{t}} where d1, d2, d3 in R are unknown. For both theories...
  3. fluidistic

    Least Squares Fitting for ax²+bx+c with Given Points: Homework Solution

    Homework Statement I must find the best fitting function of the form ax²+bx+c using least squares. The points are (-1,6.1), (0,2.8), (1,2.2), (3,6) and (6,26.9). 2. Homework Equations + attempt at a solution A\vec x= \vec b, I'm looking for \vec x =\begin {pmatrix} a \\ b \\ c \end {pmatrix}...
  4. Simfish

    MATLAB Linear Least Squares Fit with Error Bars: A MATLAB Tutorial

    With MATLAB or something. Basically, I just have a bunch of data points where I should do a linear least squares fit, but each of the points have error bars around them.
  5. C

    Solve Least Squares Problem for Matrix A and B | Homework Equations

    Homework Statement Let A= |2 -1 -1| |-1 2 -1| |-1 -1 2| and B= |1| |2| |3| Homework Equations Find the x in which minimizes ||Ax-b||2 The Attempt at a Solution I tried to solve it by using this formula (A**A)-1A**b=x but i get the inverse of A*A equal 0
  6. S

    Nonlinear Least Squares Minimization

    How should I go about solving this problem? This is only to get a better understanding of how NLLS works. F(x;a) = (1+a1*x)/(a2+a3*x) (so n = 3) I am choosing a1,a2,a3 to be 2,3,5 respectively. I am also picking 6 data points (so m = 6): (0, 0), (-1/4, 1/4), (-1/2, 1/10), (1/4, 1/4)...
  7. S

    Linear Least Squares Minimization

    I'm going through some methods to solve the LLS method of minimization and have come upon 3 general methods to solve the problem. The 3 methods I am looking at are normal equations, QR factorization, and SVD. I've come upon a fact that I can't find an explanation for: Can anyone explain why...
  8. I

    Least squares problem - Leon Ch 5, sec.3, prob.3

    Homework Statement For the system Ax = b, find least squares solution. A = (1 2) ; b = (3, 2, 1)T ----(2 4) ----(1 -2) Homework Equations I know if A is an m x n matrix of rank n, the normal equations ATAx = ATb have a unique solution x =...
  9. F

    Linear Algebra Least Squares Question

    Homework Statement Suppose the columns of A are not independent. How could you find a matrix B so that P=B(BTB)^-1BT does give the projection onto the column space of A? (The usual formula will fail when AT A is not invertible). T is transpose. Homework Equations The Attempt at a Solution I...
  10. S

    Critical values and linear least squares

    I have a question about Linear least squares: In Linear least squares, For any critical point "x" it must follow the linear system: A(Transpose) * Ax = b * A(Transpose) where x is the critical point. But here x is an n vector, so does that mean there are as many critical points (x) as...
  11. S

    Linear Least Squares: Critical Points & Quadratic Polynomials

    I have a question about Linear least squares: In Linear least squares, For any critical point "x" it must follow the linear system: A(Transpose) * Ax = b * A(Transpose) where x is the critical point. But here x is an n vector, so does that mean there are as many critical points (x) as...
  12. H

    Find the least squares approximation

    Homework Statement Suppose a set of N data points {(xk,yk)}Nk=1 appears to satisfy the relationship for some constants a and b. Find the least squares approximations for a and b. Homework Equations The Attempt at a Solution I really have no idea about this problem.
  13. W

    Least Squares With Multiple Quadratic Constraints

    Problem: A = n by m matrix x = m by 1 vector y = n by 1 vector C = c by m matrix E = e by m matrix Alpha, gamma and theta are constants. norm(Ax-y) = min subject to: norm(Cx) = alpha norm(Ex) = gamma transpose(Cx)*Ex = (alpha^2)*(gamma^2)*cos(theta) I read a paper on how to do this with 1...
  14. L

    Linear Least Squares: Solving 3D Data Points in C++

    I have a simple problem. I have a set of 3D data points and I want to fit a line through them using linear least squares. I understand the basic approach required: set up two matrices such that Ax = b, then make it a square matrix A^t*Ax = A^t*b, then solve for x using a Cholesky decomposition...
  15. Z

    Least Squares with MATLAB

    Homework Statement The distance traveled by a comet is described with the following equation: r = B + re cos (θ) B (Beta) and e are constants θ 0.88 1.10 1.42 1.77 2.14 2.91 3.85 r 8.27 5.49 3.53 2.50 1.95 1.52 5.21 These were some of the measurements, which can be written in...
  16. S

    Existence and Uniqueness of a Linear Least Squares Solution

    I'm studying for my numerical analysis final on tuesday, and I know this is going to be one of the problems, so any help is greatly appreciated. Homework Statement State and prove existence and uniqueness for the solution of the linear least squares problem. Homework Equations y \approx...
  17. E

    Eviews 3 stage least squares near singular matrix

    I'm doing a replication paper and having a bit of issues. The author uses 2 instruments and has 4 endogenous variables. Since he is under-identified, he runs 4 separate regressions, so that each equation has 1 overidentifying restrictions. I want to extend this and run the four equations as a...
  18. I

    Optimizing H for Accurate Outlier Detection in Weighted Linear Least Squares

    I have the following problem: I have a set of m measurements $\mathbf{\phi}$ and I estimate a set of 3 variables $\mathbf{x}$ The estimated value for $\mathbf{\phi}$ depends linearly on $\mathbf{x}$ : Hx=\Tilde{\phi} The solution through weighted linear least squares is: $\mathbf{x}$ =...
  19. S

    Linear algebra least squares solution

    Homework Statement Suppose you have a set S of three points in R^2, S1 = {(1, 12), (2, 15), (3, 16)} S2 = {(1, 12), (1, 15), (3, 16)} S3 = {(1, 12), (2, 15), (2, 15)} which you seek to interpolate with the quadratic polynomial p(t) = a_0 + a_1t + a_2t^2. Problem: Least-Squares...
  20. D

    How to know whether the least squares approximation exitsts.

    How would one know when to find the least squares approximation?
  21. T

    How can I solve this Least Squares Regression problem?

    Homework Statement http://img683.imageshack.us/img683/4744/leastsquares.jpg [PLAIN][PLAIN]http://img149.imageshack.us/img149/4793/graphwd.jpg Homework Equations The Attempt at a Solution So would these be the points? (-41,51),(-22,62),(23,63),(44,24) I'm not too sure how...
  22. clope023

    Method of Least Squares question

    Homework Statement for vector space C[-1,1] with L^2 inner product <f,g> = \intf(x)g(x)dx find the best least squares approximation for function x^(1/3) on [-1,1] by a quadratic function q(x) = c0 + c1x + c2x^2 Homework Equations s+r = n <t^s, t^r> = \intt^ndt = { 2/(n+1)...
  23. H

    Can you give me a least squares example?

    Can you give me a "least squares" example? Assume that, I have a function to estimate like below: f(x) = a3x3 + a2x2 + a1x1 + a0x0 After several experiments I have obtained these (x, f(x)) pairs: (x1, y1) (x2, y2) (x3, y3) (x4, y4) (x5, y5) (x6, y6) How can I estimate a0, a1, a2...
  24. S

    Multi-objective recursive least squares

    Is this possible? I've computed a multiobjective least squares solution and want to make it able to be updated recursively but I get stuck at applying the woodbury matrix identity since it's no longer a rank 1 udpate. Are there any derivations of this anywhere or is this not possible? Thanks
  25. M

    3D Least Squares Fit and some Linear Algebra

    Hello, I am trying to write an algorithm to calculate the Least Squares Fit Line of a 3D data set. After doing some research and using Google, I came across this document, http://www.udel.edu/HNES/HESC427/Sphere%20Fitting/LeastSquares.pdf (section 2 in page 8) that explains the algorithm for...
  26. M

    MATLAB Calculating 3D Least Squares Fit with SVD in MATLAB

    Hello, I am trying to write an algorithm to calculate the Least Squares Fit Line of a 3D data set. After doing some research and using Google, I came across this document, http://www.udel.edu/HNES/HESC427/Sphere%20Fitting/LeastSquares.pdf (section 2 in page 8) that explains the algorithm for...
  27. N

    What is the best estimate for B in Least Squares Fitting?

    1. Homework Statement Suppose two variables x and y are known to satisfy a relation y=Bx. That is a graph of x vs. y is a line through the origin. Suppose further that you have N measurements (xi,yi)and that the uncertainties in x are negligible and those in y are equal. Prove the best...
  28. N

    Determine g from least squares fit line?

    I did a least squares fit project for physics and now i have to say the value of G and the slope. I know that slope is m from the equation y = mx+b but how do i determine G?
  29. M

    Method of Weighted Residuals - Least Squares

    I am having a problem applying the Least Squares method in the case where I have 2 fundamental solutions and therefore 2 unknown wieghts to find. I=\int_{\Gamma} |\varphi + 1/2|^2 \mathrm{d}s}_{1} + \underbrace{\int_{\Gamma_{in}} |\varphi + 1/4|^2 \mathrm{d}s (im not sure if this...
  30. N

    Least squares fit to a straight line?

    I was wondering if someone could explain how to compute the Least squares fit to a straight line
  31. N

    Least squares fit to a straight line?

    I was wondering if someone could explain how to compute the Least squares fit to a straight line
  32. M

    How to Convert Least Squares Problems into Independent Equations

    I think that this is best suited here as it is linear algebra specific... sorry if I'm wrong. Please look at: I can do parts a,b and c. But I can't do part d. I've been trying to turn it into n independent least squares equations. Let me know if this is not the way to go or you have...
  33. J

    Least Squares Approx. for Life Expectancy

    This test question is really boggling me and my math group. Any help would be appreciated. We know that AT*x=AT*b is the setup, but we're not so sure how to approach the problem most effectively. Here's the question: Use the data below to find an approximate formula for the life expectancy in...
  34. R

    Least Squares Fit for h(x)=ae^x+be^(-x) Homework

    Homework Statement For the following data, find the least squares fit of the given form x=1,2,3,4,6 y=14,10,8,6,5 h(x)=ae^x+be^(-x) Homework Equations The Attempt at a Solution So I tried to linearize the equation by taking the natural log of everything...
  35. mnb96

    Plane Fitting with Linear Least Squares

    Hello, I am trying to figure out how to fit a plane passing through the origin in \mathbf{R}^3, given a cloud of N points. The points are vectors of the form (x_1^{(k)}, x_2^{(k)}, x_3^{(k)}) , where k stands for the k-th point. I want to minimize the sum of squared distances point-plane. What...
  36. M

    Least squares solution to simultaneous equations

    I am trying to fit a transformation from one set of coordiantes to another. x' = R + Px + Qy y' = S - Qx + Py Where P,Q,R,S are constants, P = scale*cos(rotation). Q=scale*sin(rotation) There is a well known 'by hand' formula for fitting P,Q,R,S to a set of corresponding points. But I...
  37. R

    Error propagation in least squares

    I am doing a calculation involving taking three or more temperature measurements and then plotting them against another quantity (dependent). I get a relationship that is pretty linear, so I take the line of best fit to obtain an equation with a slope and an intercept. Now, my question is...
  38. P

    Conditional expectation and Least Squares Regression

    Hello everybody, I have two questions on conditional expectation w.r.t (Polynomial) OLS: Let X_t be a random variable and F_t the associated filtration, Vect_n{X_t} the vector space spanned by the polynomials of order {i, i<=n }, f(.) one function with enough regularity. I am wondering how...
  39. C

    Ax + b Least Squares Minimization Standard Form

    All - Given a set of data {(xi, yi)| i = 1,2,...,m} and the regression equation f(x) = ax + b, I want to use the simplex method to minimize the equation Sigma [(yi - f(xi))/f(xi)]^2. However, I am stuck on how to initially organize the problem. I am not sure whether the equation, Sigma [(yi -...
  40. B

    Simple least squares regression problem. Am I doing anything wrongly?

    Least squares regression of Y on A-D based on sample size of 506. Reported results with standard errors are: Y = 11.08 - 0.954*A - 0.134*B + 0.255*C - 0.052*D s.errs (0.32) (0.117) (0.043) (0.019) (0.006) R^2 = 0.581 problem A. Test null that coefficient on D is equal to 0 d =...
  41. B

    Simple least squares regression problem. Am I doing anything wrongly?

    Least squares regression of Y on A-D based on sample size of 506 Y = 11.08 - 0.954*A - 0.134*B + 0.255*C - 0.052*D s.errs (0.32) (0.117) (0.043) (0.019) (0.006) R^2 = 0.581 problem A. Test null that coefficient on D is equal to 0 d = coefficient on D null: D ~ N(0, 0.006) Pr(d...
  42. B

    Simple least squares regression problem. Am I doing anything wrongly?

    Least squares regression of Y on A-D based on sample size of 506 Y = 11.08 - 0.954*A - 0.134*B + 0.255*C - 0.052*D s.errs (0.32) (0.117) (0.043) (0.019) (0.006) R^2 = 0.581 problem A. Test null that coefficient on D is equal to 0 d = coefficient on D null: D ~ N(0...
  43. J

    Proof of least Squares estimators

    Hey guys, long time lurker, first time poster! Just having some trouble with something..Im probably just looking at it the wrong way, but I was wondering if anyone could help me with this.. Im trying to prove that by choosing b0 and b1 to minimize...
  44. S

    Least Squares Regression Analysis - No Idea

    Hello, I am a first year undergraduate university student majoring in Engineering and Computing Sc. One of my courses is Linear Algebra. We have been given an assignment in which question no. 2 is out of syllabus. It is on Least Squares Regression Analysis. This has not been taught to us. We...
  45. S

    Unable to find the nonlinear least squares

    Homework Statement We have the following x, y values x ||| y 1.0 -0.15 1.5 0.24 2.0 0.68 2.5 1.04 3.0 1.21 3.5 1.15 4.0 0.86 4.5 0.41 5.0 -0.08 How can you find the equation y(x) = ax^2 + bx + c by least squares? The Attempt at a Solution I know how to...
  46. D

    Prove Least Squares Equation Has Solution

    Homework Statement In the least squares method the vector x* that is the best approximation to b statisfies the Least squares equation: A^T A x^*= A^T b Prove that there's always a solution to this equation. Homework Equations - The Attempt at a Solution I distinct 2...
  47. J

    Deriving The Quad. Eq. Using least squares.

    Could someone show me exactly how to derive the quadratic equation from the least squares method? I have no idea where to start. I will appreciate it very much. Thankyou.
  48. A

    Linear least squares, condition number

    Hi, I am trying to learn some numerical algebra. Now I don't understand the following. I'm finding the solution to the Linear Least Squares problem min||A\lambda-y||_{2}, which turns out to be (1,1). I did this by doing a QR factorization using Givens rotations. with: A= \[...
  49. S

    Does least squares regularization have to be iterative?

    Does a http://en.wikipedia.org/wiki/Tikhonov_regularization" solution for least squares have to be iteratively solved? Or is there a way to perform regularization via linear algebra, the way linear regression can be done by solving the (XTX)B=XTy normal equations?
  50. S

    C/C++ Least Squares source code in C++?

    Does anyone know where to find source code for a simple and fast least squares solver written purely in C++?
Back
Top