Re: [R] Regression of complex-valued functions

2014-02-12 Thread Rolf Turner
On 13/02/14 12:03, Andrea Graziani wrote: Using the same starting values, the two approaches bring to slightly different solutions: ### 1. Real part and Imaginary part fit$estimate [1] -3.8519181 -2.7342861 -1.4823740 1.7173982 4.4529298 1.4383334 0.1564904 0.4856774 2.2789567 3.

Re: [R] Regression of complex-valued functions

2014-02-12 Thread Andrea Graziani
Hi Frede, Thank you for your accurate answer! If I understand well, your way to use nls() solves the problem using too many physical parameters. I solved the problem following the other way that you and Rolf Turner suggested (i.e. splitting the complex-valued problem into two real-valued proble

Re: [R] Regression of complex-valued functions

2014-02-12 Thread Andrea Graziani
Dear Rolf, Thank you for your suggestion. Based on your remarks I solved my problem using nlm(). Actually there are two quite straightforward ways to split the complex-valued problem into two “linked” real-valued problems. ### 1. Real part and Imaginary part # Experimental data E1_data <- Re(E

Re: [R] Regression of complex-valued functions

2014-02-11 Thread Duncan Murdoch
On 11/02/2014 2:10 PM, David Winsemius wrote: On Feb 9, 2014, at 2:45 PM, Andrea Graziani wrote: > Hi everyone, > > I previously posted this question but my message was not well written and did not contain any code so I will try to do a better job this time. > > The goal is to perform a non-lin

Re: [R] Regression of complex-valued functions

2014-02-11 Thread David Winsemius
On Feb 9, 2014, at 2:45 PM, Andrea Graziani wrote: > Hi everyone, > > I previously posted this question but my message was not well written and did > not contain any code so I will try to do a better job this time. > > The goal is to perform a non-linear regression on complex-valued data. > I

Re: [R] Regression of complex-valued functions

2014-02-11 Thread Rolf Turner
I have not the mental energy to go through your somewhat complicated example, but I suspect that your problem is simply the following: The function nls() is trying to minimize a sum of squares, and that does not make sense in the context of complex observations. That is, nls() is trying to