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

Julian Gilbey julian at d-and-j.net
Tue Apr 26 23:26:18 CEST 2011


On Mon, Apr 25, 2011 at 12:57:46AM +0200, peter dalgaard wrote:
> > 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.

Will take a look, thanks!

   Julian



More information about the R-help mailing list