comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: xerr
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: xerr [message #64272] Wed, 17 December 2008 14:41 Go to next message
laxsri is currently offline  laxsri
Messages: 6
Registered: November 2008
Junior Member
On Dec 18, 9:08 am, Paolo <pgri...@gmail.com> wrote:
> This is discussed for example in
> section 15.3 in edition 3 of the book
> "numerical recipes".
>
Not sure how to constrain the intercept though...
It seemed rather easy to use mpfitfun! Wondering if that is wrong?

Lakshmi


> Ciao,
> Paolo
>
> Vince Hradil wrote:
>> On Dec 17, 2:27 pm, lakshmi <lax...@gmail.com> wrote:
>>> Hi,
>
>>> I've been using mpfitfun to fit measured values of period (y) and
>>> distances (x) in a linear equation y = a + bx.
>>> I would like to know if we can include the measured uncertainties in x
>>> values too?
>
>>> Thanks,
>
>>> Lakshmi
>
>> Well, since it's a linear problem you should probably choose a linear
>> solution, not mpfitfun. Also, you need to take into account the
>> variance and covariance for both x and y, so you need to solve this
>> with care.
>
>> If you google "fitting a straight line when both variables are subject
>> to error" you'll get a lot of info:http://tinyurl.com/54m8l3
Re: xerr [message #64273 is a reply to message #64272] Wed, 17 December 2008 14:34 Go to previous messageGo to next message
laxsri is currently offline  laxsri
Messages: 6
Registered: November 2008
Junior Member
Hi,
>
> Well, since it's a linear problem you should probably choose a linear
> solution, not mpfitfun. Also, you need to take into account the
> variance and covariance for both x and y, so you need to solve this
> with care.

I was also intending to fix the intercepts and calculate the gradients
and uncertainties. That is why I chose mpfitfun.
I used fitexy to obtain the best fit line with uncertainties in both
intercept and gradient.

> If you google "fitting a straight line when both variables are subject
> to error" you'll get a lot of info:http://tinyurl.com/54m8l3

Thanks for the link!

Lakshmi
Re: xerr [message #64274 is a reply to message #64273] Wed, 17 December 2008 14:08 Go to previous messageGo to next message
pgrigis is currently offline  pgrigis
Messages: 436
Registered: September 2007
Senior Member
This is discussed for example in
section 15.3 in edition 3 of the book
"numerical recipes".

Ciao,
Paolo

Vince Hradil wrote:
> On Dec 17, 2:27�pm, lakshmi <lax...@gmail.com> wrote:
>> Hi,
>>
>> I've been using mpfitfun to fit measured values of period (y) and
>> distances (x) in a linear equation y = a �+ bx.
>> I would like to know if we can include the measured uncertainties in x
>> values too?
>>
>> Thanks,
>>
>> Lakshmi
>
> Well, since it's a linear problem you should probably choose a linear
> solution, not mpfitfun. Also, you need to take into account the
> variance and covariance for both x and y, so you need to solve this
> with care.
>
> If you google "fitting a straight line when both variables are subject
> to error" you'll get a lot of info: http://tinyurl.com/54m8l3
Re: xerr [message #64275 is a reply to message #64274] Wed, 17 December 2008 13:29 Go to previous messageGo to next message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Dec 17, 2:27 pm, lakshmi <lax...@gmail.com> wrote:
> Hi,
>
> I've been using mpfitfun to fit measured values of period (y) and
> distances (x) in a linear equation y = a  + bx.
> I would like to know if we can include the measured uncertainties in x
> values too?
>
> Thanks,
>
> Lakshmi

Well, since it's a linear problem you should probably choose a linear
solution, not mpfitfun. Also, you need to take into account the
variance and covariance for both x and y, so you need to solve this
with care.

If you google "fitting a straight line when both variables are subject
to error" you'll get a lot of info: http://tinyurl.com/54m8l3
Re: xerr [message #64347 is a reply to message #64274] Thu, 18 December 2008 19:24 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Dec 17, 5:08 pm, Paolo <pgri...@gmail.com> wrote:
> This is discussed for example in
> section 15.3 in edition 3 of the book
> "numerical recipes".

I've used the Numerical Recipes hack for X errors successfully before.

As mentioned, orthogonal distance regression is the real way to do
this, but unfortunately MPFIT does not support this. [ It could in
principle with a lot of work, but doesn't in practice. ]

Craig
Re: xerr [message #64358 is a reply to message #64274] Thu, 18 December 2008 06:49 Go to previous message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On Dec 17, 5:08 pm, Paolo <pgri...@gmail.com> wrote:
> This is discussed for example in
> section 15.3 in edition 3 of the book
> "numerical recipes".
>
> Ciao,
> Paolo
>
> Vince Hradil wrote:
>> On Dec 17, 2:27 pm, lakshmi <lax...@gmail.com> wrote:
>>> Hi,
>
>>> I've been using mpfitfun to fit measured values of period (y) and
>>> distances (x) in a linear equation y = a + bx.
>>> I would like to know if we can include the measured uncertainties in x
>>> values too?
>
>>> Thanks,
>
>>> Lakshmi
>
>> Well, since it's a linear problem you should probably choose a linear
>> solution, not mpfitfun.  Also, you need to take into account the
>> variance and covariance for both x and y, so you need to solve this
>> with care.
>
>> If you google "fitting a straight line when both variables are subject
>> to error" you'll get a lot of info:http://tinyurl.com/54m8l3
>
>

On a complete tangent... how is the third edition compared to the
second? I've been hemming and hawing about picking it up.

-Jeremy.
Re: xerr [message #64363 is a reply to message #64274] Thu, 18 December 2008 05:31 Go to previous message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
On Dec 17, 5:08 pm, Paolo <pgri...@gmail.com> wrote:
> This is discussed for example in
> section 15.3 in edition 3 of the book
> "numerical recipes".
>

I have an IDL implementation of the "Numerical Recipes" algorithm at
http://idlastro.gsfc.nasa.gov/ftp/pro/math/fitexy.pro

--Wayne
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: numerical recipes (was xerr)
Next Topic: xerr

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 15:09:29 PDT 2025

Total time taken to generate the page: 1.83987 seconds