similar to: stats package, optim and other optimization methods: more parameters?

Displaying 20 results from an estimated 20000 matches similar to: "stats package, optim and other optimization methods: more parameters?"

2012 Feb 10
3
Schwefel Function Optimization
All, I am looking for an optimization library that does well on something as chaotic as the Schwefel function: schwefel <- function(x) sum(-x * sin(sqrt(abs(x)))) With these guys, not much luck: > optim(c(1,1), schwefel)$value [1] -7.890603 > optim(c(1,1), schwefel, method="SANN", control=list(maxit=10000))$value [1] -28.02825 > optim(c(1,1), schwefel, lower=c(-500,-500),
2012 Feb 10
3
Schwefel Function Optimization
All, I am looking for an optimization library that does well on something as chaotic as the Schwefel function: schwefel <- function(x) sum(-x * sin(sqrt(abs(x)))) With these guys, not much luck: > optim(c(1,1), schwefel)$value [1] -7.890603 > optim(c(1,1), schwefel, method="SANN", control=list(maxit=10000))$value [1] -28.02825 > optim(c(1,1), schwefel, lower=c(-500,-500),
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
2009 Jun 16
2
Trouble with optim on a specific problem
Hello! I am getting the following errors when running optim() [I tried optim() with 3 different methods as you can see]: Error in optim(c(0.66, 0.999, 0.064), pe, NULL, method = "L-BFGS-B") : objective function in optim evaluates to length 6 not 1 > out <- optim( c(0.66, 0.999, 0.064), pe, NULL, method = "Nelder-Mead") Error in optim(c(0.66, 0.999, 0.064),
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
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",
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
2007 Apr 09
1
R:Maximum likelihood estimation using BHHH and BFGS
Dear R users, I am new to R. I would like to find *maximum likelihood estimators for psi and alpha* based on the following *log likelihood function*, c is consumption data comprising 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))});
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
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>
2010 Aug 06
1
on the optim function
Dear useRs, I have just discovered that the R optim function does not return the number of iterations. I still wonder why line 632-634 of optim C, the iter variable is not returned (for the BFGS method for example) ? Is there any trick to compute the iteration number with function call number? Kind regards Christophe -- Christophe Dutang Ph.D. student at ISFA, Lyon, France website:
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
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
2011 Aug 13
3
optimization problems
Dear R users I am trying to use OPTIMX(OPTIM) for nonlinear optimization. There is no error in my code but the results are so weird (see below). When I ran via OPTIM, the results are that Initial values are that theta0 = 0.6 1.6 0.6 1.6 0.7. (In fact true vales are 0.5,1.0,0.8,1.2, 0.6.) -------------------------------------------------------------------------------------------- >
2010 Jun 22
1
Subject: Re ZINB by Newton Raphson??
I have not included the previous postings because they came out very strangely on my mail reader. However, the question concerned the choice of minimizer for the zeroinfl() function, which apparently allows any of the current 6 methods of optim() for this purpose. The original poster wanted to use Newton-Raphson. Newton-Raphson (or just Newton for simplicity) is commonly thought to be the
2007 Mar 02
1
Help with faster optimization for large parameter problem
Hello all, I have a large parameter problem with the following very simple likelihood function: fn<-function(param) { x1<-param[1:n] g1<-param[(n+1):(2*n)] beta<-param[(2*n+1):(2*n+k)] sigma2<-param[2*n+k+1]^2 meang1sp<-mean(g1[sp]) mu<-beta%*%matrix(x1,1,n)-(g1[sp]-meang1sp)%*%matrix(g1,1,n) return(sum((ydc-mu)^2)/(2*sigma2) + n*k*log(sqrt(sigma2)) +
2010 Oct 01
1
Place constrictions on parameters when using Optim and MaxLik
Hi R users, I am trying to restrct the range of two of the parameters in a maximization problem. Both parameters should be between -1 and 1. As far as I know, if I choose the estimation method ="L-BFGS-B" under Optim, I can restrict the parameter space. However, the "L-BFGS-B" always require finite values of the loglik function and cannot get around of the problem if an
2009 Aug 19
4
Confidence interval on parameters from optim function
Hi everyone, I have two questions: I would like to get confidence intervals on the coefficients derived from the optim() function. I apply optim() to a given function f > res <- optim(c(0.08,0.04,1.),f,NULL,method="L-BFGS-B",lower=c(0.,0.,0.)) And I would like to get the p-value and confidence intervals associated with > res$par My second question deals with error message. I
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