# Re: [R] Multi-dimensional non-linear fitting - advice on best method?

From: Ravi Varadhan <rvaradhan_at_jhmi.edu>
Date: Sun, 24 Apr 2011 19:02:48 -0400

Julian,

(1) y1 = f + e1 = a + b*exp(-c*x) + e1; y2 = f + e2 = a + b*exp(-c*x) + e2; (e1, e2) ~ bivariate normal

(2) y1 = f + e1 = a + b*exp(-c*x) + e1; y2 = f + e2 = a + b*exp(-c*x) + e2; (e1, e2) ~ independently normal

(3) y1 = f1 + e1 = a1 + b1*exp(-c1*x) + e1; y2 = f2 + e2 = a2 + b2*exp(-c2*x) + e2; (e1, e2) ~ bivariate normal

(4) y1 = f1 + e1 = a1 + b1*exp(-c1*x) + e1; y2 = f2 + e2 = a2 + b2*exp(-c2*x) + e2; (e1, e2) ~ independently normal

For scenario (2), you form a single `y' vector by concatenating all the y1 and y2 and then do a single application of nls. For (4), you do 2 separate nls runs, one for y1 and another for y2.

For (1) and (3) you can do a likelihood maximization.

You have more scenarios where f1 and f2 can have different functional forms. Which scenario is the one that you are considering?

Ravi.

From: r-help-bounces_at_r-project.org [r-help-bounces_at_r-project.org] On Behalf Of David Winsemius [dwinsemius_at_comcast.net] Sent: Sunday, April 24, 2011 6:25 PM
To: Julian Gilbey
Cc: r-help_at_r-project.org
Subject: Re: [R] Multi-dimensional non-linear fitting - advice on best method?

On Apr 23, 2011, at 8:38 PM, Julian Gilbey wrote:

> Hello!
>
> I have a set of data of the form (x, y1, y2) where x is the
> independent variable and (y1, y2) is the response pair. The model is
> some messy non-linear function:
>
> (y1, y2) = f(x; param1, param2, ..., paramk) + (y1error, y2error)
>
> where the parameters param1, ..., paramk are to be estimated, and I'll
> assume the errors to be normal for sake of simplicity.
>
> If there were only one response per input, I would use the nls()
> function, but what can I do in this case?

I wonder it would be sensible or at least informative to consider solving for the "inverse case". i.e. solve for:

x = f(y1, y2)

```--
David Winsemius, MD
West Hartford, CT

______________________________________________
R-help_at_r-project.org mailing list
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.

______________________________________________
R-help_at_r-project.org mailing list
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.
```
Received on Sun 24 Apr 2011 - 23:04:21 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 26 Apr 2011 - 21:40:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.