[R] optim and singularity

Berend Hasselman bhh at xs4all.nl
Fri Dec 31 13:32:31 CET 2010


The error occurs in the x <- solve(A,RHS) statement.
In a certain iteration ylim_2 passed by optim to your function is c(0,0)
That give a zero column of matrix A ==> exactly singular.

If I set lower=c(0,0.01) in the call of optim and use the na.approx then the
result is

ylim_2=c(0, 4.63) with the objective function=7.55

And with NO na.approx and the same lower bound the result is

ylim_2=c(0, 3.61) with the objective function=1.84

Large difference.

If you insert a print(ylim_2) in your function f you will see that after a
few iterations optim tries (0,0) for ylim_2 (when you use the na.approx).


I'm not sure if this is caused by the particular constellation of your data
or the loss of rank in your data matrix when you apply a linear
interpolation.

I have also seen that with NO na.approx optim tries ylim_2=c(0.00000000,
0.08518535) which is pretty close to 0,0).


Berend
-- 
View this message in context: http://r.789695.n4.nabble.com/optim-and-singularity-tp3168722p3169334.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list