similar to: Re: [R] constrOptim and function with additional parameters? (PR#7089)

Displaying 20 results from an estimated 6000 matches similar to: "Re: [R] constrOptim and function with additional parameters? (PR#7089)"

2004 Jul 14
0
Re: [R] constrOptim and function with additional parameters? (PR#7088)
I've moved this from r-help to r-bugs. If you reply, please be careful that replies go to the right place: r-bugs if your comment is specifically about the bug (and it contains the PR# in the subject that will be added when this is cc'd to r-devel), r-devel if general discussion, not both. On Wed, 14 Jul 2004 10:01:45 -0400, "Roger D. Peng" <rpeng@jhsph.edu> wrote :
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:
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
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
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 ...
2012 Apr 26
0
Problem with constrOptim when hitting boundary
Hello, I am using constrOptim to maximize a likelihood function (the values of my parameter vector must be between zero and one and must sum up to <=1). I am getting the error 'initial value in 'vmmin' is not finite'. I've tracked it down to a problem in the function 'R' defined within the constrOptim function. It is performing a check on my values, and its not
2012 Dec 07
1
Error using constrOptim in constraint definition
Hello, I'm trying to run constrOptim. It returns to me an error about the fact that constraints arguments (ui and ci) are non compatibles: > optout= constrOptim(startparams, f=ImpulseSS, grad=grImpulse, ui=UI, ci=CI, data=gexp[k,], t=t) Error in ui %*% theta : non-conformable arguments I would like to point out that I can calculate that product in the command line: > UI %*%
2003 Oct 31
1
help with constrOptim function
Hello. I had previously posted a question concerning the optimization of a nonlinear function conditional on equality constraints. I was pointed towards the contrOptim function. However, I do not understand the syntax of this function with respect to specifying the constraints and so I don’t know if it is what I need. The command is: constrOptim(theta, f, grad,ui,ci,…). “theta” is the
2009 Mar 25
0
constrOptim workaround for "L-BFGS-B" or Box Constraints
This is not so much a question as a contribution, but comments are welcome. Comments: 1) thank you very much to Paul Smith in the post https://stat.ethz.ch/pipermail/r-help/2008-March/157249.html This is intended to build on that example with something more complex than a 2x2 set of constraints 2) "L-BFGS-B" does not appear to work in optimConst Problem: let's
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
2010 Oct 12
1
R optimization and curve()?
I'm trying to figure out how to plot basic utility maximization results with R, Ideally I'd like to plot the value of u through x1,x2 space, so you can graph income / substitution effects easily... also, it'd be nice if I could put a linear budget constraint on the graph here's an example with cobb douglas utility u <- function(x) { x1 <- x[1] x2 <- x[2]
2005 Sep 26
2
constrOptim (PR#8158)
Full_Name: Haobo Ren Version: 2.1.1 OS: Windows 2000 Submission from: (NULL) (192.11.226.116) When running constrOptim, there is error message Error: subscript out of bounds
2004 Apr 02
0
Hessian in constrOptim
Dear R-users, In the function constrOptim there is an option to get an approximation to the hessian of the surrogate function R at MLE by declaring hessian=TRUE in the calls to the function optim. I would like to ask if it is advisable to get an approximate hessian for the funcrion f as follows: f''(theta)=R''(theta|theta_k)-B''(theta) where
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 Jan 18
0
constrOptim with 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
2013 Sep 26
0
ConstrOptim Function (Related to Constraint Matrix/ui/ci error)
Hello All, I am stuck in the following problem. Cexpt=c(0,25,50,100,150,300,250,125,40) t=c(0,0.2,0.4,0.6,1,4,8,12,24) theta0= vector of 6 parms (My initial parameter) A=Constraint matrix (hopefully 6*6) B= Constraint vector of length 6) Cfit=function(t,theta){ J(t)=function(theta,t) Cfit=function(J(t),constant) return(Cfit) } loss=function(theta,t,Cexpt) {
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')
2004 Nov 05
1
Code/doc inconsistancy in constrOptim (PR#7346)
Code in constrOptim() (R-2.0.0, package stats): if (any(ui %*% theta - ci <= 0)) stop("initial value not feasible") but the help page tells us in Section "Details": "The feasible region is defined by ui %*% theta - ci >= 0." Uwe Ligges --please do not edit the information below-- Version: platform = i386-pc-mingw32 arch = i386 os =
2008 May 12
1
hessian in constrained optimization (constrOptim)
Dear helpers, I am using the function "constrOptim" to estimate a model with ML with an inequality constraint using the option method='Nelder-Mead'. When I specify the option: hessian = TRUE I obtain the response: Error in f(theta, ...) : unused argument(s) (hessian = TRUE) I guess the function "constrOptim" does not allow this argument which, on the other hand, is
2007 Sep 07
1
'initial value not feasible' in constrOptim
Dear friends. I am using function constrOptim(c(0.5,0.3,0.5), fit.error, fit.error.grr, ui=-1*ui,ci=-1*ci) and I am confronted with error message "initial value not feasible" I plug in the initial value of (0.5,0.3,0.5) to function fit.error and fit.error.grr and have pretty reasonable result. I inequality "ui %*% theta - ci >= 0" as suggested in the R manual and it is