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

Home » Public Forums » archive » regression with error bars
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: regression with error bars [message #70921 is a reply to message #70719] Sat, 22 May 2010 08:02 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On May 22, 9:34 am, Meagan A. <u...@compgroups.net/> wrote:
> Hello,
>
> Thank you for your reply and examples. I am a newbie to IDL and I've never used MPFIT. I read the tutorial from this website:http://cow.physics.wisc.edu/~craigm/idl/mpfittut.htm l
>
> and I wrote a pro to fit a line to x and y if we had errors in y only (+/-):
>
> pro test
>
> xval = [1,2,3,4,5]
> yval = [1.2,1.9, 3.1, 4.5, 5]
> errval = [0.1,0.001,0.1,0.05,0.2]
>
> expr = 'P[0]+P[1]*X'  ;line y=A+Bx
>
> result = MPFITEXPR(expr, xval, yval,errval)
>
> plot, xval, yval, psym=2
> oplot, xval, result[0]+result[1]*xval
>
> l=linfit(xval, yval) ;no errors considered
> oplot, xval, l[0]+l[1]*xval, linestyle=1
>
> end
>
> Are the error values (errval) used in this way in the function MPFITEXPR? And if not, after I calculate the residuals using your method, how do I feed it into the function MPFITFUN ?

There are several MPFIT* functions. You can't use MPFITFUN or
MPFITEXPR because you are changing the standard definition of
"residual" because you have different + and - error bars. Instead you
will need to use the core engine MPFIT(), and you will need to write a
user function like I described in my previous post.

Craig
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: color plot over greyscale image - postscript
Next Topic: Re: how to retain header info even after writefits

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

Current Time: Fri Nov 28 10:05:29 PST 2025

Total time taken to generate the page: 0.00226 seconds