[Date Index]
[Thread Index]
[Author Index]
NonlinearRegress of user functions
*To*: mathgroup at smc.vnet.net
*Subject*: [mg91518] NonlinearRegress of user functions
*From*: "Ngoc Anh Lai" <ngocanh.lai at boku.ac.at>
*Date*: Mon, 25 Aug 2008 05:05:57 -0400 (EDT)
Greetings all,
I have problem with nolinearRegress of my functions. Could you please
tell me what should I do to solve my problem?.
The problem is:
I have experimental data set of (Texp, pexp, rhoexp). With each value of
Texp, I will calculate pcal and rhocal by using functions pcal = psT[T,
A, B, C, D, E] and rhocal = rhoT[T, A, B, C, D, E]. Parameters A, B, C,
D, E of the functions psT and rhoT will be found by Minimization of
(1-pcal/ pexp)^2+(1- rhocal/ rhoexp)^2 for all experimental data points.
rhocal and pcal is found by iteration and guessing of some value in
functions psT[T, A, B, C, D, E] and rhoT[T, A, B, C, D, E] provided
values of T, A, B, C, D, E are given.
To solve the problem, I define
+ rhoT[T_,A_,B_,C_,D_,E_]:=Module[{rho}, â?? bunch of commands and
iterative procedures related to T, A, B, C, D, E to find rhoâ??, rho];
+ psT[T_,A_,B_,C_,D_,E_]:=Module[{ps}, â?? bunch of commands and iterative
procedures related to T, A, B, C, D, E to find psâ??, ps];
+ and experimental data set: tprho = {Texp, pexp, rhoexp}.
Firstly, I try to Minimize as:
toiuu=NMinimize[{Plus@@Table[(1-psT[tprho[[i,1]],
A1,B1,C1,D1,E1]/tprho[[i,2]])^2 + (1-rhoT[tprho[[i,1]],
A1,B1,C1,D1,E1]/tprho[[i,3]])^2,{i,Length[tprho[[All,1]]]}],
320.0<A1<550, 0.8<B1<1.8, 0.8<C1<1.80, 0.0<D1<20,
0.0<E1<20},{A1,B1,C1,D1,E1}];
{ A,B,C,D,E }={ A1,B1,C1,D1,E1}/.Last[toiuu];
I receive { A,B,C,D,E } ={ 327.593,1.63175,1.8,20.,0.00224707} while the
corrected values should be {A,B,C,D,E}
={440.2208,1.5161,1.4600,0.8646,4.9666}. I also shorten the constrained
range of {A1,B1,C1,D1,E1} close to the corrected values of {A,B,C,D,E}
but it is still give the wrong answers.
Secondly, I try to use NoninearRegress as:
tprho[[All,4]]=0;
caseall=NonlinearRegress[tprho[[All,{1,2,3,4}]],(1-psT[T,A1,B1,C1,D1,E1]/pexp)^2
+ (1-rhoT[T,A1,B1,C1,D1,E1]/rhoexp)^2,{T,pexp, rhoexp
},{{A1,440},{B1,1.516},{C1,1.46},{D1,0.88},{E1,4.9}},RegressionReport->{BestFitParameters}];
{ A,B,C,D,E }={ A1,B1,C1,D1,E1}/.BestFitParameters/.caseall;
I receive { A,B,C,D,E } ={ 39094.2,341.312,96.922,27.3373,-155.741}. In
my opinion, this case, the psT and rhoT may not be call correctly
because the total running time of this NonlinearRegress is 0.141s while
I have 22 experimental data point and each data point need 5.125s to run
the function psT and 5.094s for function rhoT. The total running time
have to larger than 22*(5.125+5.094)s but not 0.141s. For this case, I
receive error messages as:
Set::shape: Lists \
{Statistics`NonlinearFit`Private`params,Statistics`NonlinearFit`Private`start,\
\[LeftSkeleton]38\[RightSkeleton],\[LeftSkeleton]38\[RightSkeleton],\
Statistics`NonlinearFit`Private`minr,Statistics`NonlinearFit`Private`maxr}
and \
{{$Failed,$Failed,$Failed,$Failed,$Failed},{$Failed,$Failed,$Failed,$Failed,$\
Failed},{$Failed,\[LeftSkeleton]3\[RightSkeleton],$Failed},{$Failed,$Failed,$Failed,$\
Failed,$Failed},{$Failed,$Failed,$Failed,$Failed,$Failed}}
are not the same shape.
Transpose::nmtx: The first two levels of the one-dimensional list
{Statistics`NonlinearFit`Private`params,Statistics`NonlinearFit`Private`minr,\
Statistics`NonlinearFit`Private`maxr} cannot be transposed.
Part::partw: Part 2 of {} does not exist
NonlinearFit::srange : The starting point
Statistics`NonlinearFit`Private`start for the least \
squares search for parameter estimates is outside the prescribed
parameter range
Transpose[Statistics`NonlinearFit`Private`minrâ?¤Statistics`NonlinearFit`\
Private`paramsâ?¤Statistics`NonlinearFit`Private`maxr].
and so on.
I really do not know which command or procedure or manipulation should
be implemented.
Could you please give me some suggestions.
Thanks and regards,
LAI Ngoc Anh
PS: There are some separated coefficient files and long source code for
the problem. I can not attach here. However, I can send it to your email
for analyzing If you give me your email's address.
Prev by Date:
**Re: Extending running memory of Mathematica**
Next by Date:
**Re: Re: Help to remove equivalent (redundant) solutions**
Previous by thread:
**Re: Re: Eliminating intermediate results**
Next by thread:
**Re: NonlinearRegress of user functions**
| |