Displaying 20 results from an estimated 3000 matches similar to: "Stopping precision using 'optim'"
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)
2009 Nov 02
2
a prolem with constrOptim
Hi,
I apologize for the long message but the problem I encountered can't be stated in a few lines.
I am having some problems with the function constrOptim. My goal is to maximize the likelihood of product of K multinomials, each with four catagories under linear constraints on the parameter values. I have found that the function does not work for many data configurations.
#The likelihood
2007 Jan 03
1
optim
Hi!
I'm trying to figure out how to use optim... I get some really strange results, so I guess I got something wrong.
I defined the following function which should be minimized:
errorFunction <- function(localShifts,globalShift,fileName,experimentalPI,lambda)
{
lambda <- 1/sqrt(147)
# error <- abs(errHuber(localShifts,globalShift,
#
2012 Oct 10
1
"optim" and "nlminb"
#optim package
estimate<-optim(init.par,Linn,hessian=TRUE, method=c("L-BFGS-B"),control =
list(trace=1,abstol=0.001),lower=c(0,0,0,0,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf,-Inf),upper=c(1,1,1,1,Inf,Inf,Inf,Inf,Inf,Inf,Inf,Inf,Inf))
#nlminb package
estimate<-nlminb(init.par,Linn,gr=NULL,hessian=TRUE,control =
2012 Nov 05
1
relative convergence in 'optim'
Dear list,
I have a question related to the correct interpretation of the
relative convergence criterion used by 'optim'.
In the help of the function is it written that:
"reltol:Relative convergence tolerance. The algorithm stops if it is
unable to reduce the value by a factor of reltol * (abs(val) + reltol)
at a step."
and I was wondering if the previous criterion is
2009 Apr 15
2
issue with L-BFGS-B in optim (optim just hangs)
Dear R-Help List,
I am using optim, with method=L-BFGS-B, to maximize a likelihood inside
a large simulation exercise. This runs fine for most simulated data
sets, but for some reason, about 1 out of 100 times, optim will just hang.
Using a dumb approach to the problem (i.e. printing the parameter values
each time the function being maximized is evaluated), I tracked down
when this happens,
2004 Jun 23
1
How to define stopping criterium for Optim with L-BFGS-B
Hi,
I am using optim with a L-BFGS-B method to minimize a function. As I've
understood, the way to specify a tolerance for stopping optimization is
through "factr" argument.
My function, is by construction, minimal when equal to 1. I wonder if there
is any way to pass this info to "optim". If not, how "factr" argument works
(I am quite confused about the
2007 Oct 13
1
R API - optim
I am trying to use the R API to call optim functions (nmmin, vmmin, lbfgsb,
etc.) through a C program but I couldn't find the shared library to link
under the R-2.6.0 build which is compiled under Linux (REL5).
main.cpp:35: undefined reference to `Rf_initEmbeddedR(int, char**)'
main.cpp:41: undefined reference to `nmmin'
Thanks in advance for any help.
------------------------
2012 Jan 05
2
difference of the multinomial logistic regression results between multinom() function in R and SPSS
Dear all,
I have found some difference of the results between multinom() function in
R and multinomial logistic regression in SPSS software.
The input data, model and parameters are below:
choles <- c(94, 158, 133, 164, 162, 182, 140, 157, 146, 182);
sbp <- c(105, 121, 128, 149, 132, 103, 97, 128, 114, 129);
case <- c(1, 3, 3, 2, 1, 2, 3, 1, 2, 2);
result <- multinom(case ~ choles
2008 Mar 07
1
parameters for lbfgsb (function for optimization)
Can anyone help me with lbfgsb (function for optimization)?
It takes the following parameters:
void lbfgsb (int n, int lmm, double *x, double *lower,
double *upper, int *nbd, double *Fmin, optimfn fn,
optimgr gr, int *fail, void *ex, double factr,
double pgtol, int *fncount, int *grcount,
int maxit, char *msg, int trace, int nREPORT);
What do I put for parameter ex (11th parameter)? I looked at
2006 Apr 13
1
bus error on calling nmmin
Hi,
I'm trying to get a toy program making use of nmmin to run
successfully. I've gotten to the point of compiling. However, when I
attempt to run my executable, I guess a bus error. I see that someone
else has asked about using nmmin before
<http://tolstoy.newcastle.edu.au/R/help/06/03/23944.html>, but I
haven't come across any replies.
Is there some documentation on how to
2019 May 03
2
R optim(method="L-BFGS-B"): unexpected behavior when working with parent environments
On 03/05/2019 10:31, Serguei Sokol wrote:
> On 02/05/2019 21:35, Florian Gerber wrote:
>> Dear all,
>>
>> when using optim() for a function that uses the parent environment, I
>> see the following unexpected behavior:
>>
>> makeFn <- function(){
>> ???? xx <- ret <- NA
>> ???? fn <- function(x){
>> ??????? if(!is.na(xx)
2019 May 02
2
R optim(method="L-BFGS-B"): unexpected behavior when working with parent environments
Dear all,
when using optim() for a function that uses the parent environment, I
see the following unexpected behavior:
makeFn <- function(){
??? xx <- ret <- NA
??? fn <- function(x){
?????? if(!is.na(xx) && x==xx){
?????????? cat("x=", xx, ", ret=", ret, " (memory)", fill=TRUE, sep="")
?????????? return(ret)
?????? }
?????? xx
2006 Feb 06
1
auth: out of memory
Hello :)
I just couldn't login to my dovecot imap (1.0-beta2). Dovecot authenticates
from mysql database.
Feb 6 19:47:33 elfstone dovecot: auth-worker(default_with_listener):
sql(damirh at noviforum.si): User query failed: MySQL client run out of memory
Feb 6 19:47:52 elfstone dovecot: auth-worker(default_with_listener): ^GOut of
memory (Needed 8164 bytes)
Feb 6 19:47:52 elfstone
2008 Oct 02
1
In the OPTIM message....
Dear all
When I used the method, L-BFGS-B, in OPTIM, I've got the following message.
---------------------------------------------------------------------
$par
[1] 0.176166426835580
$value
[1] 1322.17600079332
$counts
function gradient
8 8
$convergence
[1] 0
$message
[1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH"
$hessian
[,1]
[1,]
2019 May 03
2
R optim(method="L-BFGS-B"): unexpected behavior when working with parent environments
Yes, I think you are right. I was at first confused by the fact that after the optim() call,
> environment(fn)$xx
[1] 10
> environment(fn)$ret
[1] 100.02
so not 9.999, but this could come from x being assigned the final value without calling fn.
-pd
> On 3 May 2019, at 11:58 , Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
>
> Your results below make it look like a
2019 May 06
2
R optim(method="L-BFGS-B"): unexpected behavior when working with parent environments
Optim's Nelder-Mead works correctly for this example.
> optim(par=10, fn=fn, method="Nelder-Mead")
x=10, ret=100.02 (memory)
x=11, ret=121 (calculate)
x=9, ret=81 (calculate)
x=8, ret=64 (calculate)
x=6, ret=36 (calculate)
x=4, ret=16 (calculate)
x=0, ret=0 (calculate)
x=-4, ret=16 (calculate)
x=-4, ret=16 (memory)
x=2, ret=4 (calculate)
x=-2, ret=4 (calculate)
x=1, ret=1
2000 Jul 28
1
optim gets stuck
Dear all
I'm having some trouble with a bound-constrained optimization using
optim(...,method="L-BFGS-B").
Usually, everything works fine, but for some simulations, the algorithm just
gets stuck.
When I let my function (+gradient) evaluation print out the
function value, I see that L-BFGS-B keeps calling the function with
arguments giving the same function value (up to at least
2007 Jan 19
8
kate editor for R
Like kile for LaTeX, Linux/KDE's kate editor is an excellent editor for
R, with easy code submission to a running R process. Syntax
highlighting is good. I have not been able to figure out two things:
- how to automatically reformat a line or region of text using good
indentation rules (Emacs/ESS make this so easy by just hitting Tab while
the cursor is in a line, or highlighting a
2010 Nov 03
3
optim works on command-line but not inside a function
Dear all,
I am trying to optimize a logistic function using optim, inside the
following functions:
#Estimating a and b from thetas and outcomes by ML
IRT.estimate.abFromThetaX <- function(t, X, inits, lw=c(-Inf,-Inf),
up=rep(Inf,2)){
optRes <- optim(inits, method="L-BFGS-B", fn=IRT.llZetaLambdaCorrNan,
gr=IRT.gradZL,
lower=lw, upper=up, t=t, X=X)