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

[R] Maximization problem in the optim function

2012-03-14 Thread Niroshan
Dear R Users I am maximizing a user defined log likelihood function. It includes variance parameter (sigma). I used R function optim with BFGS maximization method. However, it stops before the solution saying “sqrt(sigma): NaNs produced” Could anybody know a proper transformation for sigma which

Re: [R] Maximization Problem

2011-10-25 Thread cberry
Eliano Marques writes: > Hi there, > > I need help in an optimization procedement. > > I'm trying to maximize the function fn=x^2+5y^2 with the restriction of > fn1=x-y<=5. > > I tried the genoud method and as well the alabama method. > > I have problems to set the constraint in R. > > Can someon

[R] Maximization Problem

2011-10-25 Thread Eliano Marques
Hi there, I need help in an optimization procedement. I'm trying to maximize the function fn=x^2+5y^2 with the restriction of fn1=x-y<=5. I tried the genoud method and as well the alabama method. I have problems to set the constraint in R. Can someone help me please? Regards, Eliano