Re: [Numpy-discussion] polyfit

2013-12-18 Thread Charles R Harris
On Wed, Dec 18, 2013 at 3:38 PM, Charles R Harris wrote: > > > > On Wed, Dec 18, 2013 at 3:23 PM, Alan G Isaac wrote: > >> For teaching it is certainly nice to have >> numpy.polynomial.polynomial.polyfit >> providing modern (vs. traditional) parameter order, but >> >> - it is rather buried >> - n

Re: [Numpy-discussion] polyfit

2013-12-18 Thread Charles R Harris
On Wed, Dec 18, 2013 at 3:23 PM, Alan G Isaac wrote: > For teaching it is certainly nice to have > numpy.polynomial.polynomial.polyfit > providing modern (vs. traditional) parameter order, but > > - it is rather buried > - np.polyfit uses traditional order and has the same name > > I recall there

[Numpy-discussion] polyfit

2013-12-18 Thread Alan G Isaac
For teaching it is certainly nice to have numpy.polynomial.polynomial.polyfit providing modern (vs. traditional) parameter order, but - it is rather buried - np.polyfit uses traditional order and has the same name I recall there was some controversy (?) over all of this, but might it not be appro

Re: [Numpy-discussion] polyfit with fixed points

2013-03-07 Thread Charles R Harris
On Thu, Mar 7, 2013 at 9:22 AM, eat wrote: > Hi, > > On Thu, Mar 7, 2013 at 1:52 AM, Jaime Fernández del Río < > jaime.f...@gmail.com> wrote: > >> On Tue, Mar 5, 2013 at 5:23 AM, Charles R Harris < >> charlesr.har...@gmail.com> wrote: >> >>> >>> >>> On Tue, Mar 5, 2013 at 12:41 AM, Jaime Fernánde

Re: [Numpy-discussion] polyfit with fixed points

2013-03-06 Thread Charles R Harris
On Wed, Mar 6, 2013 at 4:52 PM, Jaime Fernández del Río < jaime.f...@gmail.com> wrote: > On Tue, Mar 5, 2013 at 5:23 AM, Charles R Harris < > charlesr.har...@gmail.com> wrote: > >> >> >> On Tue, Mar 5, 2013 at 12:41 AM, Jaime Fernández del Río < >> jaime.f...@gmail.com> wrote: >> >>> On Mon, Mar 4

Re: [Numpy-discussion] polyfit with fixed points

2013-03-06 Thread Jaime Fernández del Río
On Tue, Mar 5, 2013 at 5:23 AM, Charles R Harris wrote: > > > On Tue, Mar 5, 2013 at 12:41 AM, Jaime Fernández del Río < > jaime.f...@gmail.com> wrote: > >> On Mon, Mar 4, 2013 at 8:37 PM, Charles R Harris < >> charlesr.har...@gmail.com> wrote: >> >>> >>> There are actually seven versions of polyn

Re: [Numpy-discussion] polyfit with fixed points

2013-03-05 Thread David Pine
Jaime, If you are going to work on this, you should also take a look at the recent thread http://mail.scipy.org/pipermail/numpy-discussion/2013-February/065649.html, which is about the weighting function, which is in a confused state in the current version of polyfit. By the way, Numerical Recipe

Re: [Numpy-discussion] polyfit with fixed points

2013-03-05 Thread Charles R Harris
On Tue, Mar 5, 2013 at 6:23 AM, Charles R Harris wrote: > > > On Tue, Mar 5, 2013 at 12:41 AM, Jaime Fernández del Río < > jaime.f...@gmail.com> wrote: > >> On Mon, Mar 4, 2013 at 8:37 PM, Charles R Harris < >> charlesr.har...@gmail.com> wrote: >> >>> >>> There are actually seven versions of polyn

Re: [Numpy-discussion] polyfit with fixed points

2013-03-05 Thread Charles R Harris
On Tue, Mar 5, 2013 at 12:41 AM, Jaime Fernández del Río < jaime.f...@gmail.com> wrote: > On Mon, Mar 4, 2013 at 8:37 PM, Charles R Harris < > charlesr.har...@gmail.com> wrote: > >> >> There are actually seven versions of polynomial fit, two for the usual >> polynomial basis, and one each for Lege

Re: [Numpy-discussion] polyfit with fixed points

