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

James Wagstaff w@g@t@||@j@me@ @end|ng |rom gm@||@com
Fri Nov 8 14:20:41 CET 2019

Dear Bert
Thanks for getting back to me. Yes that is exactly the sort of problem I am
trying to solve. I am aware of the option of hard coding the experimental
groups as you suggested, but was hoping for an easy out of the box approach
as I have many groups!

On Tue, 5 Nov 2019 at 20:28, Bert Gunter <bgunter.4567 using gmail.com> wrote:

> 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.

James Wagstaff


	[[alternative HTML version deleted]]

More information about the R-help mailing list