Re: [R] constrOptim
On Wed, 1 Aug 2007, Joanne Lee wrote: The constraints on the optimization problem are: 1 - components of potentialargmin must add to 1. 2 - each potentialargmin component must be (weakly) positive and (weakly) less than 1. 3 - potentialargmin %*% c(1,2,3,4,5,6,7,8,9) = 4.5 constrOptim() is not good at equality constraints, so constraints 1 and 3 would be better expressed by reparametrization. There is no need to constrain the parameters to be positive as the function already goes infinite at zero. Finally, if the parameters are non-negative there is no need to constrain them to be =1, as this is implied by the first constraint. It might be interesting to find out if some automated Lagrange-multiplier approach could be built into constrOptim() for equality constraints, but it is not a high enough priority that I am likely to do it. -thomas Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] constrOptim
Hi, I'm having trouble using the constrOptim function to generate the 9-component vector argmin of the function ELfsds: ELfsds - function(pvechat){ LG=0 for(i in 1:9){ LG=LG+log(pvechat[i]) } return(-LG) } with accompanying gradient function: gradfunc - function(thetavec){ g=1/(9*thetavec) return(g) } The constraints on the optimization problem are: 1 - components of potentialargmin must add to 1. 2 - each potentialargmin component must be (weakly) positive and (weakly) less than 1. 3 - potentialargmin %*% c(1,2,3,4,5,6,7,8,9) = 4.5 I'm starting the optimization routine at: thetatest = c(0.02, 0.2755, 0.139, 0.0955, 0.1025, 0.125, 0.13, 0.055, 0.0575), which satisfies all constraints and was found through trial-and-error guessing. The constrOptim line I've been using is: pvec - constrOptim( thetatest, ELfsds, gradfunc, ui = rbind( -diag(9), dvec, -dvec, rep(-1,9), rep(1,9) ), ci = cbind( c(rep(-1,9), fsdmean-0.005, -fsdmean-0.005, -1.005, 0.995) ) ) (constraints in constrOptim are phrased such that (ui %*% thetatest - ci = 0)) constrOptim says that the argmin of the function is exactly thetatest. I'm confident that I didn't select the argmin with thetatest. I would really appreciate any input you have on this code -- I've been staring at it for a while and feel like I'm just banging my head into the wall now. Thank you very much for your time and help!!! Best regards, Joanne __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] 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 convergence values 7 and 11. What do they mean exactly? Thanks again, Shuangge Ma, Ph.D. __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] constrOptim convergence
On Tue, 5 Oct 2004, Shuangge Ma wrote: 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 convergence values 7 and 11. What do they mean exactly? You should also get a convergence message with these (in the $message component) 7 is Barrier algorithm ran out of iterations and did not converge so the inner iteration converged but the outer iteration with the log barrier didn't 11 is Objective function increased at outer iteration i (or decreased if you are doing maximisation). This probably means that you haven't found the optimum. -thomas Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] constrOptim and function with additional parameters?
On Wed, 14 Jul 2004, Roger D. Peng wrote: Actually, I think this is a bug. Take a look at this part of constrOptim: Yes, as the author I can definitively say that it is a bug. As other people have pointed out there are work-arounds. -thomas constrOptim function (theta, f, grad, ui, ci, mu = 1e-04, control = list(), method = if (is.null(grad)) Nelder-Mead else BFGS, outer.iterations = 10 0, outer.eps = 1e-05, ...) { if (!is.null(control$fnscale) control$fnscale 0) mu - -mu [...] obj - f(theta) ^^^ r - R(theta, theta) for (i in 1:outer.iterations) { obj.old - obj r.old - r [...] } So the object function `f' is called on the starting value `theta' but the `...' is not passed through. -roger Duncan Murdoch wrote: On Wed, 14 Jul 2004 14:59:01 +0200 (MEST), Marlene Mueller [EMAIL PROTECTED] wrote : 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: constrOptim(c(-1.2,0.9), fr, NULL, ui=rbind(c(-1,0),c(0,-1)), ci=c(-1,-1),a=100) Error in f(theta) : Argument a is missing, with no default Is this a bug or is there a different solution that I miss here? I can't spot why your use of constrOptim isn't working, but you should be able to workaround it by doing something like this: applyDefaults - function(fn, ...) { function(x) fn(x, ...) } constrOptim(c(-1.2,0.9), applyDefaults(fr, a=100), NULL, ui=rbind(c(-1,0),c(0,-1)),ci=c(-1,-1)) The applyDefaults function creates a new function which evaluates the old one with some of the parameters set to fixed values. Duncan Murdoch __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] 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: constrOptim(c(-1.2,0.9), fr, NULL, ui=rbind(c(-1,0),c(0,-1)), ci=c(-1,-1),a=100) Error in f(theta) : Argument a is missing, with no default Is this a bug or is there a different solution that I miss here? TIA, Marlene __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] constrOptim and function with additional parameters?
Hi Marlene, from the on-line help file of `constrOptim' you can see that the ... argument is used for passing extra arguments to the `optim' function and not in the function being optimized under constraints. A simple solution would be to pass the value of the extra argument directly to the function definition e.g., `fr(x, a=100)'. Otherwise you could create a new version of `constrOptim' that passes the ... to the function being optimized and `optim' I hope this helps. Best, Dimitris Dimitris Rizopoulos Doctoral Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/396887 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Marlene Mueller [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, July 14, 2004 2:59 PM Subject: [R] 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: constrOptim(c(-1.2,0.9), fr, NULL, ui=rbind(c(-1,0),c(0,-1)), ci=c(-1,-1),a=100) Error in f(theta) : Argument a is missing, with no default Is this a bug or is there a different solution that I miss here? TIA, Marlene __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] constrOptim and function with additional parameters?
On Wed, 14 Jul 2004 14:59:01 +0200 (MEST), Marlene Mueller [EMAIL PROTECTED] wrote : 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: constrOptim(c(-1.2,0.9), fr, NULL, ui=rbind(c(-1,0),c(0,-1)), ci=c(-1,-1),a=100) Error in f(theta) : Argument a is missing, with no default Is this a bug or is there a different solution that I miss here? I can't spot why your use of constrOptim isn't working, but you should be able to workaround it by doing something like this: applyDefaults - function(fn, ...) { function(x) fn(x, ...) } constrOptim(c(-1.2,0.9), applyDefaults(fr, a=100), NULL, ui=rbind(c(-1,0),c(0,-1)),ci=c(-1,-1)) The applyDefaults function creates a new function which evaluates the old one with some of the parameters set to fixed values. Duncan Murdoch __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] constrOptim and function with additional parameters?
Actually, I think this is a bug. Take a look at this part of constrOptim: constrOptim function (theta, f, grad, ui, ci, mu = 1e-04, control = list(), method = if (is.null(grad)) Nelder-Mead else BFGS, outer.iterations = 10 0, outer.eps = 1e-05, ...) { if (!is.null(control$fnscale) control$fnscale 0) mu - -mu [...] obj - f(theta) ^^^ r - R(theta, theta) for (i in 1:outer.iterations) { obj.old - obj r.old - r [...] } So the object function `f' is called on the starting value `theta' but the `...' is not passed through. -roger Duncan Murdoch wrote: On Wed, 14 Jul 2004 14:59:01 +0200 (MEST), Marlene Mueller [EMAIL PROTECTED] wrote : 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: constrOptim(c(-1.2,0.9), fr, NULL, ui=rbind(c(-1,0),c(0,-1)), ci=c(-1,-1),a=100) Error in f(theta) : Argument a is missing, with no default Is this a bug or is there a different solution that I miss here? I can't spot why your use of constrOptim isn't working, but you should be able to workaround it by doing something like this: applyDefaults - function(fn, ...) { function(x) fn(x, ...) } constrOptim(c(-1.2,0.9), applyDefaults(fr, a=100), NULL, ui=rbind(c(-1,0),c(0,-1)),ci=c(-1,-1)) The applyDefaults function creates a new function which evaluates the old one with some of the parameters set to fixed values. Duncan Murdoch __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] constrOptim and function with additional parameters?
This is why the `...' argument is passed to `optim' and not to the function being optimized, as it also referred in the help file of `constrOptim' constrOptim function (theta, f, grad, ui, ci, mu = 1e-04, control = list(), method = if (is.null(grad)) Nelder-Mead else BFGS, outer.iterations = 100, outer.eps = 1e-05, ...) ... a - optim(theta.old, fun, gradient, control = control, method = method, ...) ... } Best, Dimitris Dimitris Rizopoulos Doctoral Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/396887 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Roger D. Peng [EMAIL PROTECTED] To: Duncan Murdoch [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; Marlene Mueller [EMAIL PROTECTED] Sent: Wednesday, July 14, 2004 4:01 PM Subject: Re: [R] constrOptim and function with additional parameters? Actually, I think this is a bug. Take a look at this part of constrOptim: constrOptim function (theta, f, grad, ui, ci, mu = 1e-04, control = list(), method = if (is.null(grad)) Nelder-Mead else BFGS, outer.iterations = 10 0, outer.eps = 1e-05, ...) { if (!is.null(control$fnscale) control$fnscale 0) mu - -mu [...] obj - f(theta) ^^^ r - R(theta, theta) for (i in 1:outer.iterations) { obj.old - obj r.old - r [...] } So the object function `f' is called on the starting value `theta' but the `...' is not passed through. -roger Duncan Murdoch wrote: On Wed, 14 Jul 2004 14:59:01 +0200 (MEST), Marlene Mueller [EMAIL PROTECTED] wrote : 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: constrOptim(c(-1.2,0.9), fr, NULL, ui=rbind(c(-1,0),c(0,-1)), ci=c(-1,-1),a=100) Error in f(theta) : Argument a is missing, with no default Is this a bug or is there a different solution that I miss here? I can't spot why your use of constrOptim isn't working, but you should be able to workaround it by doing something like this: applyDefaults - function(fn, ...) { function(x) fn(x, ...) } constrOptim(c(-1.2,0.9), applyDefaults(fr, a=100), NULL, ui=rbind(c(-1,0),c(0,-1)),ci=c(-1,-1)) The applyDefaults function creates a new function which evaluates the old one with some of the parameters set to fixed values. Duncan Murdoch __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] constrOptim and function with additional parameters?
OK, I got the point why the help refers to the arguments of 'optim' only. (Of course, I have read this but did'nt believe it ... ;-)) Thanks to all of you for the clarification and special thanks to Duncan Murdoch for the workaround, which is very close to what I want. I am doing a lot of constrained regression in the moment, so including additional parameters (=the data) is an issue for me. Best regards, Marlene This is why the `...' argument is passed to `optim' and not to the function being optimized, as it also referred in the help file of `constrOptim' constrOptim function (theta, f, grad, ui, ci, mu = 1e-04, control = list(), method = if (is.null(grad)) Nelder-Mead else BFGS, outer.iterations = 100, outer.eps = 1e-05, ...) ... a - optim(theta.old, fun, gradient, control = control, method = method, ...) ... } Best, Dimitris Dimitris Rizopoulos Doctoral Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/396887 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Roger D. Peng [EMAIL PROTECTED] To: Duncan Murdoch [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; Marlene Mueller [EMAIL PROTECTED] Sent: Wednesday, July 14, 2004 4:01 PM Subject: Re: [R] constrOptim and function with additional parameters? Actually, I think this is a bug. Take a look at this part of constrOptim: constrOptim function (theta, f, grad, ui, ci, mu = 1e-04, control = list(), method = if (is.null(grad)) Nelder-Mead else BFGS, outer.iterations = 10 0, outer.eps = 1e-05, ...) { if (!is.null(control$fnscale) control$fnscale 0) mu - -mu [...] obj - f(theta) ^^^ r - R(theta, theta) for (i in 1:outer.iterations) { obj.old - obj r.old - r [...] } So the object function `f' is called on the starting value `theta' but the `...' is not passed through. -roger Duncan Murdoch wrote: On Wed, 14 Jul 2004 14:59:01 +0200 (MEST), Marlene Mueller [EMAIL PROTECTED] wrote : 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: constrOptim(c(-1.2,0.9), fr, NULL, ui=rbind(c(-1,0),c(0,-1)), ci=c(-1,-1),a=100) Error in f(theta) : Argument a is missing, with no default Is this a bug or is there a different solution that I miss here? I can't spot why your use of constrOptim isn't working, but you should be able to workaround it by doing something like this: applyDefaults - function(fn, ...) { function(x) fn(x, ...) } constrOptim(c(-1.2,0.9), applyDefaults(fr, a=100), NULL, ui=rbind(c(-1,0),c(0,-1)),ci=c(-1,-1)) The applyDefaults function creates a new function which evaluates the old one with some of the parameters set to fixed values. Duncan Murdoch __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] 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 section of those help pages) adding extra (useless) parameters: fr - function(x,extra1,extra2) { ## Rosenbrock Banana function x1 - x[1] x2 - x[2] extra1*extra2*100 * (x2 - x1 * x1)^2 + (1 - x1)^2 } grr - function(x,extra1,extra2) { ## Gradient of 'fr' x1 - x[1] x2 - x[2] extra1*extra2*c(-400 * x1 * (x2 - x1 * x1) - 2 * (1 - x1), 200 * (x2 - x1 * x1)) } now, call it: optim(c(-1.2,1), fr, grr, extra1=c(1,2), extra2=c(3,4)) ok! but now: constrOptim(c(-1.2,0.9), fr, grr, ui=rbind(c(-1,0),c(0,-1)), ci=c(-1,-1), extra1=c(1,2), extra2=c(3,4) ) return the error: Error in f(theta) : Argument extra1 is missing, with no default But in 'constrOptim' help page says: ...: Other arguments passed to `optim' And in 'optim' help page says: ...: Further arguments to be passed to `fn' and `gr'. My guess is that when 'constrOptim' calls 'optim' she doen´t send the extra arguments to correct evaluation of functions non-f(x)-like such as f(x,theta)-like. But whow I (we?) can fix it ? Any ideas ? __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] constrOptim doesn´t send arguments to optim!(?)
I'm not sure this is necessarily a bug in constrOptim. I think the problem is that while `...' is in fact passed to optim(), the objective function is evaluated in constrOptim a few times before optim() is called and `...' is not passed in those cases. The easiest way to make this problem go away is use lexical scoping. For example: make.fr - function(extra1, extra2) { function(x) { x1 - x[1] x2 - x[2] extra1 * extra2 * 100 * (x2-x1 * x1)^2 + (1-x1)^2 } } And then in R f - make.fr(c(1,2), c(3,4)) Then call constrOptim using this new f(). You don't have to worry about passing extra parameters now. -roger Ricardo Zorzetto Nicoliello Vencio wrote: 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 section of those help pages) adding extra (useless) parameters: fr - function(x,extra1,extra2) { ## Rosenbrock Banana function x1 - x[1] x2 - x[2] extra1*extra2*100 * (x2 - x1 * x1)^2 + (1 - x1)^2 } grr - function(x,extra1,extra2) { ## Gradient of 'fr' x1 - x[1] x2 - x[2] extra1*extra2*c(-400 * x1 * (x2 - x1 * x1) - 2 * (1 - x1), 200 * (x2 - x1 * x1)) } now, call it: optim(c(-1.2,1), fr, grr, extra1=c(1,2), extra2=c(3,4)) ok! but now: constrOptim(c(-1.2,0.9), fr, grr, ui=rbind(c(-1,0),c(0,-1)), ci=c(-1,-1), extra1=c(1,2), extra2=c(3,4) ) return the error: Error in f(theta) : Argument extra1 is missing, with no default But in 'constrOptim' help page says: ...: Other arguments passed to `optim' And in 'optim' help page says: ...: Further arguments to be passed to `fn' and `gr'. My guess is that when 'constrOptim' calls 'optim' she doen´t send the extra arguments to correct evaluation of functions non-f(x)-like such as f(x,theta)-like. But whow I (we?) can fix it ? Any ideas ? __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help