Linear Least squares

Similar documents
Numerical Methods. Elena loli Piccolomini. Civil Engeneering. piccolom. Metodi Numerici M p. 1/??

Computational Methods. Least Squares Approximation/Optimization

Matrix decompositions

AM 205: lecture 8. Last time: Cholesky factorization, QR factorization Today: how to compute the QR factorization, the Singular Value Decomposition

Q T A = R ))) ) = A n 1 R

Applied Mathematics 205. Unit II: Numerical Linear Algebra. Lecturer: Dr. David Knezevic

Orthogonal Transformations

AMS526: Numerical Analysis I (Numerical Linear Algebra)

Review Questions REVIEW QUESTIONS 71

Lecture 3: QR-Factorization

LU Factorization. LU factorization is the most common way of solving linear systems! Ax = b LUx = b

This can be accomplished by left matrix multiplication as follows: I

Lecture 6, Sci. Comp. for DPhil Students

Lecture 11. Linear systems: Cholesky method. Eigensystems: Terminology. Jacobi transformations QR transformation

Linear Algebra, part 3. Going back to least squares. Mathematical Models, Analysis and Simulation = 0. a T 1 e. a T n e. Anna-Karin Tornberg

Computational Linear Algebra

Linear Algebra, part 3 QR and SVD

ENGG5781 Matrix Analysis and Computations Lecture 8: QR Decomposition

Numerical Methods I Non-Square and Sparse Linear Systems

Linear Algebra Review

AM205: Assignment 2. i=1

Lecture 6. Numerical methods. Approximation of functions

Orthonormal Transformations and Least Squares

Important Matrix Factorizations

Parallel Numerical Algorithms

STAT 309: MATHEMATICAL COMPUTATIONS I FALL 2018 LECTURE 9

Numerical Methods - Numerical Linear Algebra

Linear Analysis Lecture 16

Scientific Computing: An Introductory Survey

Linear Algebraic Equations

7. Dimension and Structure.

Lecture Notes to Accompany. Scientific Computing An Introductory Survey. by Michael T. Heath. Chapter 2. Systems of Linear Equations

Matrix Factorization and Analysis

Problem set 5: SVD, Orthogonal projections, etc.

STAT 309: MATHEMATICAL COMPUTATIONS I FALL 2018 LECTURE 13

Orthogonalization and least squares methods

Rank Revealing QR factorization. F. Guyomarc h, D. Mezher and B. Philippe

5.6. PSEUDOINVERSES 101. A H w.

B553 Lecture 5: Matrix Algebra Review

Linear Algebra in Actuarial Science: Slides to the lecture

Preliminary/Qualifying Exam in Numerical Analysis (Math 502a) Spring 2012

Linear Least-Squares Data Fitting

Numerical Linear Algebra Chap. 2: Least Squares Problems

Ax = b. Systems of Linear Equations. Lecture Notes to Accompany. Given m n matrix A and m-vector b, find unknown n-vector x satisfying

Linear Algebra. Brigitte Bidégaray-Fesquet. MSIAM, September Univ. Grenoble Alpes, Laboratoire Jean Kuntzmann, Grenoble.

14.2 QR Factorization with Column Pivoting

Solution of Linear Equations

9. Numerical linear algebra background

Cheat Sheet for MATH461

be a Householder matrix. Then prove the followings H = I 2 uut Hu = (I 2 uu u T u )u = u 2 uut u

3 QR factorization revisited

AMS526: Numerical Analysis I (Numerical Linear Algebra)

9. Numerical linear algebra background

Householder reflectors are matrices of the form. P = I 2ww T, where w is a unit vector (a vector of 2-norm unity)

Lecture 9. Errors in solving Linear Systems. J. Chaudhry (Zeb) Department of Mathematics and Statistics University of New Mexico

Problem 1. CS205 Homework #2 Solutions. Solution

Practical Linear Algebra: A Geometry Toolbox

Math 407: Linear Optimization

Numerical Linear Algebra

Notes on Householder QR Factorization

AMS 209, Fall 2015 Final Project Type A Numerical Linear Algebra: Gaussian Elimination with Pivoting for Solving Linear Systems

AMS526: Numerical Analysis I (Numerical Linear Algebra for Computational and Data Sciences)

Applied Numerical Linear Algebra. Lecture 8

SUMMARY OF MATH 1600

Lecture 4 Orthonormal vectors and QR factorization

Index. book 2009/5/27 page 121. (Page numbers set in bold type indicate the definition of an entry.)

Math 102, Winter Final Exam Review. Chapter 1. Matrices and Gaussian Elimination

lecture 2 and 3: algorithms for linear algebra

