Julian Gilbey
2011-Apr-24 00:38 UTC
[R] Multi-dimensional non-linear fitting - advice on best method?
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? Many thanks, Julian
David Winsemius
2011-Apr-24 22:25 UTC
[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
peter dalgaard
2011-Apr-24 22:57 UTC
[R] Multi-dimensional non-linear fitting - advice on best method?
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
Reasonably Related Threads
- multiplying values in data frame by corresponding value in the first column
- XML parameters to Column Headers for importing into a dataset
- link_to and GET parameters
- MLE Estimation of Gamma Distribution Parameters for data with 'zeros'
- Loop for multiple plots in figure