Problem in optim(method="L-BFGS-B") (PR#1717)
polzehl@wias-berlin.de
polzehl@wias-berlin.de
Fri, 28 Jun 2002 11:53:31 +0200 (MET DST)
Full_Name: Jörg Polzehl
Version: 1.5.1
OS: Windows 2000
Submission from: (NULL) (193.175.148.198)
When calculating MLE's in a variance component model using constrained
optimization, i.e. optim(...,method="L-BFGS-B",...) I observed an inproper
behaviour in cases where
the likelihood function was evalueted at the constraint. Parameters and value of
the
function at the constraint seem to be returned in this case.
I've tried to reproduce the effect in a very simple example:
###############################################################################
fn <- function(par,x,y){
ind <- 1:(length(x)/2)
alpha <- par[1]
beta <- par[2]
sigmaq1 <- par[3]
sigmaq2 <- par[4]
sum((y[ind]-alpha-beta*x[ind])^2/sigmaq1+log(sigmaq1)+(y[-ind]-alpha-beta*x[-ind])^2/sigmaq2+log(sigmaq2))
}
set.seed(3)
n <- 5
x1 <- runif(n)
x2 <- runif(n)
y <- c(rnorm(x1,1+x1,1),rnorm(x2,1+x2,5))
x <- c(x1,x2)
par <- c(0,0,1,1)
z <- optim(par,fn,method="L-BFGS-B",lower=c(-Inf,-Inf,1e-6,1e-6),x=x,y=y,control=list(trace=6,REPORT=1))
####################################################################################
Note that the effect vanishes in case of other constraints for par[3:4].
here is what happens with trace=1 :
z <- optim(par,fn,method="L-BFGS-B",lower=c(-Inf,-Inf,1e-6,1e-6),x=x,y=y,control=list(trace=1,REPORT=1))
iter 0 value 121.713156
iter 1 value 98.361657
iter 2 value 66.561121
iter 3 value 57.491023
iter 4 value 48.193824
iter 5 value 42.298821
iter 6 value 37.554272
iter 7 value 33.741241
iter 8 value 31.592504
iter 9 value 28.856846
iter 10 value 27.450574
iter 11 value 4118799.069149
final value 4118799.069149
converged
----------------------------------------------------------------------------------
and the essential part with trace = 6 :
4 variables are free at GCP on iteration 11
LINE SEARCH 1 times; norm of step = 1.19245
X = -3.34057 6.34639 1.18546 15.2136
G = -1.08654 -1.14056 1.42527 -0.307525
Iteration 11
---------------- CAUCHY entered-------------------
There are 1 breakpoints
Piece 1 f1, f2 at start point -4.6074e+000 3.1209e+001
Distance to the next break point = 8.3175e-001
Distance to the stationary point = 1.4763e-001
GCP found in this segment
Piece 1 f1, f2 at start point -4.6074e+000 3.1209e+001
Distance to the stationary point = 1.4763e-001
Cauchy X = -3.18017 6.51477 0.97505 15.259
---------------- exit CAUCHY----------------------
4 variables are free at GCP on iteration 12 #
!!!!!!!!!!!!!!!!!!!!!!
LINE SEARCH 0 times; norm of step = 2.30637
X = -3.90499 7.26709 1e-006 16.8712
G = 2.86794e+006 2.02055e+006 -4.1147e+009 -0.191468
iterations 12
function evaluations 15
segments explored during Cauchy searches 12
BFGS updates skipped 0
active bounds at final generalized Cauchy point 0
norm of the final projected gradient 4.1147e+009
final function value 4.1188e+006
X = -3.90499 7.26709 1e-006 16.8712
F = 4.1188e+006
final value 4118799.069149
converged
See especially the line marked with !!!!!!!!!!
Regards,
Jörg Polzehl
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._