2013-03-04 Thread Jaime Fernández del Río
On Mon, Mar 4, 2013 at 8:37 PM, Charles R Harris wrote: > > There are actually seven versions of polynomial fit, two for the usual > polynomial basis, and one each for Legendre, Chebyshev, Hermite, Hermite_e, > and Laguerre ;) > Correct me if I am wrong, but the fitted function is the same regard

Re: [Numpy-discussion] polyfit with fixed points

2013-03-04 Thread Charles R Harris
On Mon, Mar 4, 2013 at 5:23 PM, Jaime Fernández del Río < jaime.f...@gmail.com> wrote: > A couple of days back, answering a question in StackExchange ( > http://stackoverflow.com/a/15196628/110026), I found myself using > Lagrange multipliers to fit a polynomial with least squares to data, making

Re: [Numpy-discussion] polyfit with fixed points

2013-03-04 Thread Charles R Harris
On Mon, Mar 4, 2013 at 5:53 PM, Aron Ahmadia wrote: > Interesting, that question would probably have gotten a different response > on scicomp, it is a pity we are not attracting more questions there! > > I know there are two polyfit modules in numpy, one in numpy.polyfit, the > other in numpy.pol

Re: [Numpy-discussion] polyfit with fixed points

2013-03-04 Thread Jaime Fernández del Río
On Mon, Mar 4, 2013 at 4:53 PM, Aron Ahmadia wrote: > Interesting, that question would probably have gotten a different response > on scicomp, it is a pity we are not attracting more questions there! > > I know there are two polyfit modules in numpy, one in numpy.polyfit, the > other in numpy.pol

Re: [Numpy-discussion] polyfit with fixed points

2013-03-04 Thread Aron Ahmadia
Interesting, that question would probably have gotten a different response on scicomp, it is a pity we are not attracting more questions there! I know there are two polyfit modules in numpy, one in numpy.polyfit, the other in numpy.polynomial, the functionality you are suggesting seems to fit in e

[Numpy-discussion] polyfit with fixed points

2013-03-04 Thread Jaime Fernández del Río
A couple of days back, answering a question in StackExchange ( http://stackoverflow.com/a/15196628/110026), I found myself using Lagrange multipliers to fit a polynomial with least squares to data, making sure it went through some fixed points. This time it was relatively easy, because some 5 years

Re: [Numpy-discussion] polyfit in NumPy v1.7

2013-02-27 Thread josef . pktd
On Wed, Feb 27, 2013 at 3:01 PM, David Pine wrote: > Pauli, Josef, Chuck, > > I read over the discussion on curve_fit. I believe I now understand what > people are trying to do when they write about scaling the weighting and/or > covariance matrix. And I agree that what polyfit does in its curre

Re: [Numpy-discussion] polyfit in NumPy v1.7

2013-02-27 Thread David Pine
Pauli, Josef, Chuck, I read over the discussion on curve_fit. I believe I now understand what people are trying to do when they write about scaling the weighting and/or covariance matrix. And I agree that what polyfit does in its current form is estimate the absolute errors in the data from the

Re: [Numpy-discussion] polyfit in NumPy v1.7

2013-02-27 Thread Pauli Virtanen
27.02.2013 16:40, David Pine kirjoitti: [clip] > 2. I am sorry but I don't understand your response. The matrix Vbase > in the code is already the covariance matrix, _before_ it is scaled by > fac. Scaling it by fac and returning Vbase*fac as the covariance > matrix is wrong, at least according

Re: [Numpy-discussion] polyfit in NumPy v1.7

2013-02-27 Thread josef . pktd
Please post inline so we have the context. On Wed, Feb 27, 2013 at 9:40 AM, David Pine wrote: > Chuck, > > Thanks for the quick reply. > > 1. I see your point about zero weights but the code in its current form > doesn't take into account zero weights in counting the degrees of freedom, > as you

Re: [Numpy-discussion] polyfit in NumPy v1.7

2013-02-27 Thread David Pine
Chuck, Thanks for the quick reply. 1. I see your point about zero weights but the code in its current form doesn't take into account zero weights in counting the degrees of freedom, as you point out, so it seems to me like a moot point. More importantly, the documentation doesn't explain what t

Re: [Numpy-discussion] polyfit in NumPy v1.7

2013-02-27 Thread Charles R Harris
On Wed, Feb 27, 2013 at 6:46 AM, David Pine wrote: > As of NumPy v1.7, numpy.polyfit includes an option for providing weighting > to data to be fit. It's a welcome addition, but the implementation seems a > bit non-standard, perhaps even wrong, and I wonder if someone can enlighten > me. > > 1.

[Numpy-discussion] polyfit in NumPy v1.7

2013-02-27 Thread David Pine
As of NumPy v1.7, numpy.polyfit includes an option for providing weighting to data to be fit. It's a welcome addition, but the implementation seems a bit non-standard, perhaps even wrong, and I wonder if someone can enlighten me. 1. The documentation does not specify what the weighting array "w"

Re: [Numpy-discussion] polyfit on multiple data points

2009-04-13 Thread josef . pktd
On Mon, Apr 13, 2009 at 5:59 PM, Mathew Yeates wrote: > Hi, > I understand how to fit  the points (x1,y1) (x2,y2),(x3,y3) with a line > using polyfit. But, what if I want to perform this task on every row of > an array? > For instance > > [[x1,x2,x3], >  [s1,s2,s3]] > > [[y1,y2,y3,], >  [r1,r2,r3]

[Numpy-discussion] polyfit on multiple data points

2009-04-13 Thread Mathew Yeates
Hi, I understand how to fit the points (x1,y1) (x2,y2),(x3,y3) with a line using polyfit. But, what if I want to perform this task on every row of an array? For instance [[x1,x2,x3], [s1,s2,s3]] [[y1,y2,y3,], [r1,r2,r3]] and I want the results to be the coefficients [a,b,c] and [d,e,f] wh

Re: [Numpy-discussion] Polyfit

2008-06-16 Thread Anne Archibald
2008/6/16 Chandler Latour <[EMAIL PROTECTED]>: > I believe I'm bound to python. > In terms of forcing the regression through the origin, the purpose is partly > for visualization but it also should fit the data. It would not make sense > to model the data with an initial value other than 0. Polyf

Re: [Numpy-discussion] Polyfit

2008-06-16 Thread Chandler Latour
I believe I'm bound to python. In terms of forcing the regression through the origin, the purpose is partly for visualization but it also should fit the data. It would not make sense to model the data with an initial value other than 0. On Jun 16, 2008, at 4:33 PM, Simon Palmer wrote: At

Re: [Numpy-discussion] Polyfit

2008-06-16 Thread Simon Palmer
At the risk of uttering a heresy, are you bound to Python for this? I bet you could find a C library that will work well, plus it is not a hard algorithm to code yourself. I am pretty sure I have used a numerical recipes algorithm for regression in my distant past. Also I can't help thinking the

Re: [Numpy-discussion] Polyfit

2008-06-16 Thread Charles R Harris
On Mon, Jun 16, 2008 at 1:47 PM, Chandler Latour <[EMAIL PROTECTED]> wrote: > Yes, exactly what I meant. > Polyfit just fits polynomials, there is no way of fixing the constant to zero. Your best bet is to use linalg.lstsq directly to fit the function you want. Chuck

Re: [Numpy-discussion] Polyfit

2008-06-16 Thread Chandler Latour
Yes, exactly what I meant. On Jun 16, 2008, at 2:39 PM, Charles R Harris wrote: On Mon, Jun 16, 2008 at 1:30 PM, Chandler Latour <[EMAIL PROTECTED]> wrote: Hello, I'm new to the whole numpy scene, but I've been wanting to run a regression on some data. I belive that polyfit is the way to

Re: [Numpy-discussion] Polyfit

2008-06-16 Thread Charles R Harris
On Mon, Jun 16, 2008 at 1:30 PM, Chandler Latour <[EMAIL PROTECTED]> wrote: > Hello, > > I'm new to the whole numpy scene, but I've been wanting to run a > regression on some data. I belive that polyfit is the way to go, but > I was wondering if there exists a way to force the intercept to be 0.

[Numpy-discussion] Polyfit

2008-06-16 Thread Chandler Latour
Hello, I'm new to the whole numpy scene, but I've been wanting to run a regression on some data. I belive that polyfit is the way to go, but I was wondering if there exists a way to force the intercept to be 0. Any help would be much appreciated. Thanks ___