MathGroup Archive 1998

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

Search the Archive

Re: NonLinearRegress question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg12881] Re: NonLinearRegress question
  • From: k.grijspeerdt at clo.fgov.be (Koen Grijspeerdt)
  • Date: Wed, 24 Jun 1998 03:44:08 -0400
  • References: <6m7fvs$gqf@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 17 Jun 1998 00:17:00 -0400, in comp.soft-sys.math.mathematica you
wrote:

>Hi folks,
>
>I'm writing some data fitting code on Mathematica that uses the add-on
>package
>'NonLinearRegress'. However I'm currently stumped because the model I
>use
>for fitting involves the use of conditional 'Ifs'. It seems that
>Mathematica does not recoginise such a function as numerical.
>Does Anyone have an idea of how to get round this. I've included a
>typical
>but simplified example below.
>
>In[1]      Clear[fun,t,x,y]
>              fun[t_,x_,y_]:=If[t<10,t^2 x + Log[t] y, t^3 x + Log[t] y]
>
>              data=Table[{t,N[fun[t,2,3]]},{t,1,21,2}] Out[1]
>{{1,2.},{3,21.2958},{5,54.8283},{7,103.838},{9,168.592},{11,2669.19},{13,
>
>    4401.69},{15,6758.12},{17,9834.5},{19,13726.8},{21,18531.1}}
>
>In[2]       << Statistics`NonlinearFit`
>                NonlinearRegress[data,
>                N[func[t,a,b]] ,z, {{a,{-100,-101}},{b,{2,3}}},
>                RegressionReport -> BestFitParameters,
>                 Method->FindMinimum,
>                ShowProgress -> True]
>
>Out[2]  NonlinearRegress::"nonnum": "The model is not numerical at
>(******)
>             Check that all model parameters are included in the
>parameter list.
>

Easan,

I think your example contains some typos. You indicate z is the
dependent variable and your function is defined with t. You define the
function as fun and in NonlinearRegress you type func. If I try the
following:
 NonlinearRegress[data,
                N[func[t,a,b]] ,t, {{a,{-100,-101}},{b,{2,3}}},
                RegressionReport -> BestFitParameters,
                 Method->FindMinimum,
                ShowProgress -> True] then everything works fine.

All the best


Koen Grijspeerdt
Department for Animal Product Quality Brusselsesteenweg 370
B-9090 MELLE
Belgium
Tel: 32 9 252 18 61
Fax: 32 9 252 50 85
e-mail: K.Grijspeerdt at clo.fgov.be
http://www.clo.fgov.be/dvk.htm


  • Prev by Date: Re: Adding Menu Items to Front End
  • Next by Date: Table of contents
  • Previous by thread: Re: NonLinearRegress question
  • Next by thread: Re: NonLinearRegress question