Displaying 20 results from an estimated 6000 matches similar to: "optim() non-finite finite-difference value"
2011 Apr 18
3
how to extract options for a function call
Hi, I'm having some difficulties formulating this question.
But what I want,
is to extract the options associated with a parameter for a function.
e.g.
method = c("Nelder-Mead", "BFGS", "CG", "L-BFGS-B", "SANN")
in the optim function.
So I would like to have a vector with
c("Nelder-Mead", "BFGS", "CG",
2011 Jul 11
3
fitdistr() Error
I am trying to estimate a gamma function using real data and I am getting the
following error messages.
When I set a lower limit; the error message is "L-BFGS-B needs finite values of
fn"
?
For other method the error message is:
Error in optim(x = c(0.105286666666667, 0.3472275, 2.057625, 0.329675,? :
? non-finite finite-difference value [1]
The codes works fine for simulated data
2023 Mar 26
2
Query: Could documentation include modernized references?
On 26/03/2023 11:54 a.m., J C Nash wrote:
> A tangential email discussion with Simon U. has highlighted a long-standing
> matter that some tools in the base R distribution are outdated, but that
> so many examples and other tools may use them that they cannot be deprecated.
>
> The examples that I am most familiar with concern optimization and nonlinear
> least squares, but
2023 Mar 26
1
Query: Could documentation include modernized references?
A tangential email discussion with Simon U. has highlighted a long-standing
matter that some tools in the base R distribution are outdated, but that
so many examples and other tools may use them that they cannot be deprecated.
The examples that I am most familiar with concern optimization and nonlinear
least squares, but other workers will surely be able to suggest cases elsewhere.
I was the
2023 Mar 31
1
Query: Could documentation include modernized references?
>>>>> Duncan Murdoch
>>>>> on Sun, 26 Mar 2023 12:41:03 -0400 writes:
> On 26/03/2023 11:54 a.m., J C Nash wrote:
>> A tangential email discussion with Simon U. has
>> highlighted a long-standing matter that some tools in the
>> base R distribution are outdated, but that so many
>> examples and other tools may use
2005 Nov 15
1
An optim() mystery.
I have a Master's student working on a project which involves
estimating parameters of a certain model via maximum likelihood,
with the maximization being done via optim().
A phenomenon has occurred which I am at a loss to explain.
If we use certain pairs of starting values for optim(), it
simply returns those values as the ``optimal'' values, although
they are definitely not
2009 Dec 06
5
optim with constraints
Hi, dear R users
I am a newbie in R and I wantto use the method of meximum likelihood
to fit a Weibull distribution to my survival data. I use "optim" as
follows:
optim(c(1, 0.25),weibull.like,mydata=mydata,method="L-BFGS-B",hessian
= TRUE)
My question is: how do I setup the constraints so that the two
parametrs of Weibull to be pisotive? Or should I use other function
2023 Aug 13
4
Noisy objective functions
While working on 'random walk' applications, I got interested in
optimizing noisy objective functions. As an (artificial) example, the
following is the Rosenbrock function, where Gaussian noise of standard
deviation `sd = 0.01` is added to the function value.
fn <- function(x)
(1+rnorm(1, sd=0.01)) * adagio::fnRosenbrock(x)
To smooth out the noise, define another
2019 Mar 04
2
Package inclusion in R core implementation
As the original coder (in mid 1970s) of BFGS, CG and Nelder-Mead in optim(), I've
been pushing for some time for their deprecation. They aren't "bad", but we have
better tools, and they are in CRAN packages. Similarly, I believe other optimization
tools in the core (optim::L-BFGS-B, nlm, nlminb) can and should be moved to
packages (there are already 2 versions at least of LBFGS
2010 Sep 04
3
How can I fixe convergence=1 in optim
Hi R users,
I am using the optim funciton to maximize a log likelihood function. My
code is as follows:
p<-optim(c(-0.2392925,0.4653128,-0.8332286, 0.0657, -0.0031, -0.00245,
3.366, 0.5885, -0.00008,
0.0786,-0.00292,-0.00081, 3.266, -0.3632, -0.000049, 0.1856,
0.00394, -0.00193, -0.889, 0.5379, -0.000063,
0.213, 0.00338, -0.00026, -0.8912, -0.3023, -0.000056), f,
2015 Sep 17
1
names treatment in optim()
Dear both,
I have found that names are not treated in the same way in optim() depending on the optimization method (argument method).
The example below shows the difference between the Brent method and the L-BFGS-B method.
f <- function(x){ y <- x^2;names(y) <-"f(x)";y}
optim(10, f, method="Brent", lower=-1, upper=10)$value
optim(10, f, method="L-BFGS-B",
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,
#
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 "Nelder-Mead" and
2012 May 01
2
Define lower-upper bound for parameters in Optim using Nelder-Mead method
Dear UseRs,
Is there a way to define the lower-upper bounds for parameters fitted by
optim using the Nelder-Mead method ?
Thanks,
Arnaud
[[alternative HTML version deleted]]
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 stats4::mle --
a spurious error saying that a better fit
has been
2004 Apr 28
4
numericDeriv
Dear All,
I am trying to solve a Generalized Method of Moments problem which
necessitate the gradient of moments computation to get the
standard errors of estimates.
I know optim does not output the gradient, but I can use numericDeriv to
get that. My question is: is this the best function to do this?
Thank you
Jean,
2006 Aug 09
2
optim error
Dear all,
There have been one or two questions posted to the list regarding the optim
error "non-finite finite-difference value [4]." The error apparently means
that the 4th element of the gradient is non-finite. My question is what
part(s) of my program should I fiddle with in an attempt to fix it?
Starting values? Something in the log-likelihood itself? Perhaps the data
2010 Feb 08
2
evolution of Nelder-Mead process
Dear list,
I am looking for an R-only implementation of a Nelder-Mead process that can find local maxima of a spatially distributed variable, e.g. height, on a spatial grid, and outputs the coordinates of the new point during each evaluation. I have found two previous threads about this topic, and was wondering if something similar has been implemented since those messages were posted.
Thank
2009 Feb 12
1
Setting optimizer in lme
I am using R 2.7.0 on a linux platform.
I am trying to reproduce a 2002 example using lme from the nlme library.
I want to change the otimizer from the default (nlminb) to optim.
Specifically, this is what I am trying to do:
R> library(nlme)
R> library(car) # for data only
R> data(Blackmoor) # from car
R> Blackmoor$log.exercise <- log(Blackmoor$exercise + 5/60, 2)
R>
2005 Apr 26
2
"wild" function example in optim
Dear all,
Firstly, I do apologize if my question is simple and posted in the wrong place but I had no reply from the R-help mailing list (maybe it is too simple!).
I was wondering why parscale is set to 20 in the "wild" function example used in ?optim. This function has only one parameter and if we set parscale equal to 1 then the solution near the global minimum is not found.
I