Statalist


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

st: RE: Re: Calculation of integrals


From   "Mentzakis, Emmanouil" <[email protected]>
To   <[email protected]>
Subject   st: RE: Re: Calculation of integrals
Date   Tue, 11 Dec 2007 18:24:39 -0000

Dear Rodrigo, 

Thanks for your reply. Differences in the results are not restricted to
a specific integral. 

E.g. using the command below

clear
range x 1 100 50
g double lnx=ln(x)
g double y=5*lnx
integ y x, g(result)

If I understand correctly, I compute the integral with lower limit 1 and
upper limit 100, over 50 points and the function integrated is 5*ln(x).
Is this correct?

Similarly in Limdep, I thought that the same calculation would be done
by the command

Fintegrate ;fcn = 5*log(var)
    ;labels = var
    ;start = 10
    ;pts =50
    ;limit = 1,100
    ;vary(var)
    $

Where, again, the limits are from 1 to 100, for 50 points and for the
function 5*log(x). What is specified as "start" does not influence the
calculation. It, actually, is a value given so that it can be assessed
before the computation is done whether the function evaluation is
possible at all. 

I'd really appreciate if you could comment on the equality of the two
commands, because probably I am estimating two different things without
realising it. 

Thanks
Manos




-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Rodrigo A.
Alfaro
Sent: 11 December 2007 00:47
To: [email protected]
Subject: st: Re: Calculation of integrals 

Manos,

It is difficult to give an answer with this info. What is exactly the
integral that you want to calculate? What is the initial parameter in
Limdep? It seems that you are trying to get an integral of the normal
cdf, then something like 1000 seems too much as result (just a guess)

Rodrigo.


----- Original Message -----
From: "Mentzakis, Emmanouil" <[email protected]>
To: <[email protected]>
Sent: Monday, December 10, 2007 4:47 PM
Subject: st: Calculation of integrals


> 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/ 

*
*   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/

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