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. ______________________________________________ R-help@r-project.org 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.