Displaying 20 results from an estimated 30000 matches similar to: "Minimise a parameter of a given function f, with f > 0"
2010 Jun 17
2
constrOptim( ): conflict between help page and code
There is a contradiction between what the help page says and what constrOptim actually
does with the constraints. The issue is what happens on the boundary.
The help page says
The feasible region is defined by ?ui %*% theta - ci >= 0?,
but the R code for constrOptim reads
if (any(ui %*% theta - ci <= 0))
stop("initial value not feasible")
The following example
2009 Apr 07
1
get optim results into a model object
Hello all, I have an optimization routine that is giving me good results,
but the results are not in the nice "model" format like "lm". How can I get
optim results into a model so that I can use the clever 'fitted',
'residuals', and 'summary' functions?
Using optim is the only way that I was able to make a model that
1) sums the betas to 1,
2)
2011 Sep 08
3
global optimisation with inequality constraints
Dear All,
I would like to minimise a nonlinear function subject to linear inequality constraints as part of an R program. I have been using the constrOptim function. I have tried all of the methods that come with Optim, but nothing finds the correct solution. If I use the correct solution as the vector of starting values, though, my program does output the correct solution and optimum - the
2003 Oct 29
1
constrOptim doesn´t send arguments to optim!(?)
Hi,
I think that there something wrong with the 'constrOptim' max/minimization
function because she doesn?t send extra arguments to 'optim' call.
Fact: When I use optim in a f(x,theta)-like function, everything goes ok.
But using constrOptim with the same function leads to error...
Proof: Make a small change in the 'Rosenbrock Banana function' (taken from
the Examples
2004 Jul 14
2
constrOptim and function with additional parameters?
How can I use a function with some additional input parameters
in constrOptim? For example, something like
fr <- function(x,a) { ## Rosenbrock Banana function
x1 <- x[1]
x2 <- x[2]
a * (x2 - x1 * x1)^2 + (1 - x1)^2
}
where the optimum is to be found w.r.t. x. Calling
optim(c(-1.2,1), fr, NULL, a=100) works as expected, but I fail
to provide the a=100 in the constrained case:
2011 Dec 20
1
constrOptim and problem with derivative
Dear List,
I am using constrOptim to solve the following
fr1 <- function(x) {
b0 <- x[1]
b1 <- x[2]
((1/(1+exp(-b0+b1))+(1/(1+exp(-b0)))+(1/(1+exp(-b0-b1)))))/3
}
As you can see, my objective function is
((1/(1+exp(-b0+b1))+(1/(1+exp(-b0)))+(1/(1+exp(-b0-b1)))))/3 and I would
like to solve for both b0 and b1.
If I were to use optim then I would derive the gradient of the
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
2008 Jun 08
2
optim, constrOptim: setting some parameters equal to each other
Hello, and apologies for the upcoming naive questions. I am a biologist who is trying to teach himself the appropriate areas of math and stats. I welcome pointers to suggested background reading just as much as I do direct answers to my question.
Let's say I have a function F() that takes variables (a,b,c,a1,b1,c1) and returns x, and I want to find the values of these variables that result in
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
2011 Dec 21
1
constrOptim and further arguments
Dear List,
I have the code below, where I am using the constrained optimisation
package, 'constrOptim.nl' to find the values of two values, b0 and b1.
I have no problems when I enter further variable information DIRECTLY into
the functions, fn, and heq. In this instance I require fn to have -0.0075
appended to it, and in the case of heq, h[1] has -0.2.
library(alabama)
2009 Nov 18
1
bug in '...' of constrOptim (PR#14071)
Dear all,
There appears to be a bug in how constrOptim handles ... arguments that
are suppose to be passed to optim, according to the documentation. This
means you can't get the hessian to be returned, for example (so this is
a real problem, and not just a question of mistaken documentation).
Looking at the code, it appears that a call to the user-defined f
includes the ..., when the ...
2004 Oct 05
1
constrOptim convergence
Hello, I got a question with the R function constrOptim.
>From the R help, it says that the return values of "constrOptim" are the
same as "optim". For the return value "convergence" of the function
"optim", the values should be 0, 1, 10, 51 and 52. See
http://www.maths.lth.se/help/R/.R/library/stats/html/optim.html
When I use constrOptim, I get
2012 Sep 17
2
Constraint Optimization with constrOptim
Hi,
I am having trouble using constrOptim. My target is to do a portfolio optimization and there some constraints have to be fulfilled.
1) The weight of each share of the portfolio has to be greater than 0
2) The sum of these weights has to be 1
I am able to fulfill either the first or the second constraint but not both.
One simple way would be to fulfill the first constraint by using optim as
2009 Jun 03
1
Using constrOptim() function
I have a function myFunction(beta,x) where beta is a vector of coefficients
and x is a data frame (think of it as a matrix). I want to optimize the
function myFunction() by ONLY changing beta, i.e. x stays constant, with 4
constraints. I have the following code (with a separate source file for the
function):
rm(list=ls())
source('mySourceFile')
2008 Jun 17
2
constrOptim with method = "L-BFGS-B"
Hi,
i need to minimize a quadratic function with boundary condidtions and one
equality condition.
In order to do that i converted the equality constraint into 2 inequality
constaints and passed everything cia constrOptim, as the manual said:
everything included in the ... will be passed to Optim that will pass it
back to fn in case it does not need it.
My code is the following:
mat <-
2004 Apr 27
1
constrOptim does ineq, not eq, but who do ?
Hi everybody,
please, could you give me help ? I scanned the help archives and didn't
found hints...
I want to solve a large sparse linear system subjected to an inequality
constrains (all solutions positive) and an equality constrain (all
solutions sum to 1), thus I tried to fool constrOptim using:
x[1] + 0 + ... + 0 >= 0
...
0 + 0 + ... + x[n] >= 0
x[1] + x[2] + ... +
2009 Sep 11
1
constrOptim parameters
Dear R wizards: I am playing (and struggling) with the example in the
constrOptim function. simple example. let's say I want to constrain my
variables to be within -1 and 1. I believe I want a whole lot of
constraints where ci is -1 and ui is either -1 or 1. That is, I have 2*N
constraints. Should the following work?
N=10
x= rep(1:N)
ci= rep(-1, 2*N)
ui= c(rep(1, N), rep(-1, N))
2004 Aug 09
4
linear constraint optim with bounds/reparametrization
Hello All,
I would like to optimize a (log-)likelihood function subject to a number of
linear constraints between parameters. These constraints are equality
constraints of the form A%*%theta=c, ie (1,1) %*% 0.8,0.2)^t = 1 meaning
that these parameters should sum to one. Moreover, there are bounds on the
individual parameters, in most cases that I am considering parameters are
bound between zero
2009 Jan 28
2
constrainOptim
Dear R helpers
I have a question regarding the constrainOptim.
I'm coding the nested logit and would like to set a bound of rho to (0,1] as an extreme value distribution where rho = exp(lambda)/1+exp(lambda)
I wonder if I can do that directly in optim (say rho > 0 & <= 1) or need to use constrainOptim
I read the help but still don't know how to set ui and ci
Thanks,
June
2008 Mar 05
6
box-constrained
Un texte encapsul? et encod? dans un jeu de caract?res inconnu a ?t? nettoy?...
Nom : non disponible
Url : https://stat.ethz.ch/pipermail/r-help/attachments/20080305/80536e8c/attachment.pl