[R] Global curve fitting/shared parameters with nls() alternatives

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Tue Nov 5 21:27:48 CET 2019


A simplified example of what you wish to do might help to clarify here.

Here's my guess. Feel free to dismiss if I'm off base.

Suppose your model is:
y = exp(a*x) + b

and you wish the b to be constant but the a to vary across expts. Then can
you not combine the data from both into single x, y vectors, add a variable
expt that takes the value 1 for expt1 and 2 for expt 2 and fit the single
model:

y = (expt ==1)*(exp(a1*x) + b)   +  (expt == 2)* (exp(a2*x) + b)

This would obtain separate estimates of a1 and a2 but a single estimate of
b .

There are probably better ways to do this, but I've done hardly any
nonlinear model fitting (so warning!) and can only offer this brute force
approach; so wait for someone to suggest something better before trying it.

Cheers,
Bert


On Tue, Nov 5, 2019 at 9:12 AM James Wagstaff <wagstaff.james using gmail.com>
wrote:

> Hello
> I am trying to determine least-squares estimates of the parameters of a
> nonlinear model, where I expect some parameters to remain constant across
> experiments, and for others to vary. I believe this is typically referred
> to as global curve fitting, or the presence of shared/nested parameters.
> The "[]" syntax in the stats::nls() function is an extremely convenient
> solution (
>
> https://r.789695.n4.nabble.com/How-to-do-global-curve-fitting-in-R-td4712052.html
> ),
> but in my case I seem to need the Levenberg-Marquardt/Marquardt solvers
> such as nlsr::nlxb() and minpack.lm::nlsLM. I can not find any
> examples/documentation explaining a similar syntax for these tools. Is
> anyone aware of a nls-like tool with this functionality, or an alternative
> approach?
> Best wishes
> James Wagstaff
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list