Displaying 20 results from an estimated 20000 matches similar to: "Using optim with parameters that are factors (instead of continuous parameters)"
2009 Mar 29
4
Constrined dependent optimization.
I have an optimization question that I was hoping to get some suggestions on how best to go about sovling it. I would think there is probably a package that addresses this problem.
This is an ordering optimzation problem. Best to describe it with a simple example. Say I have 100 "bins" each with a ball in it numbered from 1 to 100. Each bin can only hold one ball. This optimization is
2003 Jul 16
2
numerical differentiation in R? (for optim "SANN" parscale)
Dear R users,
I am running a maximum likelihood model with optim. I chose the
simulated annealing method (method="SANN").
SANN is not performing bad, but I guess it would be much more effecive
if I could set the `parscale' parameter.
The help sais:
`parscale' A vector of scaling values for the parameters.
Optimization is performed on `par/parscale' and these
2010 Mar 01
2
Advice wanted on using optim with both continuous and discrete par arguments...
Dear R users,
I have a problem for which my objective function depends on both discrete and continuous arguments.
The problem is that the number of combinations for the (multivariate) discrete arguments can become overwhelming (when it is univariate this is not an issue) hence search over the continuous arguments for each possible combination of the discrete arguments may not be feasible. Guided
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
2011 Dec 16
1
optim with simulated annealing SANN for combinatorial optimization
Hi all
I am trying to solve a combinatorial optimization problem. Basically, I can
reduce my problem into the next problem:
1.- Given a NxN grid of points, with some values in each cell
2.- Find the combination of K points on the grid such that, the maximum
mean value is obtained
I took the Travel SalesMan problem example in ?optim documentation. I am
not sure if I have understood correctly
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,
2004 May 28
1
optim(method="SANN")
Hello List
I'm working on a combinatoric problem in which the object is to
minimize the badness() of a vector. I think this class of problem is only
soluble by optim() using method=SANN.
The badness() of anything is >= 0, and when I've found a solution with
zero badness, I want optim() to stop (carrying on beyond zero badness
cannot improve the solution). Efficiency is crucial here.
2009 Oct 20
1
Buglet in optim() SANN
I think SANN method in optim() is failing to report that it has not
converged. Here is an example
genrose.f<- function(x, gs=NULL){ # objective function
## One generalization of the Rosenbrock banana valley function (n
parameters)
n <- length(x)
if(is.null(gs)) { gs=100.0 }
fval<-1.0 + sum (gs*(x[1:(n-1)]^2 - x[2:n])^2 + (x[2:n] - 1)^2)
return(fval)
}
2008 Mar 16
1
optim: why is REPORT not used in SANN?
Hello,
I wonder why the control parameter REPORT is not supported by method
SANN. Looking into optim.c I found an internal constant:
#define STEPS 100
... and decreasing this to 10 helped me fine-tuning the annealing
parameters in an actual problem.
Is there any reason why not passing nREPORT to samin and setting
something like:
STEPS = nREPORT / tmax
Thomas P.
--
Thomas Petzoldt
2013 Feb 27
2
temp seems ineffective in SANN (optim)
I am trying to control the behavior of the SANN method in optim (R
2.14.1) via control$temp. In my toy tests it works; in my real use, it
doesn't.
As far as I can tell my code with different temp values is loaded; I
even traced into the function that calls optim and verified temp had the
value I had set.
Could the fact that I have NaN's coming back from the objective function
be a
2008 Apr 05
2
How to improve the "OPTIM" results
Dear R users,
I used to "OPTIM" to minimize the obj. function below. Even though I used
the true parameter values as initial values, the results are not very good.
How could I improve my results? Any suggestion will be greatly appreciated.
Regards,
Kathryn Lord
#------------------------------------------------------------------------------------------
x = c(0.35938587,
2008 Apr 05
2
How to improve the "OPTIM" results
Dear R users,
I used to "OPTIM" to minimize the obj. function below. Even though I used
the true parameter values as initial values, the results are not very good.
How could I improve my results? Any suggestion will be greatly appreciated.
Regards,
Kathryn Lord
#------------------------------------------------------------------------------------------
x = c(0.35938587,
2003 Sep 08
1
Probit and optim in R
I have had some weird results using the optim() function. I wrote a
probit likelihood and wanted to run it with optim() with simulated
data. I did not include a gradient at first and found that optim()
would not even iterate using BFGS and would only occasionally work
using SANN. I programmed in the gradient and it iterates fine but the
estimates it returns are wrong. The simulated data work
2008 Jun 26
1
Question about Constraint Optimization
Dear All,
I am having trouble in using R function "constrOptim" to do constraint
optimization. It seems that "constrOptim" calls function "optim" when it
does the optimization, and "optim" allows us to set "method" to be "SANN"
if we want to use simulated annealing. In "optim", the function allows us
to set gradient to be
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
2008 Jan 18
1
constrOptim with method SANN
Hi Everyone,
I'm trying to minimize a function using constrOptim with
the simulated annealing method SANN.
If I understand constrOptim well, it basically passes most
of its arguments to optim while somehow enforcing the constraints.
My problem is, that since SANN does not need gradients,
when using optim with SANN, the gr argument of optim is
used to specify a function to create the next
2004 Oct 02
1
constraints in optim?
>
optim(c(1,1),LL,method="SANN",control=list(fnscale=-1),trans=trans,times=times)
$par
[1] 17.422635 -1.606859
How could i constraint that the parameters should be both positive in
my maximizing problem?
I check constrOptim but here i could only constraint the variables trans and
times and not my parameters?
many thanks, regards
Christian
2007 Apr 23
4
Estimates at each iteration of optim()?
I am trying to maximise a complicated loglikelihood function with the "optim" command. Is there some way to get to know the estiamtes at each iteration? When I put "control=list(trace=TRUE)" as an option in "optim", I just got the initial and final values of the loglikelihood, number of iterations and whether the routine has converged or not. I need to know the
2008 Apr 04
2
suggested minor patch for optim.R
optim ignores misspelled control parameters, so that trying
to set (e.g.) "maxint=1000" in the control argument silently
does nothing. The patch below (watch out for line breaks! also
posted at http://www.zoo.ufl.edu/bolker/optim_patch.R , and
http://www.zoo.ufl.edu/bolker/optim_new.R) adds
three lines to optim.R that issue a warning if any names of
elements of "control" fail
2008 Feb 10
1
Error in optim while using fitdistr() function for estimation of parameters
Hello,
I am trying to fit distribution for data consisting of 421 readings.It is
basically no of requests arrived per minute.It contains many 0 entries as no
of requests.When i use
fd<-fitdistr(V2,"gamma")
I get following error:
Error in optim(x = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, :
initial value in 'vmmin' is not finite
What should I do ? I need