topic Least squares weighted fit using the MKL in IntelĀ® oneAPI Math Kernel Library & IntelĀ® Math Kernel Library
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Least-squares-weighted-fit-using-the-MKL/m-p/830438#M5496
Hi<BR /><BR />Thank you for your answer.<BR /><BR />In case I have weight values close to zero, won't this transformation make my fit unstable?<BR /><BR />Best regardsTue, 04 Jan 2011 13:00:08 GMThareson2011-01-04T13:00:08ZLeast squares weighted fit using the MKL
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Least-squares-weighted-fit-using-the-MKL/m-p/830436#M5494
Hi All<BR /><BR />I have been using MKL for a bit now, and I would like to improve the speed for a weighted linear fit. The fitting function is a simple<BR /><BR />y = a * x + b<BR /><BR />The input is a vector <I>e</I>, which contains the values of equally spaced samples of the function. The values start at 0, and have a distance of 1, i.e. x = {0,1,2,3,...,N-1}. This can be changed if it suits the algorithm better. There is another input <I>w</I>, which is the weighting of each sample point.<BR /><BR />The calculation I would like to do is the minimization of the following:<BR /><BR />minimize WSS = w_i * ( y_i - ( a * x_i + b ))<SUP>2</SUP> <BR /><BR /><BR /><BR />One way of doing it would be to create the full vandermonde matrix, and then solve the system using the inverse etc, but is there a better way of doing it?<BR /><BR />Also, I am solving it a number of times, where the length of the fit is changing based on the data, so I need to create a new matrix each time.<BR /><BR />There are a few threads discussing linear regression, but I can't figure them out exactly.<BR /><BR />All help is appreciated.<BR /><BR /><BR />Best regards<BR /><BR />Henrik Andresen<BR />Tue, 04 Jan 2011 11:11:43 GMThttps://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Least-squares-weighted-fit-using-the-MKL/m-p/830436#M5494hareson2011-01-04T11:11:43ZLeast squares weighted fit using the MKL
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Least-squares-weighted-fit-using-the-MKL/m-p/830437#M5495
The transformation z_i := y_i \sqrt w_i will enable you to use the uniform weight QR based least-squares solver in the MKL to be used.<BR /><BR />If you want to avoid the square roots, you can modify an existing source code for uniform weight QR.Tue, 04 Jan 2011 12:55:03 GMThttps://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Least-squares-weighted-fit-using-the-MKL/m-p/830437#M5495mecej42011-01-04T12:55:03ZLeast squares weighted fit using the MKL
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Least-squares-weighted-fit-using-the-MKL/m-p/830438#M5496
Hi<BR /><BR />Thank you for your answer.<BR /><BR />In case I have weight values close to zero, won't this transformation make my fit unstable?<BR /><BR />Best regardsTue, 04 Jan 2011 13:00:08 GMThttps://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Least-squares-weighted-fit-using-the-MKL/m-p/830438#M5496hareson2011-01-04T13:00:08ZLeast squares weighted fit using the MKL
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Least-squares-weighted-fit-using-the-MKL/m-p/830439#M5497
The stability question is addressed in <A href="http://www.maths.manchester.ac.uk/~higham/papers/cohi98.pdf">this paper.</A>
If you attach a weight close to zero to a data pair, it is as if that data pair were not included in the fit, and it would be reasonable if the fitted value did not agree with an observation in which one has little faith.Tue, 04 Jan 2011 15:44:35 GMThttps://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/Least-squares-weighted-fit-using-the-MKL/m-p/830439#M5497mecej42011-01-04T15:44:35Z