![]()
MATH566 Lesson 11: Least squares approximation
|
Motivation: data points might be affected by errors. The interpolation criterion , i.e., exactly recover the function values is not appropriate.
Minimal norm approximation criteria
Solving linear least squares problems
Nonlinear least squares problems
![]()
Minimal norm approximation criteria
|
Problem: approximate by , , are approximant parameters
Best approximants can be defined in terms of error minimization
Examples. Assume known by sample
Interpolation: . Verify norm properties:
,
on grid
Least-sqaures: use 2-norm
Min-max: use inf norm
![]()
Linear least squares
|
Based on two ideas:
Approximant is a linear combination,
Error is measured by 2-norm
Choose a basis set:
Monomial
Trigonometric , ,
Exponential
Evaluate basis set at grid points , obtain matrix
Seek
![]()
Orthogonal projection in linear spaces
|
Projection of along direction ,
Projection matrix
![]()
Projection examples
|
Projection along direction in
Projection along direction of vector in :
First obtain a vector of unit norm
Projection matrix
![]()
Orthonormal vector set
|
Definition. The Dirac delta symbol is defined as
Definition. A set of vectors is said to be orthonormal if
The column vectors of the identity matrix are orthonormal
Columns of are orthonormal if
![]()
Geometric solution of least squares problem
|
Linear least squares problems (LLSQ) easily solved by Pythagorean theorem
Solution is orthgonal projection onto
The LLSQ parameter vector is found by back-substitution from
![]()
LLSQ polynomial approximants
|
Consider data
The polynomial interpolant of degree passes through the data points
Impose conditions to obtain linear system
>> |
m=4; x=transpose(1:m); y=1 - 2*x + 3*x.^2 - 4*x.^3; |
>> |
A=[x.^0 x.^1 x.^2 x.^3]; [Q,R]=qr(A); c = R \ (Q'*y); c' |
![]()
Linear regression
|
Consider noisy data containing many measurements
Assume data without noise would conform to some polynomial law
with a random number uniformly distributed within .
>> |
m=100; x=linspace(0,1,m)'; |
>> |
c0=2; c1=3; z=c0+c1*x; y=(z+rand(m,1)-0.5); |
>> |
A=ones(m,2); A(:,2)=x(:); [Q,R]=qr(A); c = R \ (Q'*y); c' |
>> |
w=A*c; plot(x,z,'k',x,y,'.r',x,w,'g'); |
![]()
LSQ parabolic approximant
|
Consider noisy data containing many measurements
Assume data without noise would conform to some polynomial law
with a random number uniformly distributed within .
>> |
m=100; x=linspace(0,3,m)'; |
>> |
c0=1; c1=1; c2=3; z=c0+c1*x+c2*x.^2; y=(z+rand(m,1)-0.5); |
>> |
A=ones(m,3); A(:,2)=x(:); A(:,3)=x(:).^2; [Q,R]=qr(A); c=R\(Q'*y); c' |
>> |
w=A*c; plot(x,z,'k',x,y,'.r',x,w,'g'); |