Re: [R] Maximization problem in the optim function

2012-03-14 Thread Niroshan
This is the part of the function in my likelihood function prob<-function(t1,t2,m1,m2,s_r,s_p,s_e,cor_m){ if ((t1==0) & (t2==0)) log_lik<-log(pmvnorm(lower=rep(-Inf, 2), upper=c(m1/sqrt(s_r+s_p+s_e+1),m2/sqrt(s_r+s_p+s_e+1)), mean=rep(0,2), corr=cor_m)) else if ((t1==0) & (t2==1)) log_lik<

Re: [R] Maximization problem in the optim function

2012-03-14 Thread R. Michael Weylandt
What distribution's log-likelihood are you using? If sigma is supposed to be square-rooted, you may have to put a constraint or use of abs() might suffice -- though, admittedly I'm not sure what that will do to convergence behavior -- but it's hard to help without seeing the function at hand. Mich