[R] Scaling problem in optim()
Rebekka Schibli
rebekka_schibli at gmx.ch
Sun Aug 14 13:09:05 CEST 2011
I am using the function optim and I get the error message ABNORMAL_TERMINATION_IN_LNSRCH. Reason for this could be a scaling problem. Thus, I used parscale in order to scale the parameters. But I still have the error message. For example, with parscale=c(rep(1,n), 0.01,1,0.01):
return(optim(c(mu1,b,k,phi), neg2loglikelihood, method = "L-BFGS-B",
lower=c(rep(-1,n),1e-5,1e-5,1e5)
,upper=c(rep(5,n),1.29,100,1.9),control=list(parscale=c(rep(1,n), 0.01,1,0.01))
)
)
>$par
[1] 0.9684324 0.9618763 0.9632684 0.9667272 0.9596587 0.9661914
[7] 0.9731076 0.9684477 0.9723313 1.1679275 92.3677202 0.4947495
$value
[1] -5438.992
$counts
function gradient
177 177
$convergence
[1] 52
$message
[1] "ERROR: ABNORMAL_TERMINATION_IN_LNSRCH"
By using small values for the last parameters, for instance parscale=c(rep(1,n),0.001,0.9,0.001), there is no Error message anymore, but then the parameters (n+1) and (n+3) stay at the starting values and are not optimized anymore.
I have tried several different values and combinations for parscale, but either I get the error message ABNORMAL_TERMINATION_IN_LNSRCH or at least one parameter is not optimized. But I want to have both. What can I do? I haven’t specified a gradient function. I am grateful for any suggestions! Thanks you!
--
More information about the R-help
mailing list