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.
Hey guys! Having issues with a code I'm writing. It doesn't fit the typical format and I may have already accidentally posted it in the wrong forum, so here's a copy of what was there with the newest version of the code. It'll (eventually) be a four-parameter least squares minimisation, but for...
Hey guys! Having issues with a code I'm writing. It'll (eventually) be a four-parameter least squares minimisation, but for the moment I'm just trying to get the single parameter version to work. I've got the first module done but, when I run it it gets caught up in a loop and doesn't actually...
Hello,
So I was hoping to get some help implementing a nonlinear least squares fitting algorithm. Technically this is an extension of my previous thread, however the problem I am having now is correctly computing the algorithm
So the problem definition is this:
Given two sets of n 3D points...
Hi, I wonder if someone could give me some guidance on this problem please. I'm not a mathematician and I'm not even sure what the title of this problem should be - curve fitting, regression, function minimization?
It started with something fairly simple, least squares fitting with 3...
Homework Statement
Under the simple linear regression model Y= A + Bx + e, where A is the intercept (a known concept), B is the slope parameter (unknown) and e is a random error term satisfying the normality assumption.
If (X1,Y1)...(Xn,Yn) are the n data points observed, find the least squares...
Homework Statement
Does the "through-origin" least squares line
yhat = b*X
pass through the point (ybar, xbar)?
The "through-origin" model is the least squares model without the intercept.
Homework Equations
b = sum[YX]/sum[X^2]
yhat = b*X
The Attempt at a Solution
when I calculate a...
Homework Statement
Given this data:
hours / value
-----------
2 | 1.6
4 | 1.5
6 | 1.45
8 | 1.42
10 | 1.38
12 | 1.36
fit a curve of the form Y ≈ ae^{-bx}
What value can you predict after 15 hours?
The Attempt at a Solution
So i can rewrite the equation as Y ≈ log(a)-bx...
To find the closest point to b in the space spanned by the columns of A we have:
\mathbb{\hat{x}}=(A^TA)^{-1}A^T\mathbb{b}
My question is, shouldn't this solution ##\hat{x}## depend on the choice of distance function over the vector space? Choosing two different distance functions might give...
Hello,
Homework Statement
I want to estimate a set of parameters by trying to minimize the sum of squares wrt to the parameter set given a simulation of a markov process and real data in Matlab. I have already implemented the Levenberg-Marquart (LM) Algorithm and it is converging to certain...
Homework Statement
So I'm doing a Least Squares Analysis and I'm wondering about what the 'measured mean value of y for replicate measurements of the unknown' value is supposed to be. I have no idea in the world what it's asking for. The value it is speaking of is not the same as the average...
The weighted least squares formula - Quick question !
m=Ʃiwi Ʃiwixiyi - Ʃiwixi Ʃiw[SIZE="2"]iy[SIZE="2"]i
- In this formula, does w[SIZE="2"]i mean to include the weighting of all points - i.e. both x and y points throughout.
Thanks Alot !
Hi All,
I'm struggling with finding a solution to an adjustment I'm working on. Thought someone else may have some thoughts?
I have a kinematic time series of X,Y positions for two points (X1,Y1,X2,Y2). I know that the two points were a distance D (e.g., 100 m) apart from each other (the...
Hi,
I want to solve an overdetermined non-linear equation with the method of least squares. Assume it's f(x) = 1 + ax + a^2 + b, and I want to estimate a and b. This is non-linear, as I said, so the derivatives of the squared residuals involve a^3 terms and are difficult to solve.
Now I thought...
Homework Statement
Hi there! First time user, so I hope I do this right. The question is: Let A be an 8x5 matrix of rank 3, and let b be a nonzero vector in N(AT). First, prove that the system Ax=b must be inconsistent. Then, how many least squares solutions will the system have...
Hi,
Below is my attempt at a comparison between the two above-mentioned methods of estimation. Does anything in the table lack in validity and/or accuracy? Should any properties, advantages/disadvantages be eked out? Any suggestions/comments would be most appreciated!
MLE...
I am fitting data to a parabolic equation using the least squares fit method. Each data point that goes into the fit is the average of 5 data points at that x value, so that each point has error bars that come from the standard deviation of those 5 y values.
I have a fitted equation, and I...
Homework Statement
I am not sure whether the answer should be b or d. It says the average of the function and the vertical scale need to be determined. In other words I won't have to determine a_0 (the vertical shift) right? Because it did not mention that?
Also what is the average...
Homework Statement
I had to make a Linear Least Squares Excel template for my first week's Physics lab to analyze linear data for the rest of the semester. All of my values come out correctly, except the standard deviation values. I was wondering if someone could take a look at my template and...
Hello,
Let me get right to my problem. I have an experimental distribution and a single-parameter theoretical distribution.
I want to find the value for the best fit theoretical distribution that agrees with my experimental data for the bulk of the distributions (the tails of my...
Hi everyone given the system of equations
A1Cx + B1Cy + C1Cz = D1
A2Cx + B2Cy + C2Cz = D2
A3Cx + B3Cy + C3Cz = D3
I need to solve for Cx, Cy, Cz
All other variables are known and constants.
However all other variables (A,b,c,d) come from experimentally measured data and thus I cannot...
Hi
I like to fit in Mathematica using NonlinearModelFit. When I look at the fitted parameters, there is an entry called "P-value". Here is what it means: "The p-value is the probability of observing a t-statistic at least as far from 0 as the one obtained.". I'm not quite sure what this...
Linear Algebra problem (Least Squares? - Distance between lines)
Homework Statement
We have two points R = (x,x,x) and S = (y,3y,-1). All we know is that they are on lines somewhere in 3-space and that they don't cross. Need to find an x and y that minimize || R - S ||2
Homework...
I took a LA course in the spring, and was interested by the least squares method for building models. I decided to practice this concept by attempting to build a model that would predict ticket sales for the Mega Millions lottery given the jackpot amount. I have 249 data pairs of jackpot and...
Given a homogeneous linear least squares problem:
A^{T}y=0
What is the difference between minimizing
y^{T}AA^{T}y
(the least square error)
and:
y^{T}AA^{+}y=y^{T}A(A^{T}A)^{-1}A^{T}y
?
Thanks.
Hello all,
I have a set of measurements that I want to fit to a linear model with a bunch of parameters. I do this as \theta=(H^TH)^{-1}H^Tx, where θ are the parameters and x is the set of measurements. The problem is that I'd like to reduce the number of parameters in the fit. I'd like to...
yi = a + bxi + ei is the simple liner regression model as per is usual
"state the assumptions on the errors ei to justify a least squares fit"
? So is this just that E(ei)=0, i can't see what else is a 'must' for this? what about that they are normally distrubited? i know the properties of the...
Homework Statement
http://www.math.tamu.edu/~vargo/courses/251/HW7.pdf
Given a set of points (xi,yi) and assuming f(xi) is linear, the deviation measured is F(m,b)=\sum_{i}^{n}(y_i - f(x_i))^2. There are a few different questions about this from the link above.
The Attempt at a...
Homework Statement
Im trying to construct a function in MATLAB that models linear least squares model fitting through the use of normal equations.
Homework Equations
Normal equation
(A'*A*c)=(A'*y)
A= [column vector of all x ; column vector of all 1]
y= [column vector of all y]
c = [b;a]...
(The usual format doesn't really fit this question, so I hope you won't mind if I set it up slightly differently)
The task is to make a Fortran program that will read in a given set of data from a file, stopping when it reaches the end, and calculate the gradient and intercept of a best fit...
say we have data set {y(t sub i), t sub i} Where i=1 2 3...m.
I know how to fit these into a line of the form ax+b, but how about fitting into a constant??
Homework Statement
number of years(x): [1,2,3,4,5,6,]
number of accidents(y): [12,6,5,4,2,2]
or
(1,12),(2,6),(3,5),(4,4),(5,2),(6,2)
Homework Equations
the relation between x and y is on the form: y = a + b(1/x)
by changing (1/x) to z, the model become linear instead of...
How do I calculate least squares? The way it's described is confusing to me. \hat{β}= r* sy/sx . sx and sy is the standard deviation of x and y, correct ? So let's say I have sets of numbers such as (16,19),(18,17) etc... 16 and 18 would be x and 19 and 17 would be y. So I have to calculate the...
Hi,
I'm trying to derive a result from this paper:
http://www.research.yahoo.net/files/HuKorenVolinsky-ICDM08.pdf
given cost function
\min_{x_* , y_* } \sum_{u, i} c_{ui} (p_{ui} - x^T_u y_i)^2 + \lambda \left( \sum_u ||x_u||^2 + \sum_i ||y_||^2 \right)
Where both xu and yi...
Hello there,
currently I am trying to solve a least squares problem of the following form:
min_{M} ||Y - M*X||^2
where M is a 3x3 matrix and Y and X are 3xN matrices. However, the matrix M is of a special form. It is a rank 1 matrix which satisfies M*M = 0_{3x3} and the trace of M is zero...
Hello,
What are the error bars on the least squares fit line?
recall the variables are:
x ; y ; x^2 ; xy ; y^2 ; yi=mx+c ; d =(y-yi) ; d^2
---------
is it d?
Thanks
Hi,
I have some experimental data as a function of time t and temperature T. I have done a least squares fit of the data with a function f=f(a1,a2,t,T) (the function is non linear in a1 and a2!). Optimization of e^2 = sum((yi-f(a1,a2,ti,Ti)^2) with Matlab's fminsearch gave me a1, a2 and the...
I have a presentation to give on the least squares method this week, and am finding the least squares method very intuitive with the exception of one thing: why is the square of the offset used, as opposed to the absolute value? I did a bit of searching, but could not find a detailed answer...
Homework Statement
A) Find an orthonormal set q1, q2, q3 for which q1,q2 span the column space A [1 1; 2, -1; -2,4] (this is a 3x2 matrix).
B) Which fundamental subspace contains q3?
C) What is the least-squares solution of Ax=b if b=[1 2 7]T?
Homework Equations
Gram-Schmidt...
Hello guys,
I need your help with understanding a fitting Algorithm, so that I could make it in a C++ program.
I have the following function:
g(f; f0, phi0, a, b) = phi0 + a ArcTan((f-f0)/b)
Which is a function of "f", frequency.
I would like to fit this function with the...
Can someone point me in the right direction or give me a rundown on how to use the least squares method in calculating the uncertainty in a gradient of a graph?
We have been given a theoretical experiment with data and so on supplied and we need to find the uncertainty of the graph we have...
So I am learning how to use the method of least squares to find the best fit straight line and there is this one part in the derivation I do not fully understand and I was wondering if anyone could help me out.
So basically we start out with the residuals of the equation of a straight line...
Hi guys,
Thanks for taking the time to read the post.
I have a question related to curve fitting and polynomials that i was hoping someone might be able to help me with.
I have a set of x and y data points, all on a graph. I have then calculated the 4th order least squares polynomial...
I found a claim in a paper (BSSA, Vol 81, No. 6: "A Waveform Correlation Method for Identifying Quarry Explosions", By D.B. Harris) concerning finding filter coefficients. The statement is given without proof. I cannot locate a reference or theorem for the following, and have not been able thus...
Hey,
I have a graph for which I am supposed to fit two linear least squares line and minimize the combined residuals (the lines intersect)... I would really appreciate some info about how to do this or what this type of data analysis is called so i can google the step-by-step method.
Thanks!
Hey,
Not sure if this is the right section to post this but ...
I have a graph for which I am supposed to fit two linear least squares line and minimize the combined residuals (the lines intersect)... I would really appreciate some info about how to do this or what this type of data analysis...
Hi, as no unique unique analytical solution exists to my problem (as another poster pointed out), I have taken to solving it through a least squares method. My equation is as follows:
(s1x1 + s2x2 - I).^2 = min.
Here s1 and s2 are shift matrices (I know them), and I is a matrix of size...
Homework Statement
Solve the following linear equations simultaneously by the Least Squares solution and calculate the residuals.
Homework Equations
3x + 2y + z = 5
x + 6y - z = -7
x - y + 2z = 3
5x - 2y = 1
The Attempt at a Solution
This is a question from this guy at...
Hello y'all,
If I have n data points (xi, yi) each with error bars in both x and y (xi_err, yi_err), should I use 1/(xi_err^2+yi_err^2) as the weight in a weighted least squares linear fit, or should the weight be a different value that has nothing to do with error bars? I've never used WLS...