Displaying 20 results from an estimated 578 matches for "bfgs".
Did you mean:
bfg
2004 Jan 05
3
optim function : "BFGS" vs "L-BFGS-B"
Dear kind R-experts.
Does anybody have an experience to use optim function?
If yes, what is the main difference between two method "BFGS" vs
"L-BFGS-B"?
I used "BFGS" method and got what I wanted. But when I used "L-BFGS-B"
the error message said that "L-BFGS-B needs finite values of fn". So
that means
"BFGS" method can handle even if fn function is infinite value?
What I reall...
2011 Feb 25
2
BFGS versus L-BFGS-B
Hi all,
I'm trying to figure out the effective differences between BFGS and L-BFGS-B
are, besides the obvious that L-BFGS-B should be using a lot less memory,
and the user can provide box constraints.
1) Why would you ever want to use BFGS, if L-BFGS-B does the same thing but
use less memory?
2) If i'm optimizing with respect to a variable x that must be non-nega...
2018 Apr 17
1
Minor glitch in optim()
...y <- length(x):1
val <- sum((yy*x)^2)*fscale
}
grt <- function(x, fscale=10){
nn <- length(x)
yy <- nn:1
# gg <- rep(NA,nn)
gg <- 2*(yy^2)*x*fscale
gg
}
npar <- 4
lower <- -Inf
l2 <- rep(-Inf,npar)
a1 <- optim(x0, fnt, grt, lower=lower, method="BFGS") # works
a1
a1a<- optim(x0, fnt, grt, lower=l2, method="BFGS") # changes method!
a1a
The first call uses BFGS method without warning. The second gives
a warning that L-BFGS-B should be used, and from the output uses
this.
This is a bit of an edge case. My own preference would b...
2007 Jul 29
1
behavior of L-BFGS-B with trivial function triggers bug in stats4::mle
With the exception of "L-BFGS-B", all of the
other optim() methods return the value of the function
when they are given a trivial function (i.e., one with no
variable arguments) to optimize. I don't think this
is a "bug" in L-BFGS-B (more like a response to
an undefined condition), but it leads to a bug in s...
2016 Oct 08
4
optim(…, method=‘L-BFGS-B’) stops with an error message while violating the lower bound
...one of the methods I tried after Ravi
directed me to optimx. It returned NAs for essentially everything. See
my email of this subject stamped 4:43 PM Central time = 21:43 UTC.
2. It would be interesting to know if the current
algorithm behind optim and optimx with method='L-BFGS-B' incorporates
Morales and Nocedal (2011) 'Remark on ?Algorithm 778: L-BFGS-B: Fortran
Subroutines for Large-Scale Bound Constrained Optimization?'. I created
this vignette and started this threat hoping that someone on the R Core
team might decide it's worth checking things l...
2009 Feb 04
0
Problem using option packeg with new R version (PR#13498)
...nrow(X)> p<-ncol(X)> n[1] 5> p[1] 6> > v<-rep(0,p-1)> v[1] 0 0 0 0 0> > fn1<-function(v) {+ a<-sum(v*v)+ u<-v/sqrt(1+a)+ b<-sum(u*u)+ u[length(v)+1]<-sqrt(1+b)+ c<<- X %*% u # also I try c<- X %*% u+ fn1<- - optim(c(0,1),fn2,NULL,method="BFGS",c)$value+ }> > > fn2<-function(par){+ fn2<- -length(c)*log(par[2])+sum(log(par[2]*par[2]+(c-par[1])*(c-par[1])))+ }> optim(v,fn1,NULL,method="BFGS",X)Error in fn(par, ...) : unused argument(s) (c(-0.277693546148993, -0.091468312551809, -0.99167995523182, -1.5400...
2008 Jun 24
2
L-BFGS-B needs finite values of 'fn'
...4.4, 4.8, 5.9, 6.8)
x <- log10(x)
fr <- function(c, alpha, beta) {
P <- c + (1-c) * pnorm(alpha + beta * x)
P <- pmax(pmin(P,1),0)
-(sum(log(choose(n,r))) + sum(r * log(P)) + sum((n -r)* log(1-P)))
}
fit <- mle((fr), start = list(c =0.2, alpha = 0, beta =0.1), method =
"L-BFGS-B")
I got:
Error in optim(start, f, method = method, hessian = TRUE, ...) :
L-BFGS-B needs finite values of 'fn'
When I change "L-BFGS-B" to "BFGS" or anything else that optim()
support, there's no any error message.
What's wrong?
Any suggestions will...
2007 Apr 05
2
Likelihood returning inf values to optim(L-BFGS-B) other options?
...am working on an optimization with R by evaluating a likelihood
function that contains lots of Gamma calculations (BGNBD: Hardie Fader
Lee 2005 Management Science). Since I am forced to implement lower
bounds for the four parameters included in the model, I chose the
optim() function mith L-BFGS-B as method. But the likelihood often
returns inf-values which L-BFGS-B can't deal with.
Are there any other options to implement an optimization algorithm
with R accounting for lower bounds and a four parameter-space?
Here is the error message I receive (german):
--
> out=optim(c(.1,....
2007 Apr 09
1
R:Maximum likelihood estimation using BHHH and BFGS
...prising 148 entries:
fn<-function(c,psi,alpha)
{
s1<-sum(for(i in 1:n){(c[i]-(psi^(-1/alpha)*(lag(c[i],-1))))^2*
(lag(c[i],-1)^((-2)*(alpha+1))
)});
s2<- sum(for(m in 1:n){log(lag(c[m],-1)^(((2)*alpha)+2))});
constant-(74*s1)-(1/2)*s2}
In particular I want to use the BHHH and the BFGS algorithms. I have found
the following packages that can be used for the task: *mle{stats4},
optim{stats}, maxBHHH{micEcon}, maxBFGS{micEcon}*. I have documented some of
my attempts below ((a) package name (b) usage (c) my attempt and
corresponding error). In all humility I apologise for any bad c...
2008 Apr 15
1
disturbing seed dependence in optim L-BFGS-B method
The the use of optim with the L-BFGS-B method for the following simple
function gives erroneous results. Any help appreciated!
Best,
Bob Reilly
# Code:
V=function(p){
p1=p[1];p2=p[2]
y=p1*p2-.4*(p1+p2)
return(-y)}
p=c(.2,.2) # p=c(.8,.8)
max=optim(p,V,method = "L-BFGS-B",lower=c(0,0),upper=c(1,1))
max1=optim(max$par,V...
2008 Sep 28
0
constrained logistic regression: Error in optim() with method = "L-BFGS-B"
Dear R Users/Experts,
I am using a function called logitreg() originally described in MASS (the
book 4th Ed.) by Venebles & Ripley, p445. I used the code as provided but
made couple of changes to run a 'constrained' logistic regression, I set the
method = "L-BFGS-B", set lower/upper values for the variables.
Here is the function,
logitregVR <- function(x, y, wt = rep(1, length(y)), intercept = T, start =
rep(0.1, p), ...)
{
#-------------------------------------------#
# A function to be minimized (or maximized) #
#--------------------------...
2007 Aug 13
1
[Fwd: behavior of L-BFGS-B with trivial function triggers bug in stats4::mle]
I sent this in first on 30 July. Now that UseR! is over I'm trying again
(slightly extended version from last time).
With R 2.5.1 or R 2.6.0 (2007-08-04 r42421)
"L-BFGS-B" behaves differently from all of the
other optim() methods, which return the value of the function
when they are given a trivial function (i.e., one with no
variable arguments) to optimize. This is not
a bug in L-BFGS-B (more like a response to
an undefined condition), but it leads to a bug...
2016 Oct 08
4
optim(…, method=‘L-BFGS-B’) stops with an error message while violating the lower bound
Hello:
The development version of Ecdat on R-Forge contains a vignette
in which optim(?, method=?L-BFGS-B?) stops with an error message while
violating the lower bound.
To see all the details, try the following:
install.packages("Ecdat", repos="http://R-Forge.R-project.org")
Then do "help(pac=Ecdat)" -> "User guides, package vignettes and
ot...
2008 Mar 31
2
L-BFGS-B needs finite values of 'fn'
Dear All,
I am trying to solve the optimization problem below, but I am always
getting the following error:
Error in optim(rep(20, nvar), f, gr, method = "L-BFGS-B", lower = rep(0, :
L-BFGS-B needs finite values of 'fn'
Any ideas?
Thanks in advance,
Paul
-----------------------------------------------
k <- 10000
b <- 0.3
f <- function(x) {
n <- length(x)
r <- sum((b^(0:(n-1)))*log(x)) - 2000000*(sum(x)-k)^2
retu...
2008 Sep 29
0
Logistic Regression using optim() give "L-BFGS-B" error, please help
...the new query below.
Dear R Users/Experts,
I am using a function called logitreg() originally described in MASS (the
book 4th Ed.) by Venebles & Ripley, p445. I used the code as provided but
made couple of changes to run a 'constrained' logistic regression, I set the
method = "L-BFGS-B", set lower/upper values for the variables.
Here is the function,
logitregVR <- function(x, y, wt = rep(1, length(y)), intercept = T, start =
rep(0, p), ...)
{
#-------------------------------------------#
# A function to be minimized (or maximized) #
#--------------------------------...
2017 Dec 31
1
Order of methods for optimx
Dear R-er,
For a non-linear optimisation, I used optim() with BFGS method but it
stopped regularly before to reach a true mimimum. It was not a problem
with limit of iterations, just a local minimum. I was able sometimes to
reach better minimum using several rounds of optim().
Then I moved to optimx() to do the different optim rounds automatically
using "...
2011 Sep 22
1
nlm's Hessian update method
Hi R-help!
I'm trying to understand how R's nlm function updates its estimate of the Hessian matrix. The Dennis/Schnabel book cited in the references presents a number of different ways to do this, and seems to conclude that the positive-definite secant method (BFGS) works best in practice (p201). However, when I run my code through the optim function with the method as "BFGS", slightly different estimates are produced to that of nlm:
> optim(strt,jointll2,method="BFGS",hessian=T)$par
-0.4016808 0.6057144 0.3744790 -7.18...
2013 Oct 09
1
Version of L-BFGS-B used in optim etc
Hi.
I just noticed the paper by Morales and Nocedal
Remark on "Algorithm 778: L-BFGS-B: Fortran Subroutines for Large-Scale
Bound Constrained Optimization". TOMS 2011; 38(1): 7
http://www.ece.northwestern.edu/~morales/PSfiles/acm-remark.pdf
which describes a couple of improvements (speed and accuracy) to the
original Netlib code which AFAICT is that still used by optim()...
2001 Nov 08
3
Problem with optim (method L-BFGS-B)
...ely, all the optimal values fall in their range of possible
value. But to be rigourous, I should perform a box-constrained
optimization.
Then, I do so with the following command (in fixing the lower and upper
args and not):
optim(c(200,60,500,300,700),test,control=list(fnscale=-1),method="L-BFGS-B",lower=c(200,20,300,200,400),upper=c(500,60,500,300,700))$par
[1] 200 60 500 300 700
optim(c(200,60,500,300,700),test,control=list(fnscale=-1),method="L-BFGS-B")$par
[1] 200.00000 60.00007 500.00000 300.00000 700.00000
Here the result I get is wrong, and in fact it is more o...
2016 Oct 10
0
optim(…?=, =?utf-8?Q?method=‘L-BFGS-B’) stops with an error message while violating the lower bound
...>>>> Spencer Graves <spencer.graves at prodsyse.com>
>>>>> on Sat, 8 Oct 2016 18:03:43 -0500 writes:
[.............]
> 2. It would be interesting to know if the
> current algorithm behind optim and optimx with
> method='L-BFGS-B' incorporates Morales and Nocedal (2011)
> 'Remark on ?Algorithm 778: L-BFGS-B: Fortran Subroutines
> for Large-Scale Bound Constrained Optimization?'. I
> created this vignette and started this threat hoping that
> someone on the R Core team might decide...