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

peter dalgaard pdalgd at gmail.com
Mon Apr 25 00:57:46 CEST 2011


On Apr 24, 2011, at 02:38 , 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 believe the gnls function in the nlme package is your friend. It's a bit involved but the basic idea is to stack the two response variables and use a weights argument with a varIdent structure with variance depending on whether it is a y1 or a y2 observation. You can also specify a within-pair correlation.

> 
> Many thanks,
> 
>   Julian
> 
> ______________________________________________
> 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.

-- 
Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list