hi all
i dont understand the error message that is produced by the optim
function. can anybody help???
ie:
[[1]]$message
[1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH"
can anyone help?
###########################################################################
SK.FIT(XDATA=a,XDATAname="a",PHI1=1,v=5,vlo=2,vhi=300,phi2lo=.01)
[[1]]
[[1]]$par
[1] -0.01377906 0.83859445 0.34675230 300.00000000
[[1]]$value
[1] 90.59185
[[1]]$counts
function gradient
53 53
[[1]]$convergence
[1] 0
[[1]]$message
[1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH"
#################################################################################
i ghave included the function used in the optim call:
SKEWMLE=function(l,DATA=XDATA,...)
{
#alpha = l[1]
#beta = l[2]
#phi2 = l[3]
#v= l[4]
phi1=PHI1
DATA<-as.matrix(DATA)
fnew<-function(x,y,l,...)
{
#when we do not estimate phi1
t1=(1+((y-l[1]-l[2]*x)^2)/(l[4]*l[3]^2))^(-0.5*(1+l[4]))
t2=(1+(x^2)/l[4])^(-0.5*(1+l[4]))
t3=2*((gamma(0.5*(1+l[4]))/(gamma(0.5*l[4])*sqrt(l[4]*pi)))^2)/l[3]
t1*t2*t3
}
a<-double(length(DATA))
y=DATA
a=apply(y,1,function(q)
log(integrate(fnew,lower=0,upper=Inf,y=q,l=l)$value))
-sum(a)
}
R: optim
5 messages · Douglas Bates, Clark Allan, Thomas Lumley
On 9/6/05, Clark Allan <Allan at stats.uct.ac.za> wrote:
hi all i dont understand the error message that is produced by the optim function. can anybody help??? ie: [[1]]$message [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH" can anyone help?
That code indicates that the optimizer has declared convergence
because the relative reduction in the objective function in successive
iterates is below a tolerance. As documented in ?optim, a convergence
code of 0 indicates success
...
convergence: An integer code. '0' indicates successful convergence.
Error codes are
...
This may be counter-intuitive but it does make sense to shell
programmers. The idea is that there is only one way you can succeed
but there are many different ways of failing so you use the nonzero
codes to indicate the types of failure and the zero code, which we
usually read as FALSE in a logical context, to indicate success.
###########################################################################
SK.FIT(XDATA=a,XDATAname="a",PHI1=1,v=5,vlo=2,vhi=300,phi2lo=.01)
[[1]]
[[1]]$par
[1] -0.01377906 0.83859445 0.34675230 300.00000000
[[1]]$value
[1] 90.59185
[[1]]$counts
function gradient
53 53
[[1]]$convergence
[1] 0
[[1]]$message
[1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH"
#################################################################################
i ghave included the function used in the optim call:
SKEWMLE=function(l,DATA=XDATA,...)
{
#alpha = l[1]
#beta = l[2]
#phi2 = l[3]
#v= l[4]
phi1=PHI1
DATA<-as.matrix(DATA)
fnew<-function(x,y,l,...)
{
#when we do not estimate phi1
t1=(1+((y-l[1]-l[2]*x)^2)/(l[4]*l[3]^2))^(-0.5*(1+l[4]))
t2=(1+(x^2)/l[4])^(-0.5*(1+l[4]))
t3=2*((gamma(0.5*(1+l[4]))/(gamma(0.5*l[4])*sqrt(l[4]*pi)))^2)/l[3]
t1*t2*t3
}
a<-double(length(DATA))
y=DATA
a=apply(y,1,function(q)
log(integrate(fnew,lower=0,upper=Inf,y=q,l=l)$value))
-sum(a)
}
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
thanx for the reply. i understood that the function found a maximum. i was just a bit worried about the message. i assumed that it was an ERROR message. i see now that it is some sort of stopping rule. does this make sense? / allan
Douglas Bates wrote:
On 9/6/05, Clark Allan <Allan at stats.uct.ac.za> wrote:
hi all i dont understand the error message that is produced by the optim function. can anybody help??? ie: [[1]]$message [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH" can anyone help?
That code indicates that the optimizer has declared convergence
because the relative reduction in the objective function in successive
iterates is below a tolerance. As documented in ?optim, a convergence
code of 0 indicates success
...
convergence: An integer code. '0' indicates successful convergence.
Error codes are
...
This may be counter-intuitive but it does make sense to shell
programmers. The idea is that there is only one way you can succeed
but there are many different ways of failing so you use the nonzero
codes to indicate the types of failure and the zero code, which we
usually read as FALSE in a logical context, to indicate success.
###########################################################################
SK.FIT(XDATA=a,XDATAname="a",PHI1=1,v=5,vlo=2,vhi=300,phi2lo=.01)
[[1]]
[[1]]$par
[1] -0.01377906 0.83859445 0.34675230 300.00000000
[[1]]$value
[1] 90.59185
[[1]]$counts
function gradient
53 53
[[1]]$convergence
[1] 0
[[1]]$message
[1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH"
#################################################################################
i ghave included the function used in the optim call:
SKEWMLE=function(l,DATA=XDATA,...)
{
#alpha = l[1]
#beta = l[2]
#phi2 = l[3]
#v= l[4]
phi1=PHI1
DATA<-as.matrix(DATA)
fnew<-function(x,y,l,...)
{
#when we do not estimate phi1
t1=(1+((y-l[1]-l[2]*x)^2)/(l[4]*l[3]^2))^(-0.5*(1+l[4]))
t2=(1+(x^2)/l[4])^(-0.5*(1+l[4]))
t3=2*((gamma(0.5*(1+l[4]))/(gamma(0.5*l[4])*sqrt(l[4]*pi)))^2)/l[3]
t1*t2*t3
}
a<-double(length(DATA))
y=DATA
a=apply(y,1,function(q)
log(integrate(fnew,lower=0,upper=Inf,y=q,l=l)$value))
-sum(a)
}
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
funny optim message:
$MLE
$MLE$par
[1] -0.09554688 1.13100488 0.06651340
$MLE$value
[1] 48.93381
$MLE$counts
function gradient
100 100
$MLE$convergence
[1] 52
$MLE$message
[1] "ERROR: ABNORMAL_TERMINATION_IN_LNSRCH"
WHAT DOES THIS ERROR MESSAGE MEAN???
hope some one can help.
/
allan
Clark Allan wrote:
thanx for the reply. i understood that the function found a maximum. i was just a bit worried about the message. i assumed that it was an ERROR message. i see now that it is some sort of stopping rule. does this make sense? / allan Douglas Bates wrote:
On 9/6/05, Clark Allan <Allan at stats.uct.ac.za> wrote:
hi all i dont understand the error message that is produced by the optim function. can anybody help??? ie: [[1]]$message [1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH" can anyone help?
That code indicates that the optimizer has declared convergence
because the relative reduction in the objective function in successive
iterates is below a tolerance. As documented in ?optim, a convergence
code of 0 indicates success
...
convergence: An integer code. '0' indicates successful convergence.
Error codes are
...
This may be counter-intuitive but it does make sense to shell
programmers. The idea is that there is only one way you can succeed
but there are many different ways of failing so you use the nonzero
codes to indicate the types of failure and the zero code, which we
usually read as FALSE in a logical context, to indicate success.
###########################################################################
SK.FIT(XDATA=a,XDATAname="a",PHI1=1,v=5,vlo=2,vhi=300,phi2lo=.01)
[[1]]
[[1]]$par
[1] -0.01377906 0.83859445 0.34675230 300.00000000
[[1]]$value
[1] 90.59185
[[1]]$counts
function gradient
53 53
[[1]]$convergence
[1] 0
[[1]]$message
[1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH"
#################################################################################
i ghave included the function used in the optim call:
SKEWMLE=function(l,DATA=XDATA,...)
{
#alpha = l[1]
#beta = l[2]
#phi2 = l[3]
#v= l[4]
phi1=PHI1
DATA<-as.matrix(DATA)
fnew<-function(x,y,l,...)
{
#when we do not estimate phi1
t1=(1+((y-l[1]-l[2]*x)^2)/(l[4]*l[3]^2))^(-0.5*(1+l[4]))
t2=(1+(x^2)/l[4])^(-0.5*(1+l[4]))
t3=2*((gamma(0.5*(1+l[4]))/(gamma(0.5*l[4])*sqrt(l[4]*pi)))^2)/l[3]
t1*t2*t3
}
a<-double(length(DATA))
y=DATA
a=apply(y,1,function(q)
log(integrate(fnew,lower=0,upper=Inf,y=q,l=l)$value))
-sum(a)
}
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
------------------------------------------------------------------------
______________________________________________ R-help at stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
On Wed, 7 Sep 2005, Clark Allan wrote:
$MLE$message [1] "ERROR: ABNORMAL_TERMINATION_IN_LNSRCH" WHAT DOES THIS ERROR MESSAGE MEAN???
Looking at the code in optim() a little, it looks as though this error comes when the optimiser tries to do a line search in the steepest descent direction and finds that the derivative along this line is positive, which is impossible. I have seen this when the gradient is wrong, and I suppose it could also happen with numerical gradients when the surface is nearly flat or the problem is very badly scaled. Eg, using the functions in example(optim) and making the gradient wrong:
optim(c(-1.2, 1), fr, function(theta) grr(theta)+1, method =
"L-BFGS-B")
$par
[1] 0.25034245 0.05769649
$value
[1] 0.5644614
$counts
function gradient
96 96
$convergence
[1] 52
$message
[1] "ERROR: ABNORMAL_TERMINATION_IN_LNSRCH"
-thomas