Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: NonlinearRegress fitfail error

  • To: mathgroup at smc.vnet.net
  • Subject: [mg89377] Re: NonlinearRegress fitfail error
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Sat, 7 Jun 2008 03:00:59 -0400 (EDT)
  • References: <g2b4pu$nn4$1@smc.vnet.net>

Hi,

Needs["NonlinearRegression`"]

part1 = Table[{x,
     With[{a2 = 2, b2 = -1, c2 = 1}, a2*(Exp[b2*x] - 1) + c2*x]}, {x,
     0, 5, 0.05}];

startpoints = {a2, b2, c2};

msoln = BestFitParameters /.
   NonlinearRegress[part1, a2*(Exp[b2*x] - 1) + c2*x, startpoints, x,
    AccuracyGoal -> 5, PrecisionGoal -> 5, MaxIterations -> 5000,
    Method -> "Gradient", RegressionReport -> BestFitParameters]

work fine.

Regards
   Jens

Meaghan wrote:
> I'm updating an old program to Mathematica 6.  Here's the problem
> code:
> 
> Needs["NonlinearRegression`"]
> 
> msoln = BestFitParameters /.
>   NonlinearRegress[part1, a2*(Exp[b2*x] - 1) + c2*x, startpoints, x,
>    AccuracyGoal -> 5, PrecisionGoal -> 5, MaxIterations -> 500,
>    RegressionReport -> BestFitParameters]
> where "part1" is a long list of data points.
> 
> I know this method of replacement was valid in 5.2, but here I get:
> FindFit::nrlnum: The function value {0.+(-1.+2.71828^(0. b2)) a2+0.
> c2,0.104632+(-1.+2.71828^(0.195816 b2)) a2+0.195816 c2,<<8>>,<<92>>}
> is not a list of real numbers with dimensions {102} at {a,b,c} =
> {0.0369002,0.32,0.158379}.
> NonlinearRegress::fitfail: The fitting algorithm failed.
> ReplaceAll::reps: "{msoln} is neither a list of replacement rules nor
> a valid dispatch table, and so cannot be used for replacing."
> 
> Thank you for the help!
> 


  • Prev by Date: Re: Why don't my plots appear? My 5.2 code no longer works correctly in 6.0
  • Next by Date: Re: Why don't my plots appear? My 5.2 code no longer works correctly in 6.0
  • Previous by thread: NonlinearRegress fitfail error
  • Next by thread: Re: NonlinearRegress fitfail error