[R] Maximization problem in the optim function

R. Michael Weylandt michael.weylandt at gmail.com
Thu Mar 15 01:23:53 CET 2012

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.


On Wed, Mar 14, 2012 at 6:57 PM, Niroshan <wnnperer at ucalgary.ca> wrote:
> 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 can be passed in
> the function?  For the correlation parameter I used Fishers’ transformation
> so it didn’t give any problems. I know we can use ‘L-BFGS-B’ method instead
> of ‘BFGS’. However, it produces some non sensible estimates.
> Thanks for taking time
> --
> View this message in context: http://r.789695.n4.nabble.com/Maximization-problem-in-the-optim-function-tp4473408p4473408.html
> Sent from the R help mailing list archive at Nabble.com.
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list