Message Boards Message Boards

0
|
3324 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Initial guess and no. of iterations in NonlinearModelFit[ ]?

Posted 2 years ago

In "Non Linear Model Fit", 1) how we can check what initial guess it is taking? 2) how we can define our own initial guess to get better regression coefficient? 3) can we increase number of iterations?

data={{0.133315, 0.0999874, 0.000146902}, {0.166645, 0.0999874, 
  0.000214002}, {0.179184, 0.0999874, 0.0000934653}, {0.190344, 
  0.0999874, 0.000078778}, {0.199975, 0.0999874, 
  0.0000733382}, {0.211777, 0.0999874, 0.0000694502}, {0.222074, 
  0.0999874, 0.000121813}, {0.233305, 0.0999874, 
  0.000151461}, {0.266636, 0.0999874, 0.00015451}, {0.299968, 
  0.0999874, 0.000152593}, {0.199975, 0.0333287, 
  0.000025114}, {0.199975, 0.0666579, 0.0000846425}, {0.199975, 
  0.0752138, 0.0000452293}, {0.199975, 0.0876898, 
  0.0000409033}, {0.199975, 0.0999874, 0.0000733382}, {0.199975, 
  0.111659, 0.000106408}, {0.199975, 0.123177, 
  0.000128768}, {0.199975, 0.133317, 0.00019747}, {0.199975, 0.166648,
   0.000230625}, {0.199975, 0.0752138, 0.0000452293}, {0.199975, 
  0.199978, 0.000278124}};

Subscript[r, PL] = k Pch4^a Po2^b;

NLM5 = NonlinearModelFit[data, Subscript[r, 
  PL], {k, a, b}, {Pch4, Po2}]

NLM5["AdjustedRSquared"]

NLM5["BestFitParameters"]
2 Replies
Posted 2 years ago

The initial value for all parameter estimates is 1 if you don't specify any. So, {k, a, b} is equivalent to {{k, 1}, {a, 1}, {b, 1}}. You can replace those 1's with whatever seems appropriate.

How to get reasonable starting values? Your particular model can be "linearized" by taking the logs such that the model (ignoring the error structure for the moment) can be written as

$$\log(y) = \log(k)+a \log(\text{Pch4}) + b \log(\text{Po2})$$

Then LinearModelfit can be used which doesn't need (or even allows) starting values:

data2 = data;
data2[[All, 3]] = Log[data[[All, 3]]];
lm = LinearModelFit[data2, {Log[Pch4], Log[Po2]}, {Pch4, Po2}]
{logk0, a0, b0} = lm["BestFitParameters"];
k0 = Exp[logk0];
(* {0.00385149, 0.153329, 1.46418} *)

Those initial estimates are very similar to your previous results and can be plugged into NonlinearModelFit:

nlm = NonlinearModelFit[data, k Pch4^a Po2^b, {{k, k0}, {a, a0}, {b, b0}}, {Pch4, Po2}]
nlm["BestFitParameters"]
(* {k -> 0.00328639, a -> 0.124704, b -> 1.38266} *)

The result is essentially what you got with the default starting values of 1.

Obtaining reasonable starting values depends on the structure of the model and linearization is not always a possibility. (There's still the issue of a reasonable model for the random variability but I'm ignoring that for now.) If you need more iterations, then using the option MaxIterations might be considered with MaxIterations -> 100 I think (but don't know) is the default.

POSTED BY: Jim Baldwin

Thank you so much Jim. I got all my answers.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract