Statalist


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

st: Calculation of integrals


From   "Mentzakis, Emmanouil" <e.mentzakis@abdn.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Calculation of integrals
Date   Mon, 10 Dec 2007 19:47:41 -0000

Dear all,   

I am calculating an integral in Stata and then compare the calculation
with the same calculation in Limdep.    

However, the difference between the two calculations is very big (Stata
= 3.233 ; Limdep = 980.525).       

Below I have the code for Stata and the code for Limdep.     

Could anyone explain if I am making a mistake or what is the reason for
this result?     

Thank you    
Manos    


*****************************            
*********** Stata ***********            
*****************************            

clear      
set obs 300     
capture drop xb x           
g xb=invnormal(uniform())                
range x .001 1000 300                 
g double lnx=ln(x)              
g double norm=normal(xb + .5*lnx)/300              
integ norm x, g(integral)                           

number of points = 300                

integral         = 3.233067                
    


********************************            
************ Limdep ************               
********************************                 
Coping the data from Stata, in Limdep we don't have to create a variable
for the range. It automatically uses the variable that is put in the
"label" and its limit is given by the "limit" and the number of points
by "pts". "Start" is the values of the parameters, but changing it
doesn't make any difference in the actual calculation.          

Fintegrate ;fcn = PHI(xb + .5*log(var))/300
    ;labels = var
    ;start = 500
    ;pts =300
    ;limit = 0.001,1000
    ;vary(var)
    $
            +---------------------------------------------------+
            | Function integration:                             |
            | Grid is  300 points in [      .001 to   1000.000] |
            | Value of the integral is       980.52567          |
            +---------------------------------------------------+




*
*   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–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index