Topics. Vectors (column matrices): Vector addition and scalar multiplication The matrix of a linear function y Ax The elements of a matrix A : A ij

MAT 610: Numerical Linear Algebra. James V. Lambers

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS. + + x 1 x 2. x n 8 (4) 3 4 2

DEN: Linear algebra numerical view (GEM: Gauss elimination method for reducing a full rank matrix to upper-triangular

Orthonormal Transformations

L2-7 Some very stylish matrix decompositions for solving Ax = b 10 Oct 2015

2.1 Gaussian Elimination

Computational Methods. Systems of Linear Equations

Part IB - Easter Term 2003 Numerical Analysis I

A fast randomized algorithm for approximating an SVD of a matrix

CS412: Lecture #17. Mridul Aanjaneya. March 19, 2015

The Full-rank Linear Least Squares Problem

AMS526: Numerical Analysis I (Numerical Linear Algebra)

1 9/5 Matrices, vectors, and their applications

ECEN 615 Methods of Electric Power Systems Analysis Lecture 18: Least Squares, State Estimation

Algebra C Numerical Linear Algebra Sample Exam Problems

YORK UNIVERSITY. Faculty of Science Department of Mathematics and Statistics MATH M Test #2 Solutions

orthogonal relations between vectors and subspaces Then we study some applications in vector spaces and linear systems, including Orthonormal Basis,

ANALYTICAL MATHEMATICS FOR APPLICATIONS 2018 LECTURE NOTES 3

Mobile Robotics 1. A Compact Course on Linear Algebra. Giorgio Grisetti

Gaussian Elimination and Back Substitution

Applied Linear Algebra

MODULE 8 Topics: Null space, range, column space, row space and rank of a matrix

The Solution of Linear Systems AX = B

A Review of Matrix Analysis

Krylov Subspace Methods that Are Based on the Minimization of the Residual

CSE 160 Lecture 13. Numerical Linear Algebra

MIDTERM. b) [2 points] Compute the LU Decomposition A = LU or explain why one does not exist.

lecture 3 and 4: algorithms for linear algebra

Block Lanczos Tridiagonalization of Complex Symmetric Matrices

4.2. ORTHOGONALITY 161

We will discuss matrix diagonalization algorithms in Numerical Recipes in the context of the eigenvalue problem in quantum mechanics, m A n = λ m

Transcription:

Linear Least squares

Method of least squares Measurement errors are inevitable in observational and experimental sciences Errors can be smoothed out by averaging over more measurements than necessary to determine parameters of system Resulting system is overdetermined, so usually there is no exact solution In effect, higher dimensional data are projected into lower dimensional space to suppress irrelevant detail Such projection is most conveniently accomplished by method of least squares

Linear least squares For overdetermined linear system Ax = b m>n Better represented as Axe=b Least square solution x obtained by minimising residual vector r = b Ax min x r 2 2 =min x b Ax 2 2

Data Fitting Given m data points (ti,yi) find n-vector find Problem can be written in matrix form as

Existence/Uniqueness Always has a solution Solution is unique iff. No unique solution if rank(a) <n

Normal equations Minimising euclidean norm of residual vector min x r 2 2 = r T r =(b Ax) T (b Ax) = b T b 2x T A T b + x T A T Ax take derivative wrt x 2A T b +2A T Ax =0 A T Ax = A T b

Orthogonality A T r = A T (b Ax) A T Ax = A T b

Solving Normal equations If A has rank n then A T A is positive definite Using Cholesky factorisation A T A = LL T Obtain solution to A T Ax = A T b

Solving Normal equations If A has rank n then A T A is positive definite Using Cholesky factorisation A T A = LL T Obtain solution to A T Ax = A T b Normal equations method involves rectangular square triangular

Shortcomings Information can be lost in forming A T A and A T b A = 2 1 3 1 4 05 A T A = 0 apple 1+ 2 1 1 1+ 2 = apple 1 1 1 1 < p mach

Shortcomings

Shortcomings Similarly, for perturbation E in matrix A x 2 x 2 < ([cond(a)] 2 tan( )+cond(a)) E 2 A 2 Sensitivity of least squares solution is worsened as cond(a T A)=[cond(A)] 2

Augmented System Method (m + n) (m + n) augmented system apple I A A T 0 apple r x = apple b 0 Greater freedom in choosing pivots in computing LDL or LU apple I A apple r/ A T 0 x = apple b 0 = max i,j a ij /1000

Augmented System Method (m + n) (m + n) augmented system apple I A A T 0 apple r x = apple b 0 System not positive definite Larger than original System Requires storing of two copies of A

What kind of transformation leaves least square solution unchanged?

