Skip to content

MLE optimization

4 messages · jckval, Ravi Varadhan, Liviu Andronic

#
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
#
"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: rvaradhan at jhmi.edu

Webpage:
http://www.jhsph.edu/agingandhealth/People/Faculty_personal_pages/Varadhan.h
tml

 

----------------------------------------------------------------------------
--------


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of jckval
Sent: Monday, January 04, 2010 5:53 PM
To: r-help at 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
#
Hello
On 1/4/10, jckval <jcnogueirafilho at gmail.com> wrote:
Search for "MLE" on Rseek.org and among other results check the Task
Views. Also, search for "MLE" in "vignettes" on RSiteSearch [1].
[1] http://finzi.psych.upenn.edu/nmz.html

To get a good list of MLE-related functions in R, try something
similar to the following (you can also do this graphically with
RcmdrPlugin.sos):
found 642 matches;  retrieving 20 pages, 400 matches.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Call:
findFn(string = "mle")

Total number of matches: 642
Downloaded 400 links in 121 packages.

Packages with at least 8 matches using pattern
  'mle'
           Package Count MaxScore TotalScore       Date
1           stats4    15       73        347 2009-11-26
2            FitAR    15       27        198 2008-11-20
3               sn    15       27        179 2005-07-18
4              wle    14       80        392 2006-09-01
5          MLEcens    13       56        308 2007-08-31
6             ghyp    13       45        206 2009-10-19
7         circular    11       32        107 2007-08-31
8        degreenet    11       13         76 2008-01-24
9              gbs     9       27        169 2008-05-10
10 SpatialExtremes     8       25         41 2009-06-13
11        DCluster     8       13         50 2009-01-15
12        distrMod     8       12         46 2009-11-05

To get more acquainted with R and user-defined functions, you might
try [1] and [2].
HTH
Liviu

[1] http://www.statmethods.net/management/userfunctions.html
[2] http://rforsasandspssusers.com/