Re: [R] maximization under constraits

2008-08-08 Thread bartjoosen
You wrote MAXIMIZE this function, why not using the maximize option of constrOptim? If you read the help file, you will find that if you set the control fnscale to a negative value, maximisation is performed. constrOptim(c(1,1),neg_loglik, grad=NULL, ui=rbind(c(1,0),c(0,1)), ci=c(0,0),control=li

[R] maximization under constraits

2008-08-07 Thread Daniela Garavaglia
I'm an Italian student looking for help. How can I maximize this function? neg_loglik<-function(param){ a<-param[1] b <-param[2] -(log(pr)-(a*s2)-(b*s)+n*log(2*a)-n*log(1-(b/sqrt(a))*exp((b^2)/(4*a))*(sqrt (pi))*(1-pnorm(b/(2*sqrt(a)), mean=0, sd=1))*1)) } Con > pr

Re: [R] Maximization under constraits

2008-07-27 Thread Ritwik Sinha
Hi Daniela, Will the "optim" function with the method "L-BFGS-B" work for you? Look for the "lower" argument in the function. Ritwik On Fri, Jul 25, 2008 at 9:07 AM, Daniela Garavaglia <[EMAIL PROTECTED]> wrote: > > I'm looking for a R function which can maximise this logliklihood function, > un

Re: [R] Maximization under constraits

2008-07-25 Thread Ben Bolker
Daniela Garavaglia 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(

[R] Maximization under constraits

2008-07-25 Thread Daniela Garavaglia
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)} I've tri