Statalist


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

Re: st: How to convert a do-file (that uses ml functions) into an ado file


From   "David Elliott" <[email protected]>
To   [email protected]
Subject   Re: st: How to convert a do-file (that uses ml functions) into an ado file
Date   Thu, 18 Dec 2008 10:14:47 -0400

Tiago, check in the following code block for b1 macro lacking the `'
quotes - offending line marked with !!!.

       quietly {
               tempvar vb2 vb1 corr cov L
               scalar taub2=exp(`logtb2')
               scalar mub1=`mub2'*`lambda'
               gen double `vb1'=(`v11'+`lambda'^2*taub2)
               gen double `vb2'=( taub2 +`v22')
               gen double `cov'=(`lambda'*taub2 +`v12')
               gen double `corr'= `cov'/sqrt(`vb2'*`vb1')
               gen double `L'= ln(`vb1'*`vb2'*(1-`corr^2')) + /*
                     */ ( (`b1' - mub1 )^2/`vb1' + /*
                     */ (`b2' -`mub2')^2/`vb2' - /*
!!!                  */ 2*`corr'*(b1 - mub1)*(`b2' -
`mub2')/sqrt(`vb2'*`vb1') )/*
                                       */ /(1-`corr'^2)
               replace `lnl'=-0.5*`L' - 0.5*ln(2*_pi)

               }


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



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