Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Maximum likelihood programming for panel data


From   "Zou Lei (AIM)" <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: Maximum likelihood programming for panel data
Date   Wed, 26 Mar 2014 22:39:02 +0100

Hi,

I would very much appreciate your help on the following MLE problem.
Please see the problem description below.

Many thanks for your help!
Lei
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.
   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

   constraint 1 [#1]x= [#2]x
   Stata command: ml model lf LDV (mu1:  y=x) (mu2: y=x) (sigma:)
This code is used to calculate the security trading cost for each company listed.
The problem is that I have panel data. And i need to get the c1_j, c2_j  for every company in my dataset. how could i manage to do it? Thanks very much! 

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index