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: Re: Features for Stata 14
From
"Liu,Zhong" <[email protected]>
To
<[email protected]>
Subject
st: Re: Features for Stata 14
Date
Thu, 5 Sep 2013 18:08:20 +0800
Dear Maarten:
Thanks and especially for reminding me about Stata. I should know it. Sorry.
Best,
Zhong
-----原始邮件-----
From: Maarten Buis
Sent: Thursday, September 05, 2013 5:50 PM
To: [email protected]
Subject: Re: st: Re: Features for Stata 14
Ok, however expect numerical integration inside a simulation to be
painfully slow. Do you mean numerical integration _by_ simulation? If
so, take a look at this special issue of the Stata Journal:
http://www.stata-journal.com/sj6-2.html
Let me repeat that there is no such thing called STATA. Stata,
however, does exist. You may think this difference is trivial, but
people get upset about this on this list as it shows you have not
taken the time to read the Statalist FAQ and it upsets me because you
ignored a gentle hint.
-- Maarten
On Thu, Sep 5, 2013 at 11:24 AM, Liu,Zhong <[email protected]> wrote:
Dear Maarten:
Thanks for your reply. But I do mean -normal(x)- rather
than -normalden(x)-.
The issue involved is that I want to employ Equation (5.7) at p.126 of a
paper authored by Kenneth A. Small and Harvey S. Rosen (1981) in
Econometrica, Vol. 49, No. 1 (Jan., 1981), pp. 105-130. The paper is
titled
"Applied Welfare Economics with Discrete Choice Models", which you can
find
it by following the weblike below:
http://www.jstor.org/discover/10.2307/1911129?uid=3737800&uid=2129&uid=2&uid=70&uid=4&sid=21102620779363
And I also think that it is better for STATA to have an observation-level
numerical integration since many simulation-based estimates need the
functionality of the kind.
Best,
Zhong
-----原始邮件----- From: Maarten Buis
Sent: Thursday, September 05, 2013 3:48 PM
To: [email protected]
Subject: Re: st: Re: Features for Stata 14
On Thu, Sep 5, 2013 at 8:40 AM, Liu,Zhong wrote:
A dataset has two variables, say ‘v1’ and ‘v2’. Either of them has
‘N’
number of observations. I want to generate a third variable, say ‘v3’.
The
1st element of ‘v3’ is the numerical integration with the 1st element
of
‘v1’ as the lower limit to the integral and the 1st element of ‘v2’
as the
upper limit to the integral. Similarly, the 2nd element of ‘v3’ is the
numerical integration with the 2nd element of ‘v1’ as the lower limit
to
the
integral and the 2nd element of ‘v2’ as the upper limit. And so on. The
function integrand is known STATA function such as 'normal(x)' or defined
by
a program written by users.
For many distributions there is no need to do this numerically. In
your example, I suppose you mean -normalden(x)- for the function that
is to be integrated instead of -normal(x)-. -normalden()- gives you
the PDF of the normal distribution (the well known bell shaped curve),
while -normal()- gives you the CDF (an S-shaped curve). In that case
the solution is straightforward, as you can see in the example below.
In -help density_functions- you can find a list of distributions for
which this solution has been implemented.
*------------------ begin example ------------------
// create some example data
clear
input v1 v2
-2 2
-1 1
end
// compute your integrals
gen v3 = normal(v2) - normal(v1)
// admire the result
list
*------------------- end example -------------------
* (For more on examples I sent to the Statalist see:
* http://www.maartenbuis.nl/example_faq )
Hope this helps,
Maarten
Ps. As you can read in the Statalist FAQ
(http://www.stata.com/support/faqs/resources/statalist-faq/#spell) it
is Stata not STATA.
---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany
http://www.maartenbuis.nl
---------------------------------
*
* 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/
*
* 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/
--
---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany
http://www.maartenbuis.nl
---------------------------------
*
* 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/
*
* 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/