"should write a function that uses the parameters and the sample data as input and outputs the likelihood. Is it correct?"
Yes, that is correct. Take a look at the optim() function. ?optim What type of convergence problems did you experience with Matlab? I am not sure if using R can overcome fundamental modeling and computational issues, such as over-specification of the model for the data at hand. But, may be you need to impose constraints on the parameter if you are fitting a Gaussian mixture. Another option is to use packages that are specially designed to model finite mixtures such as "flexmix" or "mixtools". Ravi. ---------------------------------------------------------------------------- ------- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: rvarad...@jhmi.edu Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty_personal_pages/Varadhan.h tml ---------------------------------------------------------------------------- -------- -----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of jckval Sent: Monday, January 04, 2010 5:53 PM To: r-help@r-project.org Subject: [R] MLE optimization Folks, I'm kind of newbie in R, but with some background in Matlab and VBA programming. Last month I was implementing a Maximum Likelihood Estimation in Matlab, but the algorithms didn't converge. So my academic advisor suggested using R. My problem is: estimate a mean reverting jump diffusion parameters. I've succeeded in deriving the likelihood function (which looks like a gaussian mixture) and it is implemented in R. My main doubts are related to the inputs and outputs that this function should generate, for instance, in Matlab this function should get the parameters as input and output the likelihood using the sample data (imported within the function). In order to make R optimizers to work I, apparently, should write a function that uses the parameters and the sample data as input and outputs the likelihood. Is it correct? Could someone reply with an example code which examplifies the type of function I should write and the syntax to optimize? Alternatively, could anyone suggest a good MLE tutorial and package? Thankfully, JC -- View this message in context: http://n4.nabble.com/MLE-optimization-tp998655p998655.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@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. ______________________________________________ R-help@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.