Re: Fitting a function with multiple independent variables [message #43609] |
Wed, 20 April 2005 13:02 |
Sean Davis
Messages: 19 Registered: August 1999
|
Junior Member |
|
|
Problem Solved!!!
A Big thanks to Craig M. and his fitting routines!!!
http://cow.physics.wisc.edu/~craigm/idl/idl.html
Specifically, I downloaded MPFITFUN.pro and MPFIT.pro
-Sean
maarten wrote:
> Hello,
>
> You can use the built in routine curvefit.
> cheers maarten
>
> Sean Davis wrote:
>> Hello all,
>>
>> I am currently trying to fit a function with multiple independent
>> variables. I have used IDL's REGRESS routine, which does a multiple
>> linear regression, such as fits to something like:
>>
>> Y = 5 + 3*X1 - 4*X2
>>
>> But what if I want one of my independent variables to vary non-linearly,
>> like
>>
>> Y = 5 + 3*X1^2 - 4*X2
>>
>> (I assume this is called non-linear regression?)
>>
>> I've heard of Craig M.'s fitting library, so I suppose I should look
>> there. But for the record, are there any built-in programs in IDL to do
>> this???
>>
>> Thanks,
>> Sean
>>
|
|
|
Re: Fitting a function with multiple independent variables [message #43612 is a reply to message #43609] |
Wed, 20 April 2005 11:31  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
Sean Davis <seand@colorado.edu> writes:
> Actually, CURVEFIT does not work for that task. CURVEFIT fits a function
> with multiple parameters (a,b,c), like
>
> y = a*x + b*x^2 + c*exp(x),
>
> but not functions with multiple independent variables AND paramaters, like
>
> y = a*x1 + b*x2^2 + c*exp(x3)
This is not true. CURVEFIT does nonlinear least squares, such as your
second expression. The number of independent variables is irrelevant.
You can have no independent variables if you want! The comments here:
http://cow.physics.wisc.edu/~craigm/idl/fitqa.html#multivar
apply to CURVEFIT as well as MPFIT. Not that I am defending
CURVEFIT. :-)
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: Fitting a function with multiple independent variables [message #43617 is a reply to message #43612] |
Wed, 20 April 2005 09:30  |
Sean Davis
Messages: 19 Registered: August 1999
|
Junior Member |
|
|
maarten wrote:
> Hello,
>
> You can use the built in routine curvefit.
> cheers maarten
>
> Sean Davis wrote:
>> Hello all,
>>
>> I am currently trying to fit a function with multiple independent
>> variables. I have used IDL's REGRESS routine, which does a multiple
>> linear regression, such as fits to something like:
>>
>> Y = 5 + 3*X1 - 4*X2
>>
>> But what if I want one of my independent variables to vary non-linearly,
>> like
>>
>> Y = 5 + 3*X1^2 - 4*X2
>>
>> (I assume this is called non-linear regression?)
>>
>> I've heard of Craig M.'s fitting library, so I suppose I should look
>> there. But for the record, are there any built-in programs in IDL to do
>> this???
>>
>> Thanks,
>> Sean
>>
Actually, CURVEFIT does not work for that task. CURVEFIT fits a function
with multiple parameters (a,b,c), like
y = a*x + b*x^2 + c*exp(x),
but not functions with multiple independent variables AND paramaters, like
y = a*x1 + b*x2^2 + c*exp(x3)
-Sean
|
|
|
Re: Fitting a function with multiple independent variables [message #43624 is a reply to message #43617] |
Wed, 20 April 2005 01:06  |
maarten
Messages: 30 Registered: April 2002
|
Member |
|
|
Hello,
You can use the built in routine curvefit.
cheers maarten
Sean Davis wrote:
> Hello all,
>
> I am currently trying to fit a function with multiple independent variables.
> I have used IDL's REGRESS routine, which does a multiple linear regression,
> such as fits to something like:
>
> Y = 5 + 3*X1 - 4*X2
>
> But what if I want one of my independent variables to vary non-linearly,
> like
>
> Y = 5 + 3*X1^2 - 4*X2
>
> (I assume this is called non-linear regression?)
>
> I've heard of Craig M.'s fitting library, so I suppose I should look there.
> But for the record, are there any built-in programs in IDL to do this???
>
> Thanks,
> Sean
>
|
|
|