[R] loop in optim

EdBo n.bowora at gmail.com
Thu Jul 7 05:39:19 CEST 2011


I have one last theoretical question, I did not adjust my code prior so that
it maximise the likehood function. I googled that to make optim maximise you
multiply fn by -1.

In my code, would that be the same as saying "-sum" on the "sum" part of my
code (see below)?

llik = function(x) 
   { 
    al_j=x[1]; au_j=x[2]; sigma_j=x[3];  b_j=x[4]
    sum(na.rm=T,

        ifelse(a$R_j< 0, log(1 / ( sqrt(2*pi) * sigma_j) )-
  

--
View this message in context: http://r.789695.n4.nabble.com/loop-in-optim-tp3643230p3650592.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list