From: Tolga Uzuner <tolga_at_coubros.com>

Date: Sun 10 Apr 2005 - 02:29:55 EST

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 Received on Sun Apr 10 02:43:21 2005

Date: Sun 10 Apr 2005 - 02:29:55 EST

Hi,

Am having problems specifying lower and upper constraints in constrOptim...

I have a function(x)->f which takes a 5 vector array the constraints on the elements of x are:

x[1],x[2],x[3],x[5]>0 x[4]>-1 x[1],x[2],x[3],x[4],x[5]<1

this works:

############

* > x
*

[1] 0.400 0.200 0.200 -0.050 0.002

* > optim(x,f)
*

$par

[1] 0.28630079 0.13583616 0.18752379 0.02231329 0.08640233

$message

**NULL
**

###########

but when I try to specify the constraints, I get this:
###########

* >
*

constrOptim(x,f,grad=NULL,ui=rbind(diag(5),-diag(5)),ci=c(0,0,0,-1,0,1,1,1,1,1))
Error in constrOptim(x, f, grad = NULL, ui = rbind(diag(5), -diag(5)), :

initial value not feasible

* >
*

###########

What am I doing wrong ? As above, x=c(0.400 ,0.200, 0.200,-0.050 ,0.002)

Many thanks,

Tolga

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 Received on Sun Apr 10 02:43:21 2005

*
This archive was generated by hypermail 2.1.8
: Fri 03 Mar 2006 - 03:31:05 EST
*