[R] Optim() package restriction

nserdar snes1982 at hotmail.com
Fri Feb 24 20:18:59 CET 2012


Hi 

I need a "phi" restriction in my code. That is   "0<phi<1 "
 
How can I do that ?

Linn=function(param){

 phi=param[1]
 sigw=param[2]
 sigv=param[3]
 Betam=param[4]
 
 
 kf=kfilter1(n,st[,k],st[,1],0,1,phi,Betam,sigw,sigv)
 
 return(kf$like)
 
 }

init.par<-c(1,1,1,1)
estimate<- optim(init.par,Linn,gr=NULL,method= "BFGS", hessian=FALSE,control
= list(trace=1))

Regards,
res

--
View this message in context: http://r.789695.n4.nabble.com/Optim-package-restriction-tp4418379p4418379.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list