[R] Scaling problem in optim()

Ben Bolker bbolker at gmail.com
Mon Aug 15 13:53:32 CEST 2011


Rebekka Schibli <rebekka_schibli <at> gmx.ch> writes:

> 
> 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
> 

   From these ending parameters it looks as though

parscale=c(rep(1,n),1,100,1)

  would be a better choice?

If you can specify a gradient that will probably help.
Beyond that, we'll probably have to have a reproducible example
in order to provide further help.

  Ben Bolker



More information about the R-help mailing list