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

From |
"Rodrigo A. Alfaro" <raalfaroa@gmail.com> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: Re: Calculation of integrals |

Date |
Mon, 10 Dec 2007 21:46:48 -0300 |

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" <e.mentzakis@abdn.ac.uk>

To: <statalist@hsphsun2.harvard.edu>

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/

**References**:**st: Calculation of integrals***From:*"Mentzakis, Emmanouil" <e.mentzakis@abdn.ac.uk>

- Prev by Date:
**Re: st: heteroskedastisity and panel data problem (again)** - Next by Date:
**st: Statsby equivalent with -ml-** - Previous by thread:
**st: Calculation of integrals** - Next by thread:
**st: RE: Negative Binomial Regression** - Index(es):

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