Dear R listers, I have a very annoying problem using nlm(). I want to find the minimizer of my target function, if written in \LaTeX is f(\mu1,\mu2,\sigma1,\sigma2) = \sum_i^n( w_ig_t(z_i) ), where g_t(z) is a pdf of bivariate normal distribution and z_i is my samples. I cannot get the estimation result generated by nlm(), and I got the following errors " Error in nlm(foo, theta.start, hessian = TRUE) : non-finite value supplied by 'nlm' " from time to time( If I ran the code second time , it does not have the error .) I am new to R so I don't know if there is any debug method of R code. i hope somebody can help me out . Thanks in advance. ------------------------ Jiang Peng, Ph.D. Candidate Department of mathematics & Antai college of Economics and management Shanghai Jiao Tong University Address: Room 127, #3 Building, Xuhui Campus E-mail: jp021 at sjtu.edu.cn jp021 at 126.com MSN: jp021 at hotmail.com iChat: mathfrog at mac.com Mobile: +86-138 168 780 95