Skip to content
Back to formatted view

Raw Message

Message-ID: <D71F5453-7A3E-46A4-BA0B-FE152039B1F0@gmail.com>
Date: 2011-04-24T22:57:46Z
From: Peter Dalgaard
Subject: Multi-dimensional non-linear fitting - advice on best method?
In-Reply-To: <20110424003813.GB9726@d-and-j.net>

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