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

Home » Public Forums » archive » linfit and regress questions
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
linfit and regress questions [message #56693] Sun, 11 November 2007 08:27 Go to next message
rlayberry is currently offline  rlayberry
Messages: 33
Registered: November 2004
Member
Hi

I am interested in fitting a line of the form y=mx+c using regress or
linfit. I want the option of fixing the value of c at zero. Can I do
this in either of these 2 functions or would I need to use something
else?

Thanks

Russ
Re: linfit and regress questions [message #56766 is a reply to message #56693] Tue, 13 November 2007 08:14 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
rlayberry@hotmail.com writes:
> On 13 Nov, 03:16, Craig Markwardt
> <craigm...@REMOVEcow.physics.wisc.edu> wrote:
>> hradilv <hrad...@yahoo.com> writes:
>>
>>> Transform the data?
>>
>>> mhat = total(x*(y-c1))/total(x*x)
>>
>> Of course this all assumes the data are meant to be equally weighted
>> (no error bars, or all error bars are equal).
>>
>
> and does anyone know how the chi-sq or any other goodness of fit
> paramater would be calculated?

Do you mean, how to compute the chi-square value? Probably something
like,
TOTAL( ((Y-MHAT*X)/ERROR)^2 )

But you've never really specified what you are trying to do. Why not
just use a fitting program like MPFITFUN or CURVEFIT and specify
whatever model and/or error bars that you want?

Craig
Re: linfit and regress questions [message #56768 is a reply to message #56693] Tue, 13 November 2007 02:24 Go to previous message
rlayberry is currently offline  rlayberry
Messages: 33
Registered: November 2004
Member
On 13 Nov, 03:16, Craig Markwardt
<craigm...@REMOVEcow.physics.wisc.edu> wrote:
> hradilv <hrad...@yahoo.com> writes:
>
>> Transform the data?
>
>> mhat = total(x*(y-c1))/total(x*x)
>
> Of course this all assumes the data are meant to be equally weighted
> (no error bars, or all error bars are equal).
>

and does anyone know how the chi-sq or any other goodness of fit
paramater would be calculated?

russ
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: how can I call idl function in other language program
Next Topic: Problem with PLOT_OO ticks

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

Current Time: Fri Oct 10 07:42:31 PDT 2025

Total time taken to generate the page: 0.48651 seconds