Daniela Garavaglia <danygaravaglia84 <at> virgilio.it> writes: > > I'm looking for a R function which can maximise this logliklihood function, > under the constraits a>0 e b>0 > > f<-function(param){ > > a<-param[1] > > b <-param[2] > > log(prod)-(a*s2)-(b*s)-n*log(1-((0.5*b/sqrt(a))*(exp((b^2)/(4*a)))*((sqrt(pi > ))*(1-pnorm(-b/(2*sqrt(a)), mean=0, sd=1)))))} >
If you're really just looking for "box constraints" (independent inequalities on different parameters) then optim(...,method="L-BFGS-B", lower=c(0,0)) should work fine [or maybe lower=c(0.002,0.002) if you want to make absolutely sure you don't hit the boundaries] If you use stats4::mle or bbmle::mle2 (which are both wrappers for optim(), so the advice above applies) you will be able to do a little bit more with the results -- e.g. draw profiles and get profile confidence intervals Ben Bolker ______________________________________________ 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.