[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multiple non-linear regression analysis



Thank you Bill Thompson for advice about multiple nonlinear regression.
I tried to use LMFIT by setting independent variable in structure as
you told, but the IDL refused to process LMFIT function with structure.
Error message is "% FLOAT: Struct expression not allowed in this context:
X."


The following is my test program:
------------------- start of test.pro ----------
function fn, s, a
a=float(a)
f=a[0]*s.x1+a[1]*s.x2
return, [f, s.x1, s.x2]
end

pro test

s={x1: 0.0, x2: 0.0}
x1=findgen(10)
x2=x1*x1
s=replicate(s, 10)
s.x1=x1
s.x2=x2
y=1.2*x1+2.3*x2
a=[0.1, 0.1]
fit=lmfit(s,y,a,function_name='fn')
end

------------------- end of test.pro ---------------------

Then the performance and error message is like this:

IDL> .compile test
% Compiled module: FN.
% Procedure was compiled while active: TEST. Returning.
% Compiled module: TEST.
IDL> test
% FLOAT: Struct expression not allowed in this context: X.
% Error occurred at:  LMFIT             245
/usr/local/rsi/envi_3.1/idl_5.1/lib/lmfit.pro
%                     TEST               17 test.pro
%                     $MAIN$
% Execution halted at:  TEST               17 test.pro
IDL>



Kenlo Nishida
kenlo@ntsg.umt.edu