[R] Regression of complex-valued functions
Rolf Turner
r.turner at auckland.ac.nz
Thu Feb 13 01:15:55 CET 2014
On 13/02/14 12:03, Andrea Graziani wrote:
<SNIP>
> 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.9011926 0.1227758
>
> ### 2. Modulus and argument
>> fit$estimate
> [1] -3.8674680 -2.7250640 -1.4574350 1.6447868 4.4355748 1.2400092 0.1574215 0.4731295 2.0624878 3.7526197 0.1161640
>
> Do you believe this is due only to “numerical" reasons linked to how the nls() function works?
I find it a bit surprising that there are differences in the third
decimal place here. I would have thought that the results would be
exactly the same, or ***very*** close to it.
If you have done it right (I have not checked your code at all) the "two
approaches" should amount to the same approach. I.e. Mod(z)^2 is
equal to Re(z)^2 + Im(z)^2.
Check your code carefully.
Also it would be a good idea to try a "toy example", something much less
complicated than your real problem, and see what happens there.
cheers,
Rolf Turner
More information about the R-help
mailing list