Re: linear fit y=ax [message #46667] |
Wed, 07 December 2005 09:47 |
mmeron
Messages: 44 Registered: October 2003
|
Member |
|
|
In article <1133972085.075357.230360@z14g2000cwz.googlegroups.com>, lajam@caramail.com writes:
> Hello,
>
> I have a very easy question but I didn't find the answer in the IDL
> reference guide. I want to fit data with a linear fit y=ax. I want to
> impose my fit to pass by zero. I have looked at the linfit, regress,
> ... functions and I didn't understand how to adapt these functions for
> my problem. I have tried with regress:
> result=regress(desired_value,calculated_value,weigths) but I'm not sure
> that it's the regular way to obtain calculated_value=A*desired_value.
> Could someone help me, please?
>
You can look in my library, MIDL, on the RSI user contributions page.
Chack out the routine LINFIT_MM. It'll do just what you ask for (and
much more)
Mati Meron | "When you argue with a fool,
meron@cars.uchicago.edu | chances are he is doing just the same"
|
|
|
Re: linear fit y=ax [message #46670 is a reply to message #46667] |
Wed, 07 December 2005 08:48  |
Paolo Grigis
Messages: 171 Registered: December 2003
|
Senior Member |
|
|
Paolo Grigis wrote:
>
>
> lajam@caramail.com wrote:
>
>> Hello,
>>
>> I have a very easy question but I didn't find the answer in the IDL
>> reference guide. I want to fit data with a linear fit y=ax. I want to
>> impose my fit to pass by zero. I have looked at the linfit, regress,
>> ... functions and I didn't understand how to adapt these functions for
>> my problem. I have tried with regress:
>> result=regress(desired_value,calculated_value,weigths) but I'm not sure
>> that it's the regular way to obtain calculated_value=A*desired_value.
>
>
> try: total(y)/total(x)
actually, I meant total(y*x)/total(x*x)
>
>
> Ciao,
> Paolo
>
>
>> Could someone help me, please?
>>
>>
>> Thanks,
>> Cedric
>>
|
|
|
Re: linear fit y=ax [message #46671 is a reply to message #46670] |
Wed, 07 December 2005 08:32  |
Paolo Grigis
Messages: 171 Registered: December 2003
|
Senior Member |
|
|
lajam@caramail.com wrote:
> Hello,
>
> I have a very easy question but I didn't find the answer in the IDL
> reference guide. I want to fit data with a linear fit y=ax. I want to
> impose my fit to pass by zero. I have looked at the linfit, regress,
> ... functions and I didn't understand how to adapt these functions for
> my problem. I have tried with regress:
> result=regress(desired_value,calculated_value,weigths) but I'm not sure
> that it's the regular way to obtain calculated_value=A*desired_value.
try: total(y)/total(x)
Ciao,
Paolo
> Could someone help me, please?
>
>
> Thanks,
> Cedric
>
|
|
|