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

[1] 4.37124e+113

> s2

[1] 270486

> s

[1] 3646

> n

[1] 71

> 

 

 

Is a -(loglikelihood function), the parameter a e b are positive.

I've used the function 

 

max<-constrOptim(c(1,1),neg_loglik, 

grad=NULL,

ui=rbind(c(1,0),c(0,1)), ci=c(0,0))

 

but without success cause I think the max is only local.

 

Great wishes

 

Daniela

 

 


	[[alternative HTML version deleted]]

