Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: User-defined MLE problem: How would you solve this?


From   efeijen@worldbank.org
To   statalist@hsphsun2.harvard.edu
Subject   st: User-defined MLE problem: How would you solve this?
Date   Wed, 18 Jun 2008 12:32:44 -0400

Hi:

   I would appreciate your help on the following MLE problem (it is the
   transaction cost model for financial markets as initially used in Lesmond
   (1995)).

   Please see the problem description below.

   Many thanks for your help!

   Erik


   This is the log likelihood function:

   LNF=
   SUM(if y_j<0) [ln(1/(2*pi*(sigma_j^2)))-(1
   /(2*(sigma_j^2))*(y_j+c1_j-b_j*x))^2]
   +
   SUM(if y_j>0) [ln(1/(2*pi*(sigma_j^2)))-(1
   /(2*(sigma_j^2))*(y_j+c2_j-b_j*x))^2]
   +
   SUM(if y_j=0) [Ln(NCDF((-c2_j-b_j*x)/sigma_j)- NCDF((-c1_j-b_j*x)/sigma_j)].

   Where the y_j's and x vectors represents the dependent and independent
   variables, respectively. NCDF stands for normal cumulative density function.

   The parameters c1_j, c2_j (constants), b_j (x-coefficient), and sigma_j need
   to be estimated for each dependent variable j.

   Below you find the .ado file and the command I used for this problem. However
   I know they are not correct, since my setup estimates 2 x-coefficients
   defined by the mu1 and mu2 equations, but I only want to estimate one for the
   dependent variable j: b_j. What to do such that the intercepts in mu1 and mu2
   are different, but b_j are identical?

   program LDV
         version 9.2
         args lnf mu1 mu2 sigma
         quietly replace `lnf'=ln(1/(2*_pi*(`sigma'^2)))-(1
         /(2*(`sigma'^2))*($ML_y1-`mu1'))^2 if $ML_y1<0
         quietly replace `lnf'=ln(1/(2*_pi*(`sigma'^2)))-(1
         /(2*(`sigma'^2))*($ML_y1-`mu2'))^2 if $ML_y1>0
         quietly replace
         `lnf'=ln(normalden(-`mu2',0,`sigma')-normalden(-`mu1',0,`sigma')) if
         $ML_y1==0
   end


   Stata command: ml model lf LDV (mu1:  y=x) (mu2: y=x) (sigma:)

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index