Message Boards Message Boards

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

[?] Use NonlinearModelFit and put to 0 a statically non-valid parameter?

Posted 6 years ago

I have a nonlinear model and I use the command NonlinaerModelFit, for example I have a model with three parameters and one of them, isn’t a valid parameter statistically, my question is, how can I make zero this parameter? without remake all program

POSTED BY: J T
3 Replies
Posted 6 years ago

"...because in another software..." Mathematica is different. So is any other software.

POSTED BY: Jim Baldwin
Posted 6 years ago

Thanks, I was confused because in another software, it was enought put the non-valid paramter = 0, but you have reazon your solution is good, thank you.

POSTED BY: J T
Posted 6 years ago

You've got to make some changes in the code but certainly not remaking the whole program.

Here's a two-variable example from the documentation:

SeedRandom[12345];
data = Flatten[Table[{x, y, Exp[.3 x - .7 y] + RandomReal[{-1, 1}]}, {x, 5}, {y, 5}], 1]
NonlinearModelFit[data, Exp[a x + b y], {a, b}, {x, y}]

To remove the effect of y you can just modify the NonlinearModelFit statement by removing y and its associated parameters from the function but leave in y in the variable list:

NonlinearModelFit[data, Exp[a x], {a, b}, {x, y}]

It would be even better if you removed the associated parameter from the parameter list but that is not necessary (although the result will have - in this case - b -> 1).

POSTED BY: Jim Baldwin
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