[R] how to restrict a parameter in optim()

Luis SAGAON TEYSSIER luis.sagaon_teyssier at etumel.univmed.fr
Wed Oct 29 14:35:20 CET 2008


Dear all,

I'm trying to estimate some parameters with the optim() function but I  
need to restrict one parameter and I have not found how to do it.  
Could you help me please?

my program is basically

fn<-function(s)

initial<-function(r)
{
cst<-r[1]
cst1<-r[2]
beta<-r[3]
rho<-r[4]
p1<-r[5]

return(-sum())
}

parms<-c()

m0<-optim()


I need to specify 0<=p1<=1.

Thank you very much

Luis SAGAON



More information about the R-help mailing list