Orthogonal Transformation Q T Q = I Norm preserving Qv 2 2 =(Qv)T Qv = v T Q T Qv = v 2 2 Multiplying both sides of least squares problem by Q does not change its solution

Triangular Least Squares Upper triangular overdetermined least square problem apple R 0 x = apple b1 b 2 Residual r 2 2 = b 1 Rx 2 2 + b 2 2 2 Enough to solve Rx = b 1

QR factorisation We seek orthogonal matrix Q such that A = Q apple R 0 Least squares problem transformed into triangular least squares problem Q T Ax = apple R 0 x e= apple c1 c 2 = Q T b

Orthogonal Bases Partitioning Q, as A = Q apple R 0 Q = Q 1 Q 2 we get = Q 1 Q 2 apple R 0 = Q 1R Reduced QR of A Solution to least squares problem given by, Q T 1 Ax = Rx = c 1 = Q T 1 b

Computing QR factorization Annihilate sub-diagonal entries of successive columns of A, eventually reaching upper triangular form. Similar to by Gaussian elimination, but use orthogonal transformations. Householder transformations Givens rotations Gram-Schmidt orthogonalization

Householder Transformation Householder transformation has form : H = I 2 vvt v T v H is orthogonal and symmetric H = H T = H 1

Householder Transformation Given vector a we want to choose v so that Ha = 2 6 6 6 6 6 6 4 0... 0 3 7 7 7 7 7 7 5 = 2 6 6 6 6 6 6 4 1 0... 0 3 7 7 7 7 7 7 5 = e 1 Substituting into formula for H, v = a e 1 2 = a 2

Householder QR Annihilate sub diagonal entries of each successive column using Householder transformations Applied to entire matrix, but does not affect prior columns Applying H to arbitrary vector u, Hu = I 2 vvt v T v u = u 2 vt u v T v v

Householder QR Factorisation process H n...h 1 A = apple R 0 if Q = H 1...H n then A = Q apple R 0 Then solve triangular least squares problem apple R 0 xe=qt b

Householder QR Product Q need not be formed explicitly R can be stored in upper triangle of A vectors stored in (now zero) lower triangular portion of A

Givens Rotations Introduce zeros one at a time, chose c and s so that apple c s s c apple a1 a 2 = c 2 + s 2 =1or = q apple 0 a 2 1 + a2 2 c = a 1 p a 2 1 + a 2 2 s = a 2 p a 2 1 + a 2 2

Givens QR Generally, to annihilate selected component, rotate target with another component 2 3 1 0 0 0 0 0 c 0 s 0 60 0 1 0 0 7 40 s 0 c 05 0 0 0 0 1 2 6 4 a 1 a 2 a 3 a 4 a 5 3 7 = 5 2 6 4 a 1 a 3 0 a 5 3 7 5

Givens QR Requires about 50% more work than Householder method. Also requires more storage. These disadvantages can be overcome, but requires more complicated implementation Adv. for computing QR for sparse A

Gram-Schmidt orthogonalization Given vectors a1 and a2, Seek orthonormal vectors q1 and q2 having same span a 1 a 2 q 1 q 2 a 2 (q T 1 a 2 )q 1

Gram-Schmidt Algorithm Classical Gram-Schmidt : Process extended to any number of vectors for k =1! n do q k = a k for j =1! k 1 do r jk = qj T a k q k = q k r jk q j end for r kk = q k 2 q k = q k /r kk q j end for

Modified Gram-Schmidt Classical Gram schmidt procedure often suffers loss of orthogonality in finite precision Seperate storage required A Q and R Both deficiencies are dealt by modified gram-schmidt

Modified Gram-Schmidt Classical Gram-Schmidt : Process extended to any number of vectors for k =1! n do r kk = a k 2 q k = a k /r kk for j = k +1! n do r jk = qk T a j a j = a j r kj q k end for end for

Comparison of Methods Forming normal equations matrix ATA requires about n^2m /2 multiplications. and solving resulting symmetric linear system requires about n^3/6 Solving least squares problem using Householder QR factorization requires about mn^2 -n^3/3 multiplicatlons if m= n, both methods require about same amount ofwork If m >>n. Householder QR requires about twice as much work as normal equations Cost of SVD is proportional to mn^2 + n^3. with proportionality constant ranging from 4 to 10, depending onalgorithm used

Comparision of Methods Householder more accurate and broadly applicable Normal equations provide sufficient accuracy when well conditioned When rank deficient, householder with column pivoting can be used when normal method fails outright

Comparision of Methods Normal equations method produces solution with relative error proportional to [cond(a)]^2 Cholesky breaks down at cond(a) inversely proportional to machine precision Householder relative error proportional to inherent sensitivity of least square problem