Re: I: NONLINEARMODELFIT

*To*: mathgroup at smc.vnet.net*Subject*: [mg120314] Re: I: NONLINEARMODELFIT*From*: Ray Koopman <koopman at sfu.ca>*Date*: Mon, 18 Jul 2011 06:15:00 -0400 (EDT)*References*: <ivuc83$gta$1@smc.vnet.net>

On Jul 17, 3:06 am, maria giovanna dainotti <mariagiovannadaino... at yahoo.it> wrote: > Dear Mathematica Group, > > I am fitting a function of 3 parameters with the NonlinearModelFit > and with the Marquardt Levemberg algorithm. Since this method gives > the interval of the Parameters of the best fit considering the parameters > not correlated, I was looking for a tool that takes into account the > fact that the parameters are correlated and the parameters interval > should respect the following rule: > > The confidence interval for a given parameter should be computed by > varying the parameter value until the chi^2 increases by a particular > amount above the minimum, or best-fit value. The amount that the chi > square is allowed to increase (also referred to as the critical > delta_chi^2) depends on the confidence level one requires, and on > the number of parameters whose confidence space is being calculated. > The critical delta_chi^2 for common cases are given in Avni, 1976: > For example in the case I am using for 3 parameters delta_chi^2=3.50. > > I would be very grateful if someone of you is acquainted with a such > a tool in Mathematica or some of you has done a code to sort this > problem out. Thanks a lot in advance for your help. > > Best regards, > > Maria https://groups.google.com/group/sci.stat.edu/browse_frm/thread/5eef0a33244e080f?hl=en# discusses a similar problem. Here is the code I used. In[1]:= color = {"Blue","Brown","Green","Orange","Red","Yellow"}; {k,n} = {Length@#,Tr@#}&[f = {127, 63, 122, 147, 93, 76}]; e = Array[x,k]; init = Transpose@{e,f-1,f+1}; b[\[Alpha]_] = Tr[f^2/e] == n + 2 InverseGammaRegularized[(k-1)/2, \[Alpha]] && And@@Thread[e > 0] && Tr@e == n; In[6]:= " 95% Limits\nColor Lower Upper\n" <> ToString@PaddedForm[TableForm[Table[{color[[j]], First@NMinimize[{x[j],b[.05]},init]/n, First@NMaximize[{x[j],b[.05]},init]/n},{j,k}], TableSpacing->{0,1}],{4,3}] Out[6]= 95% Limits Color Lower Upper Blue 0.154 0.261 Brown 0.067 0.147 Green 0.147 0.252 Orange 0.183 0.295 Red 0.107 0.201 Yellow 0.084 